Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade CosmWasm to wasmd 0.18 #863

Merged
merged 4 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .pnp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .yarn/cache/cosmjs-types-npm-0.1.0-309209b1b4-ca08e65750.zip

This file was deleted.

3 changes: 3 additions & 0 deletions .yarn/cache/cosmjs-types-npm-0.2.0-a3cb5ee5af-2c3215a9a2.zip
Git LFS file not shown
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ and this project adheres to
where there is no previous block.
- @cosmjs/proto-signing: `makeAuthInfoBytes` now takes an array of pubkey
sequence pairs in order to support different sequences for different signers.
- @cosmjs/cosmwasm-stargate: Upgraded client to support wasmd 0.18 backends.
Other backends are not supported anymore. Update proto types from
`cosmwasm.wasm.v1beta1.*` to `cosmwasm.wasm.v1.*`. `MsgStoreCode.source` and
`MsgStoreCode.builder` were removed; `MsgInstantiateContract.initMsg` and
`MsgMigrateContract.migrateMsg` were renamed to `msg`; `Code.{source,builder}`
and `CodeDetails.{source,builder}` were removed; `isValidBuilder` was removed;
`UploadMeta` and the `meta` from `SigningCosmWasmClient.upload` were removed.
([#863])

[#863]: https://github.com/cosmos/cosmjs/pull/863

### Removed

Expand Down
5 changes: 0 additions & 5 deletions packages/cli/examples/cosmwasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"axios": "^0.21.1",
"babylon": "^6.18.0",
"colors": "^1.3.3",
"cosmjs-types": "^0.1.0",
"cosmjs-types": "^0.2.0",
"diff": "^4",
"recast": "^0.20",
"ts-node": "^8",
Expand Down
1 change: 1 addition & 0 deletions packages/cosmwasm-stargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ An SDK to build CosmWasm clients.

| CosmWasm | x/wasm | @cosmjs/cosmwasm-stargate |
| -------- | --------- | ------------------------- |
| 0.16 | 0.18 | `^0.26.0` |
| 0.14 | 0.16 | `^0.25.0` |
| 0.13 | 0.14-0.15 | `^0.24.0` |

Expand Down
2 changes: 1 addition & 1 deletion packages/cosmwasm-stargate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@cosmjs/stargate": "workspace:packages/stargate",
"@cosmjs/tendermint-rpc": "workspace:packages/tendermint-rpc",
"@cosmjs/utils": "workspace:packages/utils",
"cosmjs-types": "^0.1.0",
"cosmjs-types": "^0.2.0",
"long": "^4.0.0",
"pako": "^2.0.2",
"protobufjs": "~6.10.2"
Expand Down
46 changes: 19 additions & 27 deletions packages/cosmwasm-stargate/src/aminotypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,21 +27,17 @@ 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 = {
type: "wasm/MsgStoreCode",
value: {
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
wasm_byte_code: "WUVMTE9XIFNVQk1BUklORQ==",
source: "Arrabiata",
builder: "Bob",
},
};
expect(aminoMsg).toEqual(expected);
Expand All @@ -52,7 +48,7 @@ describe("AminoTypes", () => {
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
codeId: Long.fromString("12345"),
label: "sticky",
initMsg: toUtf8(
msg: toUtf8(
JSON.stringify({
foo: "bar",
}),
Expand All @@ -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",
webmaster128 marked this conversation as resolved.
Show resolved Hide resolved
value: msg,
});
const expected: AminoMsgInstantiateContract = {
Expand All @@ -70,7 +66,7 @@ describe("AminoTypes", () => {
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
code_id: "12345",
label: "sticky",
init_msg: {
msg: {
foo: "bar",
},
funds: coins(1234, "ucosm"),
Expand All @@ -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 = {
Expand All @@ -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 = {
Expand All @@ -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 = {
Expand All @@ -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 = {
Expand All @@ -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,
});
});
Expand All @@ -211,7 +203,7 @@ describe("AminoTypes", () => {
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
code_id: "12345",
label: "sticky",
init_msg: {
msg: {
foo: "bar",
},
funds: coins(1234, "ucosm"),
Expand All @@ -223,7 +215,7 @@ describe("AminoTypes", () => {
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
codeId: Long.fromString("12345"),
label: "sticky",
initMsg: toUtf8(
msg: toUtf8(
JSON.stringify({
foo: "bar",
}),
Expand All @@ -232,7 +224,7 @@ describe("AminoTypes", () => {
admin: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
};
expect(msg).toEqual({
typeUrl: "/cosmwasm.wasm.v1beta1.MsgInstantiateContract",
typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract",
value: expectedValue,
});
});
Expand All @@ -253,7 +245,7 @@ describe("AminoTypes", () => {
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
};
expect(msg).toEqual({
typeUrl: "/cosmwasm.wasm.v1beta1.MsgUpdateAdmin",
typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin",
value: expectedValue,
});
});
Expand All @@ -272,7 +264,7 @@ describe("AminoTypes", () => {
contract: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
};
expect(msg).toEqual({
typeUrl: "/cosmwasm.wasm.v1beta1.MsgClearAdmin",
typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin",
value: expectedValue,
});
});
Expand Down Expand Up @@ -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,
});
});
Expand All @@ -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,
});
});
Expand Down
Loading