Adapt CLI code to new method name

This commit is contained in:
Simon Warta 2020-02-19 10:23:16 +01:00
parent 67b21337ba
commit 3a351e19f7
4 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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);

View File

@ -28,7 +28,7 @@ const networkId = "testing";
// helper functions
const instantiateContract = async (initClient: RestClient, initPen: Secp256k1Pen, codeId: number, msg: object, transferAmount?: types.Coin[]): Promise<string> => {
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<readonly logs.Log[]> => {
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<string> => {
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");
}

View File

@ -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);