From 737c5c7ac94212f36e3feeaf03a419fd9c5211de Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Mon, 2 Aug 2021 13:15:46 +0200 Subject: [PATCH] Upgrade to the latest proto types --- packages/cli/examples/cosmwasm.ts | 5 -- .../cosmwasm-stargate/src/aminotypes.spec.ts | 46 +++++------ packages/cosmwasm-stargate/src/aminotypes.ts | 81 +++++++++---------- .../cosmwasm-stargate/src/builder.spec.ts | 63 --------------- packages/cosmwasm-stargate/src/builder.ts | 20 ----- .../src/cosmwasmclient.spec.ts | 4 - .../cosmwasm-stargate/src/cosmwasmclient.ts | 24 ++---- .../cosmwasm-stargate/src/encodeobjects.ts | 30 +++---- packages/cosmwasm-stargate/src/index.ts | 2 - .../src/queries/wasm.spec.ts | 35 +++----- .../cosmwasm-stargate/src/queries/wasm.ts | 2 +- .../src/signingcosmwasmclient.spec.ts | 26 +----- .../src/signingcosmwasmclient.ts | 61 ++++---------- .../cosmwasm-stargate/src/testutils.spec.ts | 10 --- scripts/wasmd/deploy_cw1.js | 6 -- scripts/wasmd/deploy_cw3.js | 6 -- scripts/wasmd/deploy_hackatom.js | 6 -- scripts/wasmd/deploy_ibc_reflect.js | 6 -- 18 files changed, 107 insertions(+), 326 deletions(-) delete mode 100644 packages/cosmwasm-stargate/src/builder.spec.ts delete mode 100644 packages/cosmwasm-stargate/src/builder.ts diff --git a/packages/cli/examples/cosmwasm.ts b/packages/cli/examples/cosmwasm.ts index 05549a6f..59bb9dd5 100755 --- a/packages/cli/examples/cosmwasm.ts +++ b/packages/cli/examples/cosmwasm.ts @@ -23,15 +23,10 @@ async function main(hackatomWasmPath: string) { // Upload contract const wasm = fs.readFileSync(hackatomWasmPath); const uploadFee = calculateFee(1_500_000, gasPrice); - const codeMeta = { - source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download", - builder: "cosmwasm/rust-optimizer:0.10.8", - }; const uploadReceipt = await client.upload( alice.address0, wasm, uploadFee, - codeMeta, "Upload hackatom contract", ); console.info("Upload succeeded. Receipt:", uploadReceipt); diff --git a/packages/cosmwasm-stargate/src/aminotypes.spec.ts b/packages/cosmwasm-stargate/src/aminotypes.spec.ts index 34b96c05..e59d06e2 100644 --- a/packages/cosmwasm-stargate/src/aminotypes.spec.ts +++ b/packages/cosmwasm-stargate/src/aminotypes.spec.ts @@ -8,7 +8,7 @@ import { MsgMigrateContract, MsgStoreCode, MsgUpdateAdmin, -} from "cosmjs-types/cosmwasm/wasm/v1beta1/tx"; +} from "cosmjs-types/cosmwasm/wasm/v1/tx"; import Long from "long"; import { @@ -27,12 +27,10 @@ describe("AminoTypes", () => { const msg: MsgStoreCode = { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", wasmByteCode: fromBase64("WUVMTE9XIFNVQk1BUklORQ=="), - source: "Arrabiata", - builder: "Bob", instantiatePermission: undefined, }; const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgStoreCode", + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: msg, }); const expected: AminoMsgStoreCode = { @@ -40,8 +38,6 @@ describe("AminoTypes", () => { value: { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", wasm_byte_code: "WUVMTE9XIFNVQk1BUklORQ==", - source: "Arrabiata", - builder: "Bob", }, }; expect(aminoMsg).toEqual(expected); @@ -52,7 +48,7 @@ describe("AminoTypes", () => { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", codeId: Long.fromString("12345"), label: "sticky", - initMsg: toUtf8( + msg: toUtf8( JSON.stringify({ foo: "bar", }), @@ -61,7 +57,7 @@ describe("AminoTypes", () => { admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", }; const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgInstantiateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: msg, }); const expected: AminoMsgInstantiateContract = { @@ -70,7 +66,7 @@ describe("AminoTypes", () => { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", code_id: "12345", label: "sticky", - init_msg: { + msg: { foo: "bar", }, funds: coins(1234, "ucosm"), @@ -87,7 +83,7 @@ describe("AminoTypes", () => { contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", }; const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin", + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: msg, }); const expected: AminoMsgUpdateAdmin = { @@ -107,7 +103,7 @@ describe("AminoTypes", () => { contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", }; const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgClearAdmin", + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: msg, }); const expected: AminoMsgClearAdmin = { @@ -132,7 +128,7 @@ describe("AminoTypes", () => { funds: coins(1234, "ucosm"), }; const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgExecuteContract", + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: msg, }); const expected: AminoMsgExecuteContract = { @@ -154,14 +150,14 @@ describe("AminoTypes", () => { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", codeId: Long.fromString("98765"), - migrateMsg: toUtf8( + msg: toUtf8( JSON.stringify({ foo: "bar", }), ), }; const aminoMsg = new AminoTypes({ additions: cosmWasmTypes }).toAmino({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgMigrateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: msg, }); const expected: AminoMsgMigrateContract = { @@ -186,20 +182,16 @@ describe("AminoTypes", () => { value: { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", wasm_byte_code: "WUVMTE9XIFNVQk1BUklORQ==", - source: "Arrabiata", - builder: "Bob", }, }; const msg = new AminoTypes({ additions: cosmWasmTypes }).fromAmino(aminoMsg); const expectedValue: MsgStoreCode = { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", wasmByteCode: fromBase64("WUVMTE9XIFNVQk1BUklORQ=="), - source: "Arrabiata", - builder: "Bob", instantiatePermission: undefined, }; expect(msg).toEqual({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgStoreCode", + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: expectedValue, }); }); @@ -211,7 +203,7 @@ describe("AminoTypes", () => { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", code_id: "12345", label: "sticky", - init_msg: { + msg: { foo: "bar", }, funds: coins(1234, "ucosm"), @@ -223,7 +215,7 @@ describe("AminoTypes", () => { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", codeId: Long.fromString("12345"), label: "sticky", - initMsg: toUtf8( + msg: toUtf8( JSON.stringify({ foo: "bar", }), @@ -232,7 +224,7 @@ describe("AminoTypes", () => { admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", }; expect(msg).toEqual({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgInstantiateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: expectedValue, }); }); @@ -253,7 +245,7 @@ describe("AminoTypes", () => { contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", }; expect(msg).toEqual({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin", + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: expectedValue, }); }); @@ -272,7 +264,7 @@ describe("AminoTypes", () => { contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", }; expect(msg).toEqual({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgClearAdmin", + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: expectedValue, }); }); @@ -301,7 +293,7 @@ describe("AminoTypes", () => { funds: coins(1234, "ucosm"), }; expect(msg).toEqual({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgExecuteContract", + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: expectedValue, }); }); @@ -323,14 +315,14 @@ describe("AminoTypes", () => { sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", codeId: Long.fromString("98765"), - migrateMsg: toUtf8( + msg: toUtf8( JSON.stringify({ foo: "bar", }), ), }; expect(msg).toEqual({ - typeUrl: "/cosmwasm.wasm.v1beta1.MsgMigrateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: expectedValue, }); }); diff --git a/packages/cosmwasm-stargate/src/aminotypes.ts b/packages/cosmwasm-stargate/src/aminotypes.ts index 1538ec32..ebc55f3b 100644 --- a/packages/cosmwasm-stargate/src/aminotypes.ts +++ b/packages/cosmwasm-stargate/src/aminotypes.ts @@ -8,18 +8,19 @@ import { MsgMigrateContract, MsgStoreCode, MsgUpdateAdmin, -} from "cosmjs-types/cosmwasm/wasm/v1beta1/tx"; +} from "cosmjs-types/cosmwasm/wasm/v1/tx"; import Long from "long"; // TODO: implement /** - * @see https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/types.proto#L30-L35 + * @see https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/types.proto#L36-L41 */ type AccessConfig = never; /** - * The Amino JSON representation of - * https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/tx.proto#L28-L40 + * The Amino JSON representation of [MsgStoreCode]. + * + * [MsgStoreCode]: https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/tx.proto#L28-L39 */ export interface AminoMsgStoreCode { type: "wasm/MsgStoreCode"; @@ -28,17 +29,14 @@ export interface AminoMsgStoreCode { readonly sender: string; /** Base64 encoded Wasm */ readonly wasm_byte_code: string; - /** A valid URI reference to the contract's source code. Can be empty. */ - readonly source: string; - /** A docker tag. Can be empty. */ - readonly builder: string; readonly instantiate_permission?: AccessConfig; }; } /** - * The Amino JSON representation of - * https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/tx.proto#L70-L80 + * The Amino JSON representation of [MsgExecuteContract]. + * + * [MsgExecuteContract]: https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/tx.proto#L73-L86 */ export interface AminoMsgExecuteContract { type: "wasm/MsgExecuteContract"; @@ -54,8 +52,9 @@ export interface AminoMsgExecuteContract { } /** - * The Amino JSON representation of - * https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/tx.proto#L47-L61 + * The Amino JSON representation of [MsgInstantiateContract]. + * + * [MsgInstantiateContract]: https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/tx.proto#L46-L64 */ export interface AminoMsgInstantiateContract { type: "wasm/MsgInstantiateContract"; @@ -66,8 +65,8 @@ export interface AminoMsgInstantiateContract { readonly code_id: string; /** Human-readable label for this contract */ readonly label: string; - /** Init message as JavaScript object */ - readonly init_msg: any; + /** Instantiate message as JavaScript object */ + readonly msg: any; readonly funds: readonly Coin[]; /** Bech32-encoded admin address */ readonly admin?: string; @@ -75,8 +74,9 @@ export interface AminoMsgInstantiateContract { } /** - * The Amino JSON representation of - * https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/tx.proto#L88-L98 + * The Amino JSON representation of [MsgMigrateContract]. + * + * [MsgMigrateContract]: https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/tx.proto#L94-L104 */ export interface AminoMsgMigrateContract { type: "wasm/MsgMigrateContract"; @@ -93,8 +93,9 @@ export interface AminoMsgMigrateContract { } /** - * The Amino JSON representation of - * https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/tx.proto#L107-L115 + * The Amino JSON representation of [MsgUpdateAdmin]. + * + * [MsgUpdateAdmin]: https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/tx.proto#L113-L121 */ export interface AminoMsgUpdateAdmin { type: "wasm/MsgUpdateAdmin"; @@ -109,8 +110,9 @@ export interface AminoMsgUpdateAdmin { } /** - * The Amino JSON representation of - * https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha2/proto/cosmwasm/wasm/v1beta1/tx.proto#L120-L126 + * The Amino JSON representation of [MsgClearAdmin]. + * + * [MsgClearAdmin]: https://github.com/CosmWasm/wasmd/blob/v0.18.0-rc1/proto/cosmwasm/wasm/v1/tx.proto#L126-L132 */ export interface AminoMsgClearAdmin { type: "wasm/MsgClearAdmin"; @@ -123,36 +125,32 @@ export interface AminoMsgClearAdmin { } export const cosmWasmTypes: Record = { - "/cosmwasm.wasm.v1beta1.MsgStoreCode": { + "/cosmwasm.wasm.v1.MsgStoreCode": { aminoType: "wasm/MsgStoreCode", - toAmino: ({ sender, wasmByteCode, source, builder }: MsgStoreCode): AminoMsgStoreCode["value"] => ({ + toAmino: ({ sender, wasmByteCode }: MsgStoreCode): AminoMsgStoreCode["value"] => ({ sender: sender, wasm_byte_code: toBase64(wasmByteCode), - source: source, - builder: builder, }), - fromAmino: ({ sender, wasm_byte_code, source, builder }: AminoMsgStoreCode["value"]): MsgStoreCode => ({ + fromAmino: ({ sender, wasm_byte_code }: AminoMsgStoreCode["value"]): MsgStoreCode => ({ sender: sender, wasmByteCode: fromBase64(wasm_byte_code), - source: source, - builder: builder, instantiatePermission: undefined, }), }, - "/cosmwasm.wasm.v1beta1.MsgInstantiateContract": { + "/cosmwasm.wasm.v1.MsgInstantiateContract": { aminoType: "wasm/MsgInstantiateContract", toAmino: ({ sender, codeId, label, - initMsg, + msg, funds, admin, }: MsgInstantiateContract): AminoMsgInstantiateContract["value"] => ({ sender: sender, code_id: codeId.toString(), label: label, - init_msg: JSON.parse(fromUtf8(initMsg)), + msg: JSON.parse(fromUtf8(msg)), funds: funds, admin: admin ?? undefined, }), @@ -160,19 +158,19 @@ export const cosmWasmTypes: Record = { sender, code_id, label, - init_msg, + msg, funds, admin, }: AminoMsgInstantiateContract["value"]): MsgInstantiateContract => ({ sender: sender, codeId: Long.fromString(code_id), label: label, - initMsg: toUtf8(JSON.stringify(init_msg)), + msg: toUtf8(JSON.stringify(msg)), funds: [...funds], admin: admin ?? "", }), }, - "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin": { + "/cosmwasm.wasm.v1.MsgUpdateAdmin": { aminoType: "wasm/MsgUpdateAdmin", toAmino: ({ sender, newAdmin, contract }: MsgUpdateAdmin): AminoMsgUpdateAdmin["value"] => ({ sender: sender, @@ -185,7 +183,7 @@ export const cosmWasmTypes: Record = { contract: contract, }), }, - "/cosmwasm.wasm.v1beta1.MsgClearAdmin": { + "/cosmwasm.wasm.v1.MsgClearAdmin": { aminoType: "wasm/MsgClearAdmin", toAmino: ({ sender, contract }: MsgClearAdmin): AminoMsgClearAdmin["value"] => ({ sender: sender, @@ -196,7 +194,7 @@ export const cosmWasmTypes: Record = { contract: contract, }), }, - "/cosmwasm.wasm.v1beta1.MsgExecuteContract": { + "/cosmwasm.wasm.v1.MsgExecuteContract": { aminoType: "wasm/MsgExecuteContract", toAmino: ({ sender, contract, msg, funds }: MsgExecuteContract): AminoMsgExecuteContract["value"] => ({ sender: sender, @@ -211,18 +209,13 @@ export const cosmWasmTypes: Record = { funds: [...funds], }), }, - "/cosmwasm.wasm.v1beta1.MsgMigrateContract": { + "/cosmwasm.wasm.v1.MsgMigrateContract": { aminoType: "wasm/MsgMigrateContract", - toAmino: ({ - sender, - contract, - codeId, - migrateMsg, - }: MsgMigrateContract): AminoMsgMigrateContract["value"] => ({ + toAmino: ({ sender, contract, codeId, msg }: MsgMigrateContract): AminoMsgMigrateContract["value"] => ({ sender: sender, contract: contract, code_id: codeId.toString(), - msg: JSON.parse(fromUtf8(migrateMsg)), + msg: JSON.parse(fromUtf8(msg)), }), fromAmino: ({ sender, @@ -233,7 +226,7 @@ export const cosmWasmTypes: Record = { sender: sender, contract: contract, codeId: Long.fromString(code_id), - migrateMsg: toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), }), }, }; diff --git a/packages/cosmwasm-stargate/src/builder.spec.ts b/packages/cosmwasm-stargate/src/builder.spec.ts deleted file mode 100644 index 20926f4c..00000000 --- a/packages/cosmwasm-stargate/src/builder.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { isValidBuilder } from "./builder"; - -describe("builder", () => { - describe("isValidBuilder", () => { - // Valid cases - - it("returns true for simple examples", () => { - expect(isValidBuilder("myorg/super-optimizer:0.1.2")).toEqual(true); - expect(isValidBuilder("myorg/super-optimizer:42")).toEqual(true); - }); - - it("supports images with multi level names", () => { - expect(isValidBuilder("myorg/department-x/office-y/technology-z/super-optimizer:0.1.2")).toEqual(true); - }); - - it("returns true for tags with lower and upper chars", () => { - expect(isValidBuilder("myorg/super-optimizer:0.1.2-alpha")).toEqual(true); - expect(isValidBuilder("myorg/super-optimizer:0.1.2-Alpha")).toEqual(true); - }); - - // Invalid cases - - it("returns false for missing or empty tag", () => { - expect(isValidBuilder("myorg/super-optimizer")).toEqual(false); - expect(isValidBuilder("myorg/super-optimizer:")).toEqual(false); - }); - - it("returns false for name components starting or ending with a separator", () => { - expect(isValidBuilder(".myorg/super-optimizer:42")).toEqual(false); - expect(isValidBuilder("-myorg/super-optimizer:42")).toEqual(false); - expect(isValidBuilder("_myorg/super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg./super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg-/super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg_/super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg/.super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg/-super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg/_super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg/super-optimizer.:42")).toEqual(false); - expect(isValidBuilder("myorg/super-optimizer-:42")).toEqual(false); - expect(isValidBuilder("myorg/super-optimizer_:42")).toEqual(false); - }); - - it("returns false for upper case character in name component", () => { - expect(isValidBuilder("mYorg/super-optimizer:42")).toEqual(false); - expect(isValidBuilder("myorg/super-Optimizer:42")).toEqual(false); - }); - - it("returns false for long images", () => { - expect( - isValidBuilder( - "myorgisnicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenicenice/super-optimizer:42", - ), - ).toEqual(false); - }); - - it("returns false for images with no organization", () => { - // Those are valid dockerhub images from https://hub.docker.com/_/ubuntu and https://hub.docker.com/_/rust - // but not valid in the context of CosmWasm Verify - expect(isValidBuilder("ubuntu:xenial-20200212")).toEqual(false); - expect(isValidBuilder("rust:1.40.0")).toEqual(false); - }); - }); -}); diff --git a/packages/cosmwasm-stargate/src/builder.ts b/packages/cosmwasm-stargate/src/builder.ts deleted file mode 100644 index 31a790c7..00000000 --- a/packages/cosmwasm-stargate/src/builder.ts +++ /dev/null @@ -1,20 +0,0 @@ -// A docker image regexp. We remove support for non-standard registries for simplicity. -// https://docs.docker.com/engine/reference/commandline/tag/#extended-description -// -// An image name is made up of slash-separated name components (optionally prefixed by a registry hostname). -// Name components may contain lowercase characters, digits and separators. -// A separator is defined as a period, one or two underscores, or one or more dashes. A name component may not start or end with a separator. -// -// A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. -// A tag name may not start with a period or a dash and may contain a maximum of 128 characters. -const dockerImagePattern = new RegExp( - "^[a-z0-9][a-z0-9._-]*[a-z0-9](/[a-z0-9][a-z0-9._-]*[a-z0-9])+:[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,127}$", -); - -/** Max length in bytes/characters (regexp enforces all ASCII, even if that is not required by the standard) */ -const builderMaxLength = 128; - -export function isValidBuilder(builder: string): boolean { - if (builder.length > builderMaxLength) return false; - return !!builder.match(dockerImagePattern); -} diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts index e325382c..a208e47d 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts @@ -229,8 +229,6 @@ describe("CosmWasmClient", () => { const [first] = result; expect(first).toEqual({ id: deployedHackatom.codeId, - source: deployedHackatom.source, - builder: deployedHackatom.builder, checksum: deployedHackatom.checksum, creator: alice.address0, }); @@ -245,8 +243,6 @@ describe("CosmWasmClient", () => { const expectedInfo: Code = { id: deployedHackatom.codeId, - source: deployedHackatom.source, - builder: deployedHackatom.builder, checksum: deployedHackatom.checksum, creator: alice.address0, }; diff --git a/packages/cosmwasm-stargate/src/cosmwasmclient.ts b/packages/cosmwasm-stargate/src/cosmwasmclient.ts index 3a65bcfa..1c5c252e 100644 --- a/packages/cosmwasm-stargate/src/cosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/cosmwasmclient.ts @@ -23,8 +23,8 @@ import { } from "@cosmjs/stargate"; import { Tendermint34Client, toRfc3339WithNanoseconds } from "@cosmjs/tendermint-rpc"; import { assert, sleep } from "@cosmjs/utils"; -import { CodeInfoResponse } from "cosmjs-types/cosmwasm/wasm/v1beta1/query"; -import { ContractCodeHistoryOperationType } from "cosmjs-types/cosmwasm/wasm/v1beta1/types"; +import { CodeInfoResponse } from "cosmjs-types/cosmwasm/wasm/v1/query"; +import { ContractCodeHistoryOperationType } from "cosmjs-types/cosmwasm/wasm/v1/types"; import { JsonObject, setupWasmExtension, WasmExtension } from "./queries"; @@ -39,19 +39,9 @@ export interface Code { readonly creator: string; /** Hex-encoded sha256 hash of the code stored here */ readonly checksum: string; - /** - * An URL to a .tar.gz archive of the source code of the contract, which can be used to reproducibly build the Wasm bytecode. - * - * @see https://github.com/CosmWasm/cosmwasm-verify - */ - readonly source?: string; - /** - * A docker image (including version) to reproducibly build the Wasm bytecode from the source code. - * - * @example ```cosmwasm/rust-optimizer:0.8.0``` - * @see https://github.com/CosmWasm/cosmwasm-verify - */ - readonly builder?: string; + + // `source` and `builder` were removed in wasmd 0.18 + // https://github.com/CosmWasm/wasmd/issues/540 } export interface CodeDetails extends Code { @@ -317,8 +307,6 @@ export class CosmWasmClient { id: entry.codeId.toNumber(), creator: entry.creator, checksum: toHex(entry.dataHash), - source: entry.source || undefined, - builder: entry.builder || undefined, }; }); } @@ -336,8 +324,6 @@ export class CosmWasmClient { id: codeInfo.codeId.toNumber(), creator: codeInfo.creator, checksum: toHex(codeInfo.dataHash), - source: codeInfo.source || undefined, - builder: codeInfo.builder || undefined, data: data, }; this.codesCache.set(codeId, codeDetails); diff --git a/packages/cosmwasm-stargate/src/encodeobjects.ts b/packages/cosmwasm-stargate/src/encodeobjects.ts index b20787cd..4f613568 100644 --- a/packages/cosmwasm-stargate/src/encodeobjects.ts +++ b/packages/cosmwasm-stargate/src/encodeobjects.ts @@ -6,21 +6,21 @@ import { MsgMigrateContract, MsgStoreCode, MsgUpdateAdmin, -} from "cosmjs-types/cosmwasm/wasm/v1beta1/tx"; +} from "cosmjs-types/cosmwasm/wasm/v1/tx"; export interface MsgStoreCodeEncodeObject extends EncodeObject { - readonly typeUrl: "/cosmwasm.wasm.v1beta1.MsgStoreCode"; + readonly typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode"; readonly value: Partial; } export function isMsgStoreCodeEncodeObject( encodeObject: EncodeObject, ): encodeObject is MsgStoreCodeEncodeObject { - return (encodeObject as MsgStoreCodeEncodeObject).typeUrl === "/cosmwasm.wasm.v1beta1.MsgStoreCode"; + return (encodeObject as MsgStoreCodeEncodeObject).typeUrl === "/cosmwasm.wasm.v1.MsgStoreCode"; } export interface MsgInstantiateContractEncodeObject extends EncodeObject { - readonly typeUrl: "/cosmwasm.wasm.v1beta1.MsgInstantiateContract"; + readonly typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract"; readonly value: Partial; } @@ -29,54 +29,50 @@ export function isMsgInstantiateContractEncodeObject( ): encodeObject is MsgInstantiateContractEncodeObject { return ( (encodeObject as MsgInstantiateContractEncodeObject).typeUrl === - "/cosmwasm.wasm.v1beta1.MsgInstantiateContract" + "/cosmwasm.wasm.v1.MsgInstantiateContract" ); } export interface MsgUpdateAdminEncodeObject extends EncodeObject { - readonly typeUrl: "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin"; + readonly typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin"; readonly value: Partial; } export function isMsgUpdateAdminEncodeObject( encodeObject: EncodeObject, ): encodeObject is MsgUpdateAdminEncodeObject { - return (encodeObject as MsgUpdateAdminEncodeObject).typeUrl === "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin"; + return (encodeObject as MsgUpdateAdminEncodeObject).typeUrl === "/cosmwasm.wasm.v1.MsgUpdateAdmin"; } export interface MsgClearAdminEncodeObject extends EncodeObject { - readonly typeUrl: "/cosmwasm.wasm.v1beta1.MsgClearAdmin"; + readonly typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin"; readonly value: Partial; } export function isMsgClearAdminEncodeObject( encodeObject: EncodeObject, ): encodeObject is MsgClearAdminEncodeObject { - return (encodeObject as MsgClearAdminEncodeObject).typeUrl === "/cosmwasm.wasm.v1beta1.MsgClearAdmin"; + return (encodeObject as MsgClearAdminEncodeObject).typeUrl === "/cosmwasm.wasm.v1.MsgClearAdmin"; } export interface MsgMigrateContractEncodeObject extends EncodeObject { - readonly typeUrl: "/cosmwasm.wasm.v1beta1.MsgMigrateContract"; + readonly typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract"; readonly value: Partial; } export function isMsgMigrateEncodeObject( encodeObject: EncodeObject, ): encodeObject is MsgMigrateContractEncodeObject { - return ( - (encodeObject as MsgMigrateContractEncodeObject).typeUrl === "/cosmwasm.wasm.v1beta1.MsgMigrateContract" - ); + return (encodeObject as MsgMigrateContractEncodeObject).typeUrl === "/cosmwasm.wasm.v1.MsgMigrateContract"; } export interface MsgExecuteContractEncodeObject extends EncodeObject { - readonly typeUrl: "/cosmwasm.wasm.v1beta1.MsgExecuteContract"; + readonly typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract"; readonly value: Partial; } export function isMsgExecuteEncodeObject( encodeObject: EncodeObject, ): encodeObject is MsgExecuteContractEncodeObject { - return ( - (encodeObject as MsgExecuteContractEncodeObject).typeUrl === "/cosmwasm.wasm.v1beta1.MsgExecuteContract" - ); + return (encodeObject as MsgExecuteContractEncodeObject).typeUrl === "/cosmwasm.wasm.v1.MsgExecuteContract"; } diff --git a/packages/cosmwasm-stargate/src/index.ts b/packages/cosmwasm-stargate/src/index.ts index c02bdae8..cdf132d2 100644 --- a/packages/cosmwasm-stargate/src/index.ts +++ b/packages/cosmwasm-stargate/src/index.ts @@ -1,5 +1,4 @@ export { cosmWasmTypes } from "./aminotypes"; -export { isValidBuilder } from "./builder"; export { Code, CodeDetails, @@ -30,6 +29,5 @@ export { MigrateResult, SigningCosmWasmClient, SigningCosmWasmClientOptions, - UploadMeta, UploadResult, } from "./signingcosmwasmclient"; diff --git a/packages/cosmwasm-stargate/src/queries/wasm.spec.ts b/packages/cosmwasm-stargate/src/queries/wasm.spec.ts index 9a7a215b..731a07dd 100644 --- a/packages/cosmwasm-stargate/src/queries/wasm.spec.ts +++ b/packages/cosmwasm-stargate/src/queries/wasm.spec.ts @@ -13,12 +13,8 @@ import { StdFee, } from "@cosmjs/stargate"; import { assert } from "@cosmjs/utils"; -import { - MsgExecuteContract, - MsgInstantiateContract, - MsgStoreCode, -} from "cosmjs-types/cosmwasm/wasm/v1beta1/tx"; -import { ContractCodeHistoryOperationType } from "cosmjs-types/cosmwasm/wasm/v1beta1/types"; +import { MsgExecuteContract, MsgInstantiateContract, MsgStoreCode } from "cosmjs-types/cosmwasm/wasm/v1/tx"; +import { ContractCodeHistoryOperationType } from "cosmjs-types/cosmwasm/wasm/v1/types"; import Long from "long"; import { @@ -41,9 +37,9 @@ import { } from "../testutils.spec"; const registry = new Registry([ - ["/cosmwasm.wasm.v1beta1.MsgExecuteContract", MsgExecuteContract], - ["/cosmwasm.wasm.v1beta1.MsgStoreCode", MsgStoreCode], - ["/cosmwasm.wasm.v1beta1.MsgInstantiateContract", MsgInstantiateContract], + ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], + ["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], + ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], ]); async function uploadContract( @@ -52,12 +48,10 @@ async function uploadContract( ): Promise { const memo = "My first contract on chain"; const theMsg: MsgStoreCodeEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgStoreCode", + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.fromPartial({ sender: alice.address0, wasmByteCode: contract.data, - source: contract.source || "", - builder: contract.builder || "", }), }; const fee: StdFee = { @@ -80,12 +74,12 @@ async function instantiateContract( ): Promise { const memo = "Create an escrow instance"; const theMsg: MsgInstantiateContractEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgInstantiateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.fromPartial({ sender: alice.address0, codeId: Long.fromNumber(codeId), label: "my escrow", - initMsg: toAscii( + msg: toAscii( JSON.stringify({ verifier: alice.address0, beneficiary: beneficiaryAddress, @@ -114,7 +108,7 @@ async function executeContract( ): Promise { const memo = "Time for action"; const theMsg: MsgExecuteContractEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgExecuteContract", + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: alice.address0, contract: contractAddress, @@ -171,8 +165,6 @@ describe("WasmExtension", () => { const lastCode = codeInfos[codeInfos.length - 1]; expect(lastCode.codeId.toNumber()).toEqual(hackatomCodeId); expect(lastCode.creator).toEqual(alice.address0); - expect(lastCode.source).toEqual(hackatom.source ?? ""); - expect(lastCode.builder).toEqual(hackatom.builder ?? ""); expect(toHex(lastCode.dataHash)).toEqual(toHex(sha256(hackatom.data))); }); }); @@ -183,11 +175,10 @@ describe("WasmExtension", () => { assert(hackatomCodeId); const client = await makeWasmClient(wasmd.endpoint); const { codeInfo, data } = await client.wasm.getCode(hackatomCodeId); - expect(codeInfo!.codeId.toNumber()).toEqual(hackatomCodeId); - expect(codeInfo!.creator).toEqual(alice.address0); - expect(codeInfo!.source).toEqual(hackatom.source ?? ""); - expect(codeInfo!.builder).toEqual(hackatom.builder ?? ""); - expect(toHex(codeInfo!.dataHash)).toEqual(toHex(sha256(hackatom.data))); + assert(codeInfo); + expect(codeInfo.codeId.toNumber()).toEqual(hackatomCodeId); + expect(codeInfo.creator).toEqual(alice.address0); + expect(toHex(codeInfo.dataHash)).toEqual(toHex(sha256(hackatom.data))); expect(data).toEqual(hackatom.data); }); }); diff --git a/packages/cosmwasm-stargate/src/queries/wasm.ts b/packages/cosmwasm-stargate/src/queries/wasm.ts index 0f13060d..a9f21f80 100644 --- a/packages/cosmwasm-stargate/src/queries/wasm.ts +++ b/packages/cosmwasm-stargate/src/queries/wasm.ts @@ -10,7 +10,7 @@ import { QueryContractInfoResponse, QueryContractsByCodeResponse, QueryRawContractStateResponse, -} from "cosmjs-types/cosmwasm/wasm/v1beta1/query"; +} from "cosmjs-types/cosmwasm/wasm/v1/query"; import Long from "long"; /** diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts index 37eba666..36c83460 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts @@ -17,13 +17,13 @@ import { DeepPartial, MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin"; import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx"; import { AuthInfo, TxBody, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx"; -import { MsgStoreCode } from "cosmjs-types/cosmwasm/wasm/v1beta1/tx"; +import { MsgStoreCode } from "cosmjs-types/cosmwasm/wasm/v1/tx"; import Long from "long"; import pako from "pako"; import protobuf from "protobufjs/minimal"; import { MsgStoreCodeEncodeObject } from "./encodeobjects"; -import { SigningCosmWasmClient, UploadMeta } from "./signingcosmwasmclient"; +import { SigningCosmWasmClient } from "./signingcosmwasmclient"; import { alice, defaultClearAdminFee, @@ -86,22 +86,6 @@ describe("SigningCosmWasmClient", () => { expect(codeId).toBeGreaterThanOrEqual(1); client.disconnect(); }); - - it("can set builder and source", async () => { - pendingWithoutWasmd(); - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); - const options = { prefix: wasmd.prefix }; - const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options); - const hackatom = getHackatom(); - const meta: UploadMeta = { - source: "https://crates.io/api/v1/crates/cw-nameservice/0.1.0/download", - builder: "confio/cosmwasm-opt:0.6.2", - }; - const { codeId } = await client.upload(alice.address0, hackatom.data, defaultUploadFee, meta); - const codeDetails = await client.getCodeDetails(codeId); - expect(codeDetails.source).toEqual(meta.source); - expect(codeDetails.builder).toEqual(meta.builder); - }); }); describe("instantiate", () => { @@ -571,17 +555,15 @@ describe("SigningCosmWasmClient", () => { ...defaultSigningClientOptions, prefix: wasmd.prefix, }); - const { data, builder, source } = getHackatom(); + const { data } = getHackatom(); const msgStoreCode: MsgStoreCode = { sender: alice.address0, wasmByteCode: pako.gzip(data), - source: source ?? "", - builder: builder ?? "", instantiatePermission: undefined, }; const msgAny: MsgStoreCodeEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgStoreCode", + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: msgStoreCode, }; const fee = { diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index 2139296d..1d93cc90 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -41,12 +41,11 @@ import { MsgMigrateContract, MsgStoreCode, MsgUpdateAdmin, -} from "cosmjs-types/cosmwasm/wasm/v1beta1/tx"; +} from "cosmjs-types/cosmwasm/wasm/v1/tx"; import Long from "long"; import pako from "pako"; import { cosmWasmTypes } from "./aminotypes"; -import { isValidBuilder } from "./builder"; import { CosmWasmClient } from "./cosmwasmclient"; import { MsgClearAdminEncodeObject, @@ -57,31 +56,6 @@ import { MsgUpdateAdminEncodeObject, } from "./encodeobjects"; -function prepareBuilder(builder: string | undefined): string | undefined { - if (!builder) { - return undefined; - } else { - if (!isValidBuilder(builder)) throw new Error("The builder (Docker Hub image with tag) is not valid"); - return builder; - } -} - -export interface UploadMeta { - /** - * An URL to a .tar.gz archive of the source code of the contract, which can be used to reproducibly build the Wasm bytecode. - * - * @see https://github.com/CosmWasm/cosmwasm-verify - */ - readonly source?: string; - /** - * A docker image (including version) to reproducibly build the Wasm bytecode from the source code. - * - * @example ```cosmwasm/rust-optimizer:0.8.0``` - * @see https://github.com/CosmWasm/cosmwasm-verify - */ - readonly builder?: string; -} - export interface UploadResult { /** Size of the original wasm code in bytes */ readonly originalSize: number; @@ -155,12 +129,12 @@ function createBroadcastTxErrorMessage(result: BroadcastTxFailure): string { function createDefaultRegistry(): Registry { return new Registry([ ...defaultRegistryTypes, - ["/cosmwasm.wasm.v1beta1.MsgClearAdmin", MsgClearAdmin], - ["/cosmwasm.wasm.v1beta1.MsgExecuteContract", MsgExecuteContract], - ["/cosmwasm.wasm.v1beta1.MsgMigrateContract", MsgMigrateContract], - ["/cosmwasm.wasm.v1beta1.MsgStoreCode", MsgStoreCode], - ["/cosmwasm.wasm.v1beta1.MsgInstantiateContract", MsgInstantiateContract], - ["/cosmwasm.wasm.v1beta1.MsgUpdateAdmin", MsgUpdateAdmin], + ["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin], + ["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract], + ["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract], + ["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode], + ["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract], + ["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin], ]); } @@ -227,19 +201,14 @@ export class SigningCosmWasmClient extends CosmWasmClient { senderAddress: string, wasmCode: Uint8Array, fee: StdFee, - meta: UploadMeta = {}, memo = "", ): Promise { - const source = meta.source || ""; - const builder = prepareBuilder(meta.builder); const compressed = pako.gzip(wasmCode, { level: 9 }); const storeCodeMsg: MsgStoreCodeEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgStoreCode", + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.fromPartial({ sender: senderAddress, wasmByteCode: compressed, - source: source, - builder: builder, }), }; @@ -269,12 +238,12 @@ export class SigningCosmWasmClient extends CosmWasmClient { options: InstantiateOptions = {}, ): Promise { const instantiateContractMsg: MsgInstantiateContractEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgInstantiateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.fromPartial({ sender: senderAddress, codeId: Long.fromString(new Uint53(codeId).toString()), label: label, - initMsg: toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: [...(options.funds || [])], admin: options.admin, }), @@ -300,7 +269,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { memo = "", ): Promise { const updateAdminMsg: MsgUpdateAdminEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin", + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: MsgUpdateAdmin.fromPartial({ sender: senderAddress, contract: contractAddress, @@ -324,7 +293,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { memo = "", ): Promise { const clearAdminMsg: MsgClearAdminEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgClearAdmin", + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: MsgClearAdmin.fromPartial({ sender: senderAddress, contract: contractAddress, @@ -349,12 +318,12 @@ export class SigningCosmWasmClient extends CosmWasmClient { memo = "", ): Promise { const migrateContractMsg: MsgMigrateContractEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgMigrateContract", + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: MsgMigrateContract.fromPartial({ sender: senderAddress, contract: contractAddress, codeId: Long.fromString(new Uint53(codeId).toString()), - migrateMsg: toUtf8(JSON.stringify(migrateMsg)), + msg: toUtf8(JSON.stringify(migrateMsg)), }), }; const result = await this.signAndBroadcast(senderAddress, [migrateContractMsg], fee, memo); @@ -376,7 +345,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { funds?: readonly Coin[], ): Promise { const executeContractMsg: MsgExecuteContractEncodeObject = { - typeUrl: "/cosmwasm.wasm.v1beta1.MsgExecuteContract", + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial({ sender: senderAddress, contract: contractAddress, diff --git a/packages/cosmwasm-stargate/src/testutils.spec.ts b/packages/cosmwasm-stargate/src/testutils.spec.ts index 32f5d7b0..3288578d 100644 --- a/packages/cosmwasm-stargate/src/testutils.spec.ts +++ b/packages/cosmwasm-stargate/src/testutils.spec.ts @@ -39,8 +39,6 @@ export const defaultClearAdminFee = calculateFee(80_000, defaultGasPrice); export interface ContractUploadInstructions { /** The wasm bytecode */ readonly data: Uint8Array; - readonly source?: string; - readonly builder?: string; } export const wasmd = { @@ -62,8 +60,6 @@ export const defaultSigningClientOptions: SigningCosmWasmClientOptions = { export function getHackatom(): ContractUploadInstructions { return { data: fromBase64(hackatom.data), - source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download", - builder: "cosmwasm/rust-optimizer:0.9.1", }; } @@ -122,8 +118,6 @@ export const validator = { /** Deployed as part of scripts/wasmd/init.sh */ export const deployedHackatom = { codeId: 1, - source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download", - builder: "cosmwasm/rust-optimizer:0.10.8", checksum: "a32acdcfe15a2b3c8ba6963cf1e4ab63347725cc35a0f2434696dd492d63fb5f", instances: [ { @@ -153,8 +147,6 @@ export const deployedIbcReflect = { /** Deployed as part of scripts/wasmd/init.sh */ export const deployedCw3 = { codeId: 3, - source: "https://crates.io/api/v1/crates/cw3-fixed-multisig/0.3.1/download", - builder: "cosmwasm/rust-optimizer:0.10.4", instances: [ "wasm1xqeym28j9xgv0p93pwwt6qcxf9tdvf9z83duy9", // Multisig (1/3) "wasm1jka38ckju8cpjap00jf9xdvdyttz9cauchu0zl", // Multisig (2/3) @@ -165,8 +157,6 @@ export const deployedCw3 = { /** Deployed as part of scripts/wasmd/init.sh */ export const deployedCw1 = { codeId: 4, - source: "https://crates.io/api/v1/crates/cw1-subkeys/0.3.1/download", - builder: "cosmwasm/rust-optimizer:0.10.4", instances: ["wasm1vs2vuks65rq7xj78mwtvn7vvnm2gn7ad78g6yp"], }; diff --git a/scripts/wasmd/deploy_cw1.js b/scripts/wasmd/deploy_cw1.js index 707999fb..39656937 100755 --- a/scripts/wasmd/deploy_cw1.js +++ b/scripts/wasmd/deploy_cw1.js @@ -16,11 +16,6 @@ const alice = { // address4: "wasm1f7j7ryulwjfe9ljplvhtcaxa6wqgula3nh873j", }; -const codeMeta = { - source: "https://crates.io/api/v1/crates/cw1-subkeys/0.3.1/download", - builder: "cosmwasm/rust-optimizer:0.10.4", -}; - async function main() { const gasPrice = GasPrice.fromString("0.025ucosm"); const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: "wasm" }); @@ -32,7 +27,6 @@ async function main() { alice.address0, wasm, uploadFee, - codeMeta, "Upload CW1 subkeys contract", ); console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`); diff --git a/scripts/wasmd/deploy_cw3.js b/scripts/wasmd/deploy_cw3.js index a388880c..9d7271ea 100755 --- a/scripts/wasmd/deploy_cw3.js +++ b/scripts/wasmd/deploy_cw3.js @@ -16,11 +16,6 @@ const alice = { address4: "wasm1f7j7ryulwjfe9ljplvhtcaxa6wqgula3nh873j", }; -const codeMeta = { - source: "https://crates.io/api/v1/crates/cw3-fixed-multisig/0.3.1/download", - builder: "cosmwasm/rust-optimizer:0.10.4", -}; - const initData = [ { admin: alice.address0, @@ -74,7 +69,6 @@ async function main() { alice.address0, wasm, uploadFee, - codeMeta, "Upload CW3 fixed multisig contract", ); console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`); diff --git a/scripts/wasmd/deploy_hackatom.js b/scripts/wasmd/deploy_hackatom.js index 629a5403..19ab6b7a 100755 --- a/scripts/wasmd/deploy_hackatom.js +++ b/scripts/wasmd/deploy_hackatom.js @@ -16,11 +16,6 @@ const alice = { address4: "wasm1f7j7ryulwjfe9ljplvhtcaxa6wqgula3nh873j", }; -const codeMeta = { - source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download", - builder: "cosmwasm/rust-optimizer:0.10.8", -}; - const inits = [ { label: "From deploy_hackatom.js (0)", @@ -59,7 +54,6 @@ async function main() { alice.address0, wasm, uploadFee, - codeMeta, "Upload hackatom contract", ); console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`); diff --git a/scripts/wasmd/deploy_ibc_reflect.js b/scripts/wasmd/deploy_ibc_reflect.js index 3adc18e7..f4b0876a 100755 --- a/scripts/wasmd/deploy_ibc_reflect.js +++ b/scripts/wasmd/deploy_ibc_reflect.js @@ -16,11 +16,6 @@ const alice = { address4: "wasm1f7j7ryulwjfe9ljplvhtcaxa6wqgula3nh873j", }; -const codeMeta = { - source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download", - builder: "cosmwasm/rust-optimizer:0.10.8", -}; - const inits = [ { label: "Instantiate IBC reflect", @@ -42,7 +37,6 @@ async function main() { alice.address0, wasm, uploadFee, - codeMeta, "Upload IBC reflect contract", ); console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`);