diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index 0340b54e..dbfcccb1 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -139,7 +139,7 @@ export class SigningStargateClient extends StargateClient { throw new Error("Failed to retrieve account from signer"); } const pubkey = encodeSecp256k1Pubkey(accountFromSigner.pubkey); - const accountFromChain = await this.getAccount(signerAddress); + const accountFromChain = await this.getAccountUnverified(signerAddress); if (!accountFromChain) { throw new Error("Account not found"); } diff --git a/packages/stargate/src/stargateclient.ts b/packages/stargate/src/stargateclient.ts index 7eebf2c6..bc26a5a7 100644 --- a/packages/stargate/src/stargateclient.ts +++ b/packages/stargate/src/stargateclient.ts @@ -149,11 +149,19 @@ export class StargateClient { return status.syncInfo.latestBlockHeight; } + // this is nice to display data to the user, but is slower public async getAccount(searchAddress: string): Promise { const account = await this.queryClient.auth.account(searchAddress); return account ? accountFromProto(account) : null; } + // if we just need to get the sequence for signing a transaction, let's make this faster + // (no need to wait a block before submitting) + public async getAccountUnverified(searchAddress: string): Promise { + const account = await this.queryClient.auth.unverified.account(searchAddress); + return account ? accountFromProto(account) : null; + } + public async getSequence(address: string): Promise { const account = await this.getAccount(address); if (account) {