diff --git a/packages/cli/examples/delegate.ts b/packages/cli/examples/delegate.ts index 88a4a47e..f518989c 100644 --- a/packages/cli/examples/delegate.ts +++ b/packages/cli/examples/delegate.ts @@ -24,7 +24,7 @@ const memo = "Use your power wisely"; const chainId = await client.getChainId(); console.log("Connected to chain:", chainId); -const { accountNumber, sequence } = await client.getNonce(senderAddress); +const { accountNumber, sequence } = await client.getSequence(senderAddress); console.log("Account/sequence:", accountNumber, sequence); const signBytes = makeSignBytes([msg], fee, chainId, memo, accountNumber, sequence); diff --git a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts index dc131f78..8fc6fcf0 100644 --- a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts @@ -100,7 +100,7 @@ describe("CosmWasmClient.searchTx", () => { amount: coins(2000, "ucosm"), gas: "80000", // 80k }; - const { accountNumber, sequence } = await client.getNonce(); + const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await wallet.sign(alice.address0, signBytes); diff --git a/packages/cosmwasm/src/cosmwasmclient.spec.ts b/packages/cosmwasm/src/cosmwasmclient.spec.ts index f41a1b40..5f4121d6 100644 --- a/packages/cosmwasm/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.spec.ts @@ -105,11 +105,11 @@ describe("CosmWasmClient", () => { }); }); - describe("getNonce", () => { + describe("getSequence", () => { it("works", async () => { pendingWithoutWasmd(); const client = new CosmWasmClient(wasmd.endpoint); - expect(await client.getNonce(unused.address)).toEqual({ + expect(await client.getSequence(unused.address)).toEqual({ accountNumber: unused.accountNumber, sequence: unused.sequence, }); @@ -119,7 +119,7 @@ describe("CosmWasmClient", () => { pendingWithoutWasmd(); const client = new CosmWasmClient(wasmd.endpoint); const missing = makeRandomAddress(); - await client.getNonce(missing).then( + await client.getSequence(missing).then( () => fail("this must not succeed"), (error) => expect(error).toMatch(/account does not exist on chain/i), ); @@ -233,7 +233,7 @@ describe("CosmWasmClient", () => { }; const chainId = await client.getChainId(); - const { accountNumber, sequence } = await client.getNonce(alice.address0); + const { accountNumber, sequence } = await client.getSequence(alice.address0); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await wallet.sign(alice.address0, signBytes); const signedTx = { diff --git a/packages/cosmwasm/src/cosmwasmclient.ts b/packages/cosmwasm/src/cosmwasmclient.ts index 66bd2286..74a7b738 100644 --- a/packages/cosmwasm/src/cosmwasmclient.ts +++ b/packages/cosmwasm/src/cosmwasmclient.ts @@ -231,7 +231,7 @@ export class CosmWasmClient { * * @param address returns data for this address. When unset, the client's sender adddress is used. */ - public async getNonce(address: string): Promise { + public async getSequence(address: string): Promise { const account = await this.getAccount(address); if (!account) { throw new Error( diff --git a/packages/cosmwasm/src/signingcosmwasmclient.ts b/packages/cosmwasm/src/signingcosmwasmclient.ts index 35c0caea..59c18f75 100644 --- a/packages/cosmwasm/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm/src/signingcosmwasmclient.ts @@ -196,8 +196,8 @@ export class SigningCosmWasmClient extends CosmWasmClient { this.fees = { ...defaultFees, ...(customFees || {}) }; } - public async getNonce(address?: string): Promise { - return super.getNonce(address || this.senderAddress); + public async getSequence(address?: string): Promise { + return super.getSequence(address || this.senderAddress); } public async getAccount(address?: string): Promise { @@ -220,7 +220,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }, }; const fee = this.fees.upload; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([storeCodeMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); @@ -266,7 +266,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }; const memo = options.memo || ""; const fee = this.fees.init; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([instantiateMsg], fee, chainId, memo, accountNumber, sequence); @@ -300,7 +300,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }, }; const fee = this.fees.changeAdmin; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([updateAdminMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); @@ -330,7 +330,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }, }; const fee = this.fees.changeAdmin; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([clearAdminMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); @@ -367,7 +367,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }, }; const fee = this.fees.migrate; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([msg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); @@ -404,7 +404,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }, }; const fee = this.fees.exec; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([executeMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); @@ -439,7 +439,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { }, }; const fee = this.fees.send; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); diff --git a/packages/cosmwasm/types/cosmwasmclient.d.ts b/packages/cosmwasm/types/cosmwasmclient.d.ts index c72cdc17..6d7ed3c9 100644 --- a/packages/cosmwasm/types/cosmwasmclient.d.ts +++ b/packages/cosmwasm/types/cosmwasmclient.d.ts @@ -154,7 +154,7 @@ export declare class CosmWasmClient { * * @param address returns data for this address. When unset, the client's sender adddress is used. */ - getNonce(address: string): Promise; + getSequence(address: string): Promise; getAccount(address: string): Promise; /** * Gets block header and meta diff --git a/packages/cosmwasm/types/signingcosmwasmclient.d.ts b/packages/cosmwasm/types/signingcosmwasmclient.d.ts index 18949878..48e41358 100644 --- a/packages/cosmwasm/types/signingcosmwasmclient.d.ts +++ b/packages/cosmwasm/types/signingcosmwasmclient.d.ts @@ -104,7 +104,7 @@ export declare class SigningCosmWasmClient extends CosmWasmClient { customFees?: Partial, broadcastMode?: BroadcastMode, ); - getNonce(address?: string): Promise; + getSequence(address?: string): Promise; getAccount(address?: string): Promise; /** Uploads code and returns a receipt, including the code ID */ upload(wasmCode: Uint8Array, meta?: UploadMeta, memo?: string): Promise; diff --git a/packages/sdk38/src/cosmosclient.searchtx.spec.ts b/packages/sdk38/src/cosmosclient.searchtx.spec.ts index 82247d28..342db6e7 100644 --- a/packages/sdk38/src/cosmosclient.searchtx.spec.ts +++ b/packages/sdk38/src/cosmosclient.searchtx.spec.ts @@ -53,7 +53,7 @@ describe("CosmosClient.searchTx", () => { amount: coins(2000, "ucosm"), gas: "80000", // 80k }; - const { accountNumber, sequence } = await client.getNonce(); + const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await wallet.sign(walletAddress, signBytes); diff --git a/packages/sdk38/src/cosmosclient.spec.ts b/packages/sdk38/src/cosmosclient.spec.ts index 198b39fe..30e5d14c 100644 --- a/packages/sdk38/src/cosmosclient.spec.ts +++ b/packages/sdk38/src/cosmosclient.spec.ts @@ -94,11 +94,11 @@ describe("CosmosClient", () => { }); }); - describe("getNonce", () => { + describe("getSequence", () => { it("works", async () => { pendingWithoutWasmd(); const client = new CosmosClient(wasmd.endpoint); - expect(await client.getNonce(unused.address)).toEqual({ + expect(await client.getSequence(unused.address)).toEqual({ accountNumber: unused.accountNumber, sequence: unused.sequence, }); @@ -108,7 +108,7 @@ describe("CosmosClient", () => { pendingWithoutWasmd(); const client = new CosmosClient(wasmd.endpoint); const missing = makeRandomAddress(); - await client.getNonce(missing).then( + await client.getSequence(missing).then( () => fail("this must not succeed"), (error) => expect(error).toMatch(/account does not exist on chain/i), ); @@ -224,7 +224,7 @@ describe("CosmosClient", () => { }; const chainId = await client.getChainId(); - const { accountNumber, sequence } = await client.getNonce(faucet.address); + const { accountNumber, sequence } = await client.getSequence(faucet.address); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await wallet.sign(walletAddress, signBytes); const signedTx = { diff --git a/packages/sdk38/src/cosmosclient.ts b/packages/sdk38/src/cosmosclient.ts index 0d977502..16cc4b2d 100644 --- a/packages/sdk38/src/cosmosclient.ts +++ b/packages/sdk38/src/cosmosclient.ts @@ -196,7 +196,7 @@ export class CosmosClient { * * @param address returns data for this address. When unset, the client's sender adddress is used. */ - public async getNonce(address: string): Promise { + public async getSequence(address: string): Promise { const account = await this.getAccount(address); if (!account) { throw new Error( diff --git a/packages/sdk38/src/lcdapi/distribution.spec.ts b/packages/sdk38/src/lcdapi/distribution.spec.ts index cfb8b3cd..e57c386e 100644 --- a/packages/sdk38/src/lcdapi/distribution.spec.ts +++ b/packages/sdk38/src/lcdapi/distribution.spec.ts @@ -45,7 +45,7 @@ describe("DistributionExtension", () => { }, }; const memo = "Test delegation for wasmd"; - const { accountNumber, sequence } = await client.getNonce(); + const { accountNumber, sequence } = await client.getSequence(); const signBytes = makeSignBytes([msg], defaultFee, chainId, memo, accountNumber, sequence); const signature = await wallet.sign(faucet.address, signBytes); const tx = { diff --git a/packages/sdk38/src/lcdapi/gov.spec.ts b/packages/sdk38/src/lcdapi/gov.spec.ts index 18ec60b1..ad379c45 100644 --- a/packages/sdk38/src/lcdapi/gov.spec.ts +++ b/packages/sdk38/src/lcdapi/gov.spec.ts @@ -49,7 +49,7 @@ describe("GovExtension", () => { }, }; const proposalMemo = "Test proposal for wasmd"; - const { accountNumber: proposalAccountNumber, sequence: proposalSequence } = await client.getNonce(); + const { accountNumber: proposalAccountNumber, sequence: proposalSequence } = await client.getSequence(); const proposalSignBytes = makeSignBytes( [proposalMsg], defaultFee, @@ -81,7 +81,7 @@ describe("GovExtension", () => { }, }; const voteMemo = "Test vote for wasmd"; - const { accountNumber: voteAccountNumber, sequence: voteSequence } = await client.getNonce(); + const { accountNumber: voteAccountNumber, sequence: voteSequence } = await client.getSequence(); const voteSignBytes = makeSignBytes( [voteMsg], defaultFee, diff --git a/packages/sdk38/src/lcdapi/lcdclient.spec.ts b/packages/sdk38/src/lcdapi/lcdclient.spec.ts index 04fa2d41..2bc4f263 100644 --- a/packages/sdk38/src/lcdapi/lcdclient.spec.ts +++ b/packages/sdk38/src/lcdapi/lcdclient.spec.ts @@ -261,7 +261,7 @@ describe("LcdClient", () => { ], gas: "80000", // 80k }; - const { accountNumber, sequence } = await client.getNonce(); + const { accountNumber, sequence } = await client.getSequence(); const chainId = await client.getChainId(); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await wallet.sign(walletAddress, signBytes); diff --git a/packages/sdk38/src/signingcosmosclient.ts b/packages/sdk38/src/signingcosmosclient.ts index 50cc3496..00a8cfa8 100644 --- a/packages/sdk38/src/signingcosmosclient.ts +++ b/packages/sdk38/src/signingcosmosclient.ts @@ -66,8 +66,8 @@ export class SigningCosmosClient extends CosmosClient { this.fees = { ...defaultFees, ...(customFees || {}) }; } - public async getNonce(address?: string): Promise { - return super.getNonce(address || this.senderAddress); + public async getSequence(address?: string): Promise { + return super.getSequence(address || this.senderAddress); } public async getAccount(address?: string): Promise { @@ -88,7 +88,7 @@ export class SigningCosmosClient extends CosmosClient { }, }; const fee = this.fees.send; - const { accountNumber, sequence } = await this.getNonce(); + const { accountNumber, sequence } = await this.getSequence(); const chainId = await this.getChainId(); const signBytes = makeSignBytes([sendMsg], fee, chainId, memo, accountNumber, sequence); const signature = await this.signer.sign(this.senderAddress, signBytes); diff --git a/packages/sdk38/types/cosmosclient.d.ts b/packages/sdk38/types/cosmosclient.d.ts index 5ce6b60c..a8af386b 100644 --- a/packages/sdk38/types/cosmosclient.d.ts +++ b/packages/sdk38/types/cosmosclient.d.ts @@ -124,7 +124,7 @@ export declare class CosmosClient { * * @param address returns data for this address. When unset, the client's sender adddress is used. */ - getNonce(address: string): Promise; + getSequence(address: string): Promise; getAccount(address: string): Promise; /** * Gets block header and meta diff --git a/packages/sdk38/types/signingcosmosclient.d.ts b/packages/sdk38/types/signingcosmosclient.d.ts index 616b3e25..0faecda5 100644 --- a/packages/sdk38/types/signingcosmosclient.d.ts +++ b/packages/sdk38/types/signingcosmosclient.d.ts @@ -32,7 +32,7 @@ export declare class SigningCosmosClient extends CosmosClient { customFees?: Partial, broadcastMode?: BroadcastMode, ); - getNonce(address?: string): Promise; + getSequence(address?: string): Promise; getAccount(address?: string): Promise; sendTokens(recipientAddress: string, transferAmount: readonly Coin[], memo?: string): Promise; }