mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
stargate: Fix uint64 -> string representation
This commit is contained in:
parent
12178b524f
commit
1fb4e42a79
@ -178,7 +178,7 @@ enum VoteOption {
|
||||
export interface AminoMsgVote extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgVote";
|
||||
readonly value: {
|
||||
readonly proposal_id: number;
|
||||
readonly proposal_id: string;
|
||||
/** Bech32 account address */
|
||||
readonly voter: string;
|
||||
readonly option: VoteOption;
|
||||
@ -193,7 +193,7 @@ export function isAminoMsgVote(msg: AminoMsg): msg is AminoMsgVote {
|
||||
export interface AminoMsgDeposit extends AminoMsg {
|
||||
readonly type: "cosmos-sdk/MsgDeposit";
|
||||
readonly value: {
|
||||
readonly proposal_id: number;
|
||||
readonly proposal_id: string;
|
||||
/** Bech32 account address */
|
||||
readonly depositor: string;
|
||||
readonly amount: readonly Coin[];
|
||||
@ -338,8 +338,8 @@ export function isAminoMsgUndelegate(msg: AminoMsg): msg is AminoMsgUndelegate {
|
||||
|
||||
// https://github.com/cosmos/ibc-go/blob/07b6a97b67d17fd214a83764cbdb2c2c3daef445/modules/core/02-client/types/client.pb.go#L297-L312
|
||||
interface AminoHeight {
|
||||
readonly revision_number: number;
|
||||
readonly revision_height: number;
|
||||
readonly revision_number: string;
|
||||
readonly revision_height: string;
|
||||
}
|
||||
|
||||
// https://github.com/cosmos/ibc-go/blob/07b6a97b67d17fd214a83764cbdb2c2c3daef445/modules/apps/transfer/types/tx.pb.go#L33-L53
|
||||
@ -357,7 +357,7 @@ export interface AminoMsgTransfer extends AminoMsg {
|
||||
readonly timeout_height?: AminoHeight;
|
||||
// Timeout timestamp (in nanoseconds) relative to the current block timestamp.
|
||||
// The timeout is disabled when set to 0.
|
||||
readonly timeout_timestamp: number;
|
||||
readonly timeout_timestamp: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -326,10 +326,10 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
timeoutHeight: {
|
||||
revisionHeight: Long.fromNumber(123, true),
|
||||
revisionNumber: Long.fromNumber(456, true),
|
||||
revisionHeight: Long.fromString("123", true),
|
||||
revisionNumber: Long.fromString("456", true),
|
||||
},
|
||||
timeoutTimestamp: Long.fromNumber(789, true),
|
||||
timeoutTimestamp: Long.fromString("789", true),
|
||||
};
|
||||
const aminoMsg = new AminoTypes().toAmino({
|
||||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
|
||||
@ -344,10 +344,10 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
timeout_height: {
|
||||
revision_height: 123,
|
||||
revision_number: 456,
|
||||
revision_height: "123",
|
||||
revision_number: "456",
|
||||
},
|
||||
timeout_timestamp: 789,
|
||||
timeout_timestamp: "789",
|
||||
},
|
||||
};
|
||||
expect(aminoMsg).toEqual(expected);
|
||||
@ -636,10 +636,10 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
timeout_height: {
|
||||
revision_height: 123,
|
||||
revision_number: 456,
|
||||
revision_height: "123",
|
||||
revision_number: "456",
|
||||
},
|
||||
timeout_timestamp: 789,
|
||||
timeout_timestamp: "789",
|
||||
},
|
||||
};
|
||||
const msg = new AminoTypes().fromAmino(aminoMsg);
|
||||
@ -650,10 +650,10 @@ describe("AminoTypes", () => {
|
||||
sender: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
|
||||
receiver: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
|
||||
timeoutHeight: {
|
||||
revisionHeight: Long.fromNumber(123, true),
|
||||
revisionNumber: Long.fromNumber(456, true),
|
||||
revisionHeight: Long.fromString("123", true),
|
||||
revisionNumber: Long.fromString("456", true),
|
||||
},
|
||||
timeoutTimestamp: Long.fromNumber(789, true),
|
||||
timeoutTimestamp: Long.fromString("789", true),
|
||||
};
|
||||
expect(msg).toEqual({
|
||||
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
|
||||
|
@ -345,11 +345,11 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
receiver: receiver,
|
||||
timeout_height: timeoutHeight
|
||||
? {
|
||||
revision_height: timeoutHeight.revisionHeight.toNumber(),
|
||||
revision_number: timeoutHeight.revisionNumber.toNumber(),
|
||||
revision_height: timeoutHeight.revisionHeight.toString(),
|
||||
revision_number: timeoutHeight.revisionNumber.toString(),
|
||||
}
|
||||
: undefined,
|
||||
timeout_timestamp: timeoutTimestamp.toNumber(),
|
||||
timeout_timestamp: timeoutTimestamp.toString(),
|
||||
}),
|
||||
fromAmino: ({
|
||||
source_port,
|
||||
@ -367,11 +367,11 @@ function createDefaultTypes(prefix: string): Record<string, AminoConverter> {
|
||||
receiver: receiver,
|
||||
timeoutHeight: timeout_height
|
||||
? {
|
||||
revisionHeight: Long.fromNumber(timeout_height.revision_height, true),
|
||||
revisionNumber: Long.fromNumber(timeout_height.revision_number, true),
|
||||
revisionHeight: Long.fromString(timeout_height.revision_height, true),
|
||||
revisionNumber: Long.fromString(timeout_height.revision_number, true),
|
||||
}
|
||||
: undefined,
|
||||
timeoutTimestamp: Long.fromNumber(timeout_timestamp, true),
|
||||
timeoutTimestamp: Long.fromString(timeout_timestamp, true),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user