From 9d5aecefd5a410c0c3bd9940e2340cb321027942 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 25 Oct 2023 12:52:47 +0200 Subject: [PATCH 1/2] Add missing memo field to fromAmino implementation for MsgTransfer --- CHANGELOG.md | 7 ++++ .../src/modules/ibc/aminomessages.spec.ts | 38 +++++++++++++++++++ .../stargate/src/modules/ibc/aminomessages.ts | 2 + 3 files changed, 47 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e632cda..e174a45d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to ## [Unreleased] +### Fixed + +- @cosmjs/stargate: Add missing memo field to `fromAmino` implementation for + `MsgTransfer`. ([#1493]) + +[#1493]: https://github.com/cosmos/cosmjs/issues/1493 + ## [0.31.2] - 2023-10-24 ### Fixed diff --git a/packages/stargate/src/modules/ibc/aminomessages.spec.ts b/packages/stargate/src/modules/ibc/aminomessages.spec.ts index 420690cd..0334fc6e 100644 --- a/packages/stargate/src/modules/ibc/aminomessages.spec.ts +++ b/packages/stargate/src/modules/ibc/aminomessages.spec.ts @@ -153,6 +153,43 @@ describe("AminoTypes", () => { }); }); + it("works for MsgTransfer with memo", () => { + const aminoMsg: AminoMsgTransfer = { + type: "cosmos-sdk/MsgTransfer", + value: { + source_port: "testport", + source_channel: "testchannel", + token: coin(1234, "utest"), + sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", + receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", + timeout_height: { + revision_height: "123", + revision_number: "456", + }, + timeout_timestamp: "789", + memo: "Hack me", + }, + }; + const msg = new AminoTypes(createIbcAminoConverters()).fromAmino(aminoMsg); + const expectedValue: MsgTransfer = { + sourcePort: "testport", + sourceChannel: "testchannel", + token: coin(1234, "utest"), + sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", + receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", + timeoutHeight: { + revisionHeight: Long.fromString("123", true), + revisionNumber: Long.fromString("456", true), + }, + timeoutTimestamp: Long.fromString("789", true), + memo: "Hack me", + }; + expect(msg).toEqual({ + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: expectedValue, + }); + }); + it("works for MsgTransfer with default values", () => { const aminoMsg: AminoMsgTransfer = { type: "cosmos-sdk/MsgTransfer", @@ -167,6 +204,7 @@ describe("AminoTypes", () => { // revision_number omitted }, // timeout_timestamp omitted + // memo omitted }, }; const msg = new AminoTypes(createIbcAminoConverters()).fromAmino(aminoMsg); diff --git a/packages/stargate/src/modules/ibc/aminomessages.ts b/packages/stargate/src/modules/ibc/aminomessages.ts index 4073c521..5719bbef 100644 --- a/packages/stargate/src/modules/ibc/aminomessages.ts +++ b/packages/stargate/src/modules/ibc/aminomessages.ts @@ -98,6 +98,7 @@ export function createIbcAminoConverters(): AminoConverters { receiver, timeout_height, timeout_timestamp, + memo, }: AminoMsgTransfer["value"]): MsgTransfer => MsgTransfer.fromPartial({ sourcePort: source_port, @@ -112,6 +113,7 @@ export function createIbcAminoConverters(): AminoConverters { } : undefined, timeoutTimestamp: Long.fromString(timeout_timestamp || "0", true), + memo: memo ?? "", }), }, }; From bb0ef98637d8718b94a974f572e446dd400e425b Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 25 Oct 2023 12:55:02 +0200 Subject: [PATCH 2/2] Set version 0.31.3 --- CHANGELOG.md | 5 ++++- packages/amino/package.json | 2 +- packages/cli/package.json | 2 +- packages/cosmwasm-stargate/package.json | 2 +- packages/crypto/package.json | 2 +- packages/encoding/package.json | 2 +- packages/faucet-client/package.json | 2 +- packages/faucet/package.json | 2 +- packages/json-rpc/package.json | 2 +- packages/ledger-amino/package.json | 2 +- packages/math/package.json | 2 +- packages/proto-signing/package.json | 2 +- packages/socket/package.json | 2 +- packages/stargate/package.json | 2 +- packages/stream/package.json | 2 +- packages/tendermint-rpc/package.json | 2 +- packages/utils/package.json | 2 +- 17 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e174a45d..d5b4d66f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to ## [Unreleased] +## [0.31.3] - 2023-10-25 + ### Fixed - @cosmjs/stargate: Add missing memo field to `fromAmino` implementation for @@ -1311,7 +1313,8 @@ CHANGELOG entries missing. Please see [the diff][0.24.1]. `FeeTable`. @cosmjs/cosmwasm has its own `FeeTable` with those properties. - @cosmjs/sdk38: Rename package to @cosmjs/launchpad. -[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.31.2...HEAD +[unreleased]: https://github.com/cosmos/cosmjs/compare/v0.31.3...HEAD +[0.31.3]: https://github.com/cosmos/cosmjs/compare/v0.31.2...v0.31.3 [0.31.2]: https://github.com/cosmos/cosmjs/compare/v0.31.1...v0.31.2 [0.31.1]: https://github.com/cosmos/cosmjs/compare/v0.31.0...v0.31.1 [0.31.0]: https://github.com/cosmos/cosmjs/compare/v0.30.1...v0.31.0 diff --git a/packages/amino/package.json b/packages/amino/package.json index 175ac366..b82edf79 100644 --- a/packages/amino/package.json +++ b/packages/amino/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/amino", - "version": "0.31.2", + "version": "0.31.3", "description": "Helpers for Amino based signing.", "contributors": [ "Simon Warta " diff --git a/packages/cli/package.json b/packages/cli/package.json index ba534c54..d3c5f053 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/cli", - "version": "0.31.2", + "version": "0.31.3", "description": "Command line interface", "contributors": [ "IOV SAS ", diff --git a/packages/cosmwasm-stargate/package.json b/packages/cosmwasm-stargate/package.json index 97127715..925c9965 100644 --- a/packages/cosmwasm-stargate/package.json +++ b/packages/cosmwasm-stargate/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/cosmwasm-stargate", - "version": "0.31.2", + "version": "0.31.3", "description": "CosmWasm SDK", "contributors": [ "Will Clark " diff --git a/packages/crypto/package.json b/packages/crypto/package.json index 32320e5d..3be693be 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/crypto", - "version": "0.31.2", + "version": "0.31.3", "description": "Cryptography resources for blockchain projects", "contributors": [ "IOV SAS ", diff --git a/packages/encoding/package.json b/packages/encoding/package.json index a641b3c6..681000bd 100644 --- a/packages/encoding/package.json +++ b/packages/encoding/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/encoding", - "version": "0.31.2", + "version": "0.31.3", "description": "Encoding helpers for blockchain projects", "contributors": [ "IOV SAS " diff --git a/packages/faucet-client/package.json b/packages/faucet-client/package.json index ce0fb40d..77801e48 100644 --- a/packages/faucet-client/package.json +++ b/packages/faucet-client/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/faucet-client", - "version": "0.31.2", + "version": "0.31.3", "description": "The faucet client", "contributors": [ "Will Clark " diff --git a/packages/faucet/package.json b/packages/faucet/package.json index 852cedde..5900b96b 100644 --- a/packages/faucet/package.json +++ b/packages/faucet/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/faucet", - "version": "0.31.2", + "version": "0.31.3", "description": "The faucet", "contributors": [ "Ethan Frey ", diff --git a/packages/json-rpc/package.json b/packages/json-rpc/package.json index b7644aa8..2cbb8135 100644 --- a/packages/json-rpc/package.json +++ b/packages/json-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/json-rpc", - "version": "0.31.2", + "version": "0.31.3", "description": "Framework for implementing a JSON-RPC 2.0 API", "contributors": [ "IOV SAS ", diff --git a/packages/ledger-amino/package.json b/packages/ledger-amino/package.json index b44acab4..74fb7ac5 100644 --- a/packages/ledger-amino/package.json +++ b/packages/ledger-amino/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/ledger-amino", - "version": "0.31.2", + "version": "0.31.3", "description": "A library for signing Amino-encoded transactions using Ledger devices", "contributors": [ "Will Clark " diff --git a/packages/math/package.json b/packages/math/package.json index 203c6d1b..e9bab109 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/math", - "version": "0.31.2", + "version": "0.31.3", "description": "Math helpers for blockchain projects", "contributors": [ "IOV SAS " diff --git a/packages/proto-signing/package.json b/packages/proto-signing/package.json index 442ef8ae..6ef12600 100644 --- a/packages/proto-signing/package.json +++ b/packages/proto-signing/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/proto-signing", - "version": "0.31.2", + "version": "0.31.3", "description": "Utilities for protobuf based signing (Cosmos SDK 0.40+)", "contributors": [ "Will Clark ", diff --git a/packages/socket/package.json b/packages/socket/package.json index 2038947a..10519cba 100644 --- a/packages/socket/package.json +++ b/packages/socket/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/socket", - "version": "0.31.2", + "version": "0.31.3", "description": "Utility functions for working with WebSockets", "contributors": [ "IOV SAS ", diff --git a/packages/stargate/package.json b/packages/stargate/package.json index 97af37de..4e028b54 100644 --- a/packages/stargate/package.json +++ b/packages/stargate/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/stargate", - "version": "0.31.2", + "version": "0.31.3", "description": "Utilities for Cosmos SDK 0.40", "contributors": [ "Simon Warta " diff --git a/packages/stream/package.json b/packages/stream/package.json index 0105a815..56cd791e 100644 --- a/packages/stream/package.json +++ b/packages/stream/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/stream", - "version": "0.31.2", + "version": "0.31.3", "description": "Utility functions for producing and consuming streams", "contributors": [ "IOV SAS ", diff --git a/packages/tendermint-rpc/package.json b/packages/tendermint-rpc/package.json index 2c214c3d..a4195c39 100644 --- a/packages/tendermint-rpc/package.json +++ b/packages/tendermint-rpc/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/tendermint-rpc", - "version": "0.31.2", + "version": "0.31.3", "description": "Tendermint RPC clients", "contributors": [ "IOV SAS ", diff --git a/packages/utils/package.json b/packages/utils/package.json index e9524027..e3c7a8d0 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@cosmjs/utils", - "version": "0.31.2", + "version": "0.31.3", "description": "Utility tools, primarily for testing code", "contributors": [ "IOV SAS "