Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kiichain/kiijs-utils",
"version": "0.1.2",
"version": "0.1.3",
"type": "module",
"author": "kiiglobal.io <devs@kiiglobal.io>",
"description": "TypeScript utility library for the Kii blockchain",
Expand Down
7 changes: 3 additions & 4 deletions packages/utils/src/ethers/bech32Conversion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { fromBech32 } from '@cosmjs/encoding';
import { isAddress } from 'ethers';
import { toBech32 } from '@cosmjs/encoding';
import { fromBech32, toBech32, toHex } from '@cosmjs/encoding';
import { getAddress, isAddress } from 'ethers';

/**
* Function to turn a kii bech32 into an associated hex address
Expand All @@ -12,7 +11,7 @@ export function Bech32ToHex(bechAddress: string): string | null {
const { prefix, data } = fromBech32(bechAddress);
if (prefix !== 'kii') return null;

const hex = '0x' + Buffer.from(data).toString('hex');
const hex = getAddress(toHex(data));
return hex;
}
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/tests/address.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Bech32ToHex } from '../src/ethers';

describe('Connect Wallet Test', () => {
const hex_address = '0x6647af9d3d958f0ce9d16913949a3a90b8a40a6a';
const hex_address = '0x6647af9d3D958f0cE9D16913949A3A90B8A40a6a';
const kii_address = 'kii1ver6l8fajk8se6w3dyfefx36jzu2gzn2qmu3t9';

it('convert kii to hex', async () => {
Expand Down
Loading