Add memo field to AminoMsgTransfer

This commit is contained in:
Shane Vitarana 2023-08-01 12:38:28 +01:00 committed by Simon Warta
parent 1f97ee650d
commit 1dbe0d1ad9
2 changed files with 7 additions and 1 deletions

View File

@ -40,6 +40,7 @@ describe("AminoTypes", () => {
revision_number: "456", revision_number: "456",
}, },
timeout_timestamp: "789", timeout_timestamp: "789",
memo: undefined,
}, },
}; };
expect(aminoMsg).toEqual(expected); expect(aminoMsg).toEqual(expected);
@ -77,6 +78,7 @@ describe("AminoTypes", () => {
revision_number: undefined, revision_number: undefined,
}, },
timeout_timestamp: undefined, timeout_timestamp: undefined,
memo: undefined,
}, },
}; };
expect(aminoMsg).toEqual(expected); expect(aminoMsg).toEqual(expected);
@ -107,6 +109,7 @@ describe("AminoTypes", () => {
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
timeout_height: {}, timeout_height: {},
timeout_timestamp: undefined, timeout_timestamp: undefined,
memo: undefined,
}, },
}; };
expect(aminoMsg).toEqual(expected); expect(aminoMsg).toEqual(expected);

View File

@ -13,7 +13,7 @@ interface AminoHeight {
readonly revision_height?: string; readonly revision_height?: string;
} }
// https://github.com/cosmos/ibc-go/blob/07b6a97b67d17fd214a83764cbdb2c2c3daef445/modules/apps/transfer/types/tx.pb.go#L33-L53 // https://github.com/cosmos/ibc-go/blob/a4ca39c59f770a0b6948947d5178d5f0914c3a17/modules/apps/transfer/types/tx.pb.go#L37-L56
/** Transfers fungible tokens (i.e Coins) between ICS20 enabled chains */ /** Transfers fungible tokens (i.e Coins) between ICS20 enabled chains */
export interface AminoMsgTransfer extends AminoMsg { export interface AminoMsgTransfer extends AminoMsg {
readonly type: "cosmos-sdk/MsgTransfer"; readonly type: "cosmos-sdk/MsgTransfer";
@ -38,6 +38,7 @@ export interface AminoMsgTransfer extends AminoMsg {
* 0 values must be omitted (https://github.com/cosmos/cosmos-sdk/blob/v0.42.7/x/ibc/applications/transfer/types/tx.pb.go#L52). * 0 values must be omitted (https://github.com/cosmos/cosmos-sdk/blob/v0.42.7/x/ibc/applications/transfer/types/tx.pb.go#L52).
*/ */
readonly timeout_timestamp?: string; readonly timeout_timestamp?: string;
readonly memo?: string;
}; };
} }
@ -73,6 +74,7 @@ export function createIbcAminoConverters(): AminoConverters {
receiver, receiver,
timeoutHeight, timeoutHeight,
timeoutTimestamp, timeoutTimestamp,
memo,
}: MsgTransfer): AminoMsgTransfer["value"] => ({ }: MsgTransfer): AminoMsgTransfer["value"] => ({
source_port: sourcePort, source_port: sourcePort,
source_channel: sourceChannel, source_channel: sourceChannel,
@ -86,6 +88,7 @@ export function createIbcAminoConverters(): AminoConverters {
} }
: {}, : {},
timeout_timestamp: omitDefault(timeoutTimestamp)?.toString(), timeout_timestamp: omitDefault(timeoutTimestamp)?.toString(),
memo: omitDefault(memo)?.toString(),
}), }),
fromAmino: ({ fromAmino: ({
source_port, source_port,