Upgrade CosmWasm to 0.9 (#245)

* Upgrade chain to v0.9.0-alpha4

* Update expected build_tags

* Update wasmd init contracts

* Update hackatom test contract

* Update CosmWasm message descriptions

* Make some test code more compact

* Pull out InstantiateOptions

* Add admin field to ContractInfo

* Allow instantiating with admin

* Remove some noise

* Add SigningCosmWasmClient.updateAdmin

* Create return type ChangeAdminResult

* Add SigningCosmWasmClient.clearAdmin

* Add SigningCosmWasmClient.migrate

* Move message type testers close to type

* Export MsgUpdateAdmin/isMsgUpdateAdmin

* Fix typo in privillage

* Update some test code

* Test hackatom result data

* Add compatibility table

* Update wasmd to v0.9.0-beta

* Upgrade test contracts
This commit is contained in:
Simon Warta
2020-06-28 08:28:43 +02:00
committed by GitHub
parent 9f7b126044
commit 77980b60f4
22 changed files with 547 additions and 102 deletions
+12 -4
View File
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/camelcase */
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm");
const { Secp256k1Pen } = require("@cosmjs/sdk38");
const { coins, Secp256k1Pen } = require("@cosmjs/sdk38");
const fs = require("fs");
const httpUrl = "http://localhost:1317";
@@ -30,17 +30,25 @@ const bounty = {
},
};
const fees = {
upload: {
amount: coins(25000, "ucosm"),
gas: "1500000", // 1.5 million
},
};
async function main() {
const pen = await Secp256k1Pen.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes));
const client = new SigningCosmWasmClient(httpUrl, alice.address0, (signBytes) => pen.sign(signBytes), fees);
const wasm = fs.readFileSync(__dirname + "/contracts/staking.wasm");
const uploadReceipt = await client.upload(wasm, codeMeta, "Upload Staking code");
console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`);
for (const { label, initMsg } of [bounty]) {
const memo = `Create an staking instance "${label}"`;
const { contractAddress } = await client.instantiate(uploadReceipt.codeId, initMsg, label, memo);
const { contractAddress } = await client.instantiate(uploadReceipt.codeId, initMsg, label, {
memo: `Create an staking instance "${label}"`,
});
console.info(`Contract "${label}" instantiated at ${contractAddress}`);
}
}