Set code meta to ERC20 contract
This commit is contained in:
parent
7316838cf2
commit
ea19f9b5e1
@ -12,6 +12,7 @@ import { RestClient } from "./restclient";
|
||||
import { SigningCosmWasmClient } from "./signingcosmwasmclient";
|
||||
import cosmoshub from "./testdata/cosmoshub.json";
|
||||
import {
|
||||
deployedErc20,
|
||||
getRandomizedHackatom,
|
||||
makeRandomAddress,
|
||||
pendingWithoutWasmd,
|
||||
@ -405,10 +406,10 @@ describe("CosmWasmClient", () => {
|
||||
expect(result.length).toBeGreaterThanOrEqual(1);
|
||||
const [first] = result;
|
||||
expect(first).toEqual({
|
||||
id: 1,
|
||||
checksum: "aff8c8873d79d2153a8b9066a0683fec3c903669267eb806ffa831dcd4b3daae",
|
||||
source: undefined,
|
||||
builder: undefined,
|
||||
id: deployedErc20.codeId,
|
||||
source: deployedErc20.source,
|
||||
builder: deployedErc20.builder,
|
||||
checksum: deployedErc20.checksum,
|
||||
creator: faucet.address,
|
||||
});
|
||||
});
|
||||
@ -421,10 +422,10 @@ describe("CosmWasmClient", () => {
|
||||
const result = await client.getCodeDetails(1);
|
||||
|
||||
const expectedInfo: Code = {
|
||||
id: 1,
|
||||
checksum: "aff8c8873d79d2153a8b9066a0683fec3c903669267eb806ffa831dcd4b3daae",
|
||||
source: undefined,
|
||||
builder: undefined,
|
||||
id: deployedErc20.codeId,
|
||||
source: deployedErc20.source,
|
||||
builder: deployedErc20.builder,
|
||||
checksum: deployedErc20.checksum,
|
||||
creator: faucet.address,
|
||||
};
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import { SigningCosmWasmClient } from "./signingcosmwasmclient";
|
||||
import cosmoshub from "./testdata/cosmoshub.json";
|
||||
import {
|
||||
bech32AddressMatcher,
|
||||
deployedErc20,
|
||||
getRandomizedHackatom,
|
||||
makeRandomAddress,
|
||||
pendingWithoutWasmd,
|
||||
@ -53,12 +54,6 @@ const unusedAccount = {
|
||||
address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u",
|
||||
};
|
||||
|
||||
const deployedErc20 = {
|
||||
codeId: 1,
|
||||
source: "",
|
||||
builder: "",
|
||||
};
|
||||
|
||||
function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx {
|
||||
return {
|
||||
msg: [firstMsg],
|
||||
|
||||
@ -63,6 +63,14 @@ export const tendermintAddressMatcher = /^[0-9A-F]{40}$/;
|
||||
// https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
|
||||
export const bech32AddressMatcher = /^[\x21-\x7e]{1,83}1[02-9ac-hj-np-z]{38}$/;
|
||||
|
||||
/** Deployed as part of scripts/wasmd/init.sh */
|
||||
export const deployedErc20 = {
|
||||
codeId: 1,
|
||||
source: "https://crates.io/api/v1/crates/cw-erc20/0.2.0/download",
|
||||
builder: "confio/cosmwasm-opt:0.7.0",
|
||||
checksum: "aff8c8873d79d2153a8b9066a0683fec3c903669267eb806ffa831dcd4b3daae",
|
||||
};
|
||||
|
||||
export function wasmdEnabled(): boolean {
|
||||
return !!process.env.WASMD_ENABLED;
|
||||
}
|
||||
|
||||
@ -17,6 +17,11 @@ const guest = {
|
||||
address: "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej",
|
||||
};
|
||||
|
||||
const codeMeta = {
|
||||
source: "https://crates.io/api/v1/crates/cw-erc20/0.2.0/download",
|
||||
builder: "confio/cosmwasm-opt:0.7.0",
|
||||
};
|
||||
|
||||
const initMsgHash = {
|
||||
decimals: 5,
|
||||
name: "Hash token",
|
||||
@ -72,7 +77,7 @@ async function main() {
|
||||
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
|
||||
|
||||
const wasm = fs.readFileSync(__dirname + "/contracts/cw-erc20.wasm");
|
||||
const uploadReceipt = await client.upload(wasm, {}, "Upload ERC20 contract");
|
||||
const uploadReceipt = await client.upload(wasm, codeMeta, "Upload ERC20 contract");
|
||||
console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`);
|
||||
|
||||
for (const initMsg of [initMsgHash, initMsgIsa, initMsgJade]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user