diff --git a/packages/cli/examples/helpers.ts b/packages/cli/examples/helpers.ts index ee84fdff..18ade78e 100644 --- a/packages/cli/examples/helpers.ts +++ b/packages/cli/examples/helpers.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/camelcase */ import { - logs, + logs } from "@cosmwasm/sdk"; const defaultHttpUrl = "http://localhost:1317"; @@ -26,9 +26,9 @@ const networkId = "testing"; // helper functions -async function instantiateContract(initClient: RestClient, initPen: Secp256k1Pen, codeId: number, msg: object, transferAmount?: types.Coin[]): Promise { +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": "tendermint/Secp256k1PubKey", "value": toBase64(initPen.pubkey)}, "cosmos"); + const sender = encodeAddress({ "type": types.pubkeyType.secp256k1, "value": toBase64(initPen.pubkey)}, "cosmos"); const instantiateContractMsg = { type: "wasm/instantiate", value: { @@ -57,7 +57,7 @@ async function instantiateContract(initClient: RestClient, initPen: Secp256k1Pen } // helper functions -async function executeContract(execClient: RestClient, execPen: Secp256k1Pen, contractAddr: string, msg: object, transferAmount?: types.Coin[]): Promise { +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": "tendermint/Secp256k1PubKey", "value": toBase64(execPen.pubkey)}, "cosmos"); const instantiateContractMsg = { diff --git a/scripts/guide.md b/scripts/guide.md index ce75709a..3efc8e78 100644 --- a/scripts/guide.md +++ b/scripts/guide.md @@ -29,4 +29,11 @@ info.init_msg client.queryContractSmart(addr, { balance: { address: faucetAddress } }) // make a new contract +const initMsg = { name: "Foo Coin", symbol: "FOO", decimals: 2, initial_balances: [{address: faucetAddress, amount: "123456789"}]} +const foo = await instantiateContract(client, pen, 1, initMsg); + +client.queryContractSmart(foo, { balance: { address: faucetAddress } }) + +// TODO: unused account +// TODO: execute and send tokens ```