Pull out uint64FromProto
This commit is contained in:
parent
dce43b3f87
commit
c2e0efd158
@ -39,6 +39,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@cosmjs/encoding": "^0.22.0",
|
||||
"@cosmjs/math": "^0.22.0",
|
||||
"@cosmjs/proto-signing": "^0.22.0",
|
||||
"@cosmjs/tendermint-rpc": "^0.22.0",
|
||||
"@cosmjs/utils": "^0.22.0"
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { Bech32 } from "@cosmjs/encoding";
|
||||
import { Uint64 } from "@cosmjs/math";
|
||||
import { BaseAccount, decodeAny } from "@cosmjs/proto-signing";
|
||||
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import Long from "long";
|
||||
|
||||
export interface GetSequenceResult {
|
||||
readonly accountNumber: number;
|
||||
readonly sequence: number;
|
||||
}
|
||||
|
||||
function uint64FromProto(input: number | Long): Uint64 {
|
||||
return Uint64.fromString(input.toString());
|
||||
}
|
||||
|
||||
export class StargateClient {
|
||||
private readonly tmClient: TendermintClient;
|
||||
|
||||
@ -43,8 +49,8 @@ export class StargateClient {
|
||||
assert(account_number !== undefined);
|
||||
assert(sequence !== undefined);
|
||||
return {
|
||||
accountNumber: typeof account_number === "number" ? account_number : account_number.toNumber(),
|
||||
sequence: typeof sequence === "number" ? sequence : sequence.toNumber(),
|
||||
accountNumber: uint64FromProto(account_number).toNumber(),
|
||||
sequence: uint64FromProto(sequence).toNumber(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user