diff --git a/packages/cli/examples/helpers.ts b/packages/cli/examples/helpers.ts index 9d36fee2..b3761e5a 100644 --- a/packages/cli/examples/helpers.ts +++ b/packages/cli/examples/helpers.ts @@ -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": "tendermint/Secp256k1PubKey", "value": toBase64(execPen.pubkey)}, "cosmos"); + const sender = encodeAddress({ "type": types.pubkeyType.secp256k1, "value": toBase64(execPen.pubkey)}, "cosmos"); const instantiateContractMsg = { type: "wasm/execute", value: { diff --git a/scripts/guide.md b/scripts/guide.md index 3efc8e78..19c1fab4 100644 --- a/scripts/guide.md +++ b/scripts/guide.md @@ -1,22 +1,37 @@ ## Setup +Start chain: + +```sh +./scripts/cosm/start.sh +``` + +```sh +cd packages/cli +./bin/cosmwasm-cli --init examples/helpers.ts +``` + +```js +const account = (await client.authAccounts(faucetAddress)).result.value; +account + +client.listCodeInfo() +client.listContractAddresses() +``` + +## Deploy Contract + ```sh node ./scripts/cosm/deploy_erc20.js ``` ## Make account -```sh -cd packages/cli -./bin/cosmwasm-cli --init examples/helpers.ts -``` Now, check it and init/execute contracts: ```js -const account = (await client.authAccounts(faucetAddress)).result.value; -account - +// see it is now deployed client.listCodeInfo() client.listContractAddresses() @@ -34,6 +49,16 @@ const foo = await instantiateContract(client, pen, 1, initMsg); client.queryContractSmart(foo, { balance: { address: faucetAddress } }) +const rcpt = await randomAddress(); +rcpt +client.queryContractSmart(foo, { balance: { address: rcpt } }) + +const execMsg = { transfer: {recipient: rcpt, amount: "808"}} +const exec = await executeContract(client, pen, foo, execMsg); +exec +client.queryContractSmart(foo, { balance: { address: rcpt } }) + + // TODO: unused account // TODO: execute and send tokens ```