Adapt cosmwasm code to wasmd 0.10

This commit is contained in:
Simon Warta 2020-07-24 12:55:40 +02:00
parent c9283db741
commit b92405108a
4 changed files with 24 additions and 15 deletions

View File

@ -58,6 +58,7 @@ async function uploadContract(
wasm_byte_code: toBase64(contract.data),
source: contract.source || "",
builder: contract.builder || "",
instantiate_permission: null,
},
};
const fee: StdFee = {
@ -413,9 +414,6 @@ describe("wasm", () => {
jasmine.objectContaining({
code_id: codeId,
creator: alice.address0,
init_msg: jasmine.objectContaining({
beneficiary: beneficiaryAddress,
}),
}),
);
expect(myInfo.admin).toBeUndefined();
@ -455,16 +453,14 @@ describe("wasm", () => {
// check out history
const myHistory = await client.wasm.getContractCodeHistory(myAddress);
assert(myHistory);
expect(myHistory).toEqual(
jasmine.objectContaining({
codeId: codeId,
operation: "Init",
msg: {
verifier: alice.address0,
beneficiary: beneficiaryAddress,
},
}),
);
expect(myHistory).toContain({
code_id: codeId,
operation: "Init",
msg: {
verifier: alice.address0,
beneficiary: beneficiaryAddress,
},
});
// make sure random addresses don't give useful info
const nonExistentAddress = makeRandomAddress();
expect(await client.wasm.getContractCodeHistory(nonExistentAddress)).toBeNull();

View File

@ -1,11 +1,17 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Coin, Msg } from "@cosmjs/sdk38";
// TODO: implement
/**
* @see https://github.com/CosmWasm/wasmd/blob/v0.10.0-alpha/x/wasm/internal/types/params.go#L68-L71
*/
export type AccessConfig = never;
/**
* Uploads Wasm code to the chain.
* A numeric, auto-incrementing code ID will be generated as a result of the execution of this message.
*
* @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L34
* @see https://github.com/CosmWasm/wasmd/blob/v0.10.0-alpha/x/wasm/internal/types/msg.go#L10-L20
*/
export interface MsgStoreCode extends Msg {
readonly type: "wasm/MsgStoreCode";
@ -18,6 +24,7 @@ export interface MsgStoreCode extends Msg {
readonly source: string;
/** A docker tag. Can be empty. */
readonly builder: string;
readonly instantiate_permission: AccessConfig | null;
};
}

View File

@ -214,6 +214,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
wasm_byte_code: toBase64(compressed),
source: source,
builder: builder,
instantiate_permission: null,
},
};
const result = await this.signAndPost([storeCodeMsg], this.fees.upload, memo);

View File

@ -1,9 +1,13 @@
import { Coin, Msg } from "@cosmjs/sdk38";
/**
* @see https://github.com/CosmWasm/wasmd/blob/v0.10.0-alpha/x/wasm/internal/types/params.go#L68-L71
*/
export declare type AccessConfig = never;
/**
* Uploads Wasm code to the chain.
* A numeric, auto-incrementing code ID will be generated as a result of the execution of this message.
*
* @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L34
* @see https://github.com/CosmWasm/wasmd/blob/v0.10.0-alpha/x/wasm/internal/types/msg.go#L10-L20
*/
export interface MsgStoreCode extends Msg {
readonly type: "wasm/MsgStoreCode";
@ -16,6 +20,7 @@ export interface MsgStoreCode extends Msg {
readonly source: string;
/** A docker tag. Can be empty. */
readonly builder: string;
readonly instantiate_permission: AccessConfig | null;
};
}
export declare function isMsgStoreCode(msg: Msg): msg is MsgStoreCode;