diff --git a/packages/cli/README.md b/packages/cli/README.md index 385e2f46..6a271994 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -127,7 +127,7 @@ smartQuery(client, foo, { balance: { address: rcpt } }) const mnemonic = Bip39.encode(Random.getBytes(16)).toString(); const pen = await Secp256k1Pen.fromMnemonic(mnemonic); const pubkey = encodeSecp256k1Pubkey(pen.pubkey); -const address = encodeAddress(pubkey, "cosmos"); +const address = pubkeyToAddress(pubkey, "cosmos"); ``` ## License diff --git a/packages/cli/examples/generate_address.ts b/packages/cli/examples/generate_address.ts index 5c26296e..e0ccfb0e 100644 --- a/packages/cli/examples/generate_address.ts +++ b/packages/cli/examples/generate_address.ts @@ -1,7 +1,7 @@ const mnemonic = Bip39.encode(Random.getBytes(16)).toString(); const pen = await Secp256k1Pen.fromMnemonic(mnemonic); const pubkey = encodeSecp256k1Pubkey(pen.pubkey); -const address = encodeAddress(pubkey, "cosmos"); +const address = pubkeyToAddress(pubkey, "cosmos"); console.info("mnemonic:", mnemonic); console.info("pubkey:", pubkey); diff --git a/packages/cli/examples/helpers.ts b/packages/cli/examples/helpers.ts index c76f05f3..5e26fc4d 100644 --- a/packages/cli/examples/helpers.ts +++ b/packages/cli/examples/helpers.ts @@ -28,7 +28,7 @@ const networkId = "testing"; // helper functions const instantiateContract = async (initClient: RestClient, initPen: Secp256k1Pen, codeId: number, msg: object, transferAmount?: types.Coin[]): Promise => { const memo = "Create an ERC20 instance"; - const sender = encodeAddress({ "type": types.pubkeyType.secp256k1, "value": toBase64(initPen.pubkey)}, "cosmos"); + const sender = pubkeyToAddress({ "type": types.pubkeyType.secp256k1, "value": toBase64(initPen.pubkey)}, "cosmos"); const instantiateContractMsg = { type: "wasm/instantiate", value: { @@ -59,7 +59,7 @@ const instantiateContract = async (initClient: RestClient, initPen: Secp256k1Pen // helper functions const executeContract = async (execClient: RestClient, execPen: Secp256k1Pen, contractAddr: string, msg: object, transferAmount?: types.Coin[]): Promise => { const memo = "Create an ERC20 instance"; - const sender = encodeAddress({ "type": types.pubkeyType.secp256k1, "value": toBase64(execPen.pubkey)}, "cosmos"); + const sender = pubkeyToAddress({ "type": types.pubkeyType.secp256k1, "value": toBase64(execPen.pubkey)}, "cosmos"); const instantiateContractMsg = { type: "wasm/execute", value: { @@ -97,5 +97,5 @@ const randomAddress = async (): Promise => { const mnemonic = Bip39.encode(Random.getBytes(16)).toString(); const randomPen = await Secp256k1Pen.fromMnemonic(mnemonic); const pubkey = encodeSecp256k1Pubkey(randomPen.pubkey); - return encodeAddress(pubkey, "cosmos"); + return pubkeyToAddress(pubkey, "cosmos"); } diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 4e8b8785..37489d2d 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -41,12 +41,12 @@ export function main(originalArgs: readonly string[]): void { [ "@cosmwasm/sdk", [ - "encodeAddress", "encodeSecp256k1Pubkey", "encodeSecp256k1Signature", "makeSignBytes", "marshalTx", "Pen", + "pubkeyToAddress", "RestClient", "Secp256k1Pen", "types", @@ -134,7 +134,7 @@ export function main(originalArgs: readonly string[]): void { const mnemonic = Bip39.encode(Random.getBytes(16)).toString(); const pen = await Secp256k1Pen.fromMnemonic(mnemonic); const pubkey = encodeSecp256k1Pubkey(pen.pubkey); - const address = encodeAddress(pubkey, "cosmos"); + const address = pubkeyToAddress(pubkey, "cosmos"); const data = Encoding.toAscii("foo bar"); const signature = await pen.sign(data);