diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index 626a1b6a4e..12430cc1f2 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -574,18 +574,20 @@ export class SigningCosmWasmClient extends CosmWasmClient { } /** - * Creates a transaction with the given messages, fee and memo. Then signs and broadcasts the transaction. + * Creates a transaction with the given messages, fee, memo and timeout height. Then signs and broadcasts the transaction. * * @param signerAddress The address that will sign transactions using this instance. The signer must be able to sign with this address. * @param messages * @param fee * @param memo + * @param timeoutHeight (optional) timeout height to prevent the tx from being committed past a certain height */ public async signAndBroadcast( signerAddress: string, messages: readonly EncodeObject[], fee: StdFee | "auto" | number, memo = "", + timeoutHeight?: bigint, ): Promise { let usedFee: StdFee; if (fee == "auto" || typeof fee === "number") { @@ -598,13 +600,13 @@ export class SigningCosmWasmClient extends CosmWasmClient { } else { usedFee = fee; } - const txRaw = await this.sign(signerAddress, messages, usedFee, memo); + const txRaw = await this.sign(signerAddress, messages, usedFee, memo, undefined, timeoutHeight); const txBytes = TxRaw.encode(txRaw).finish(); return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs); } /** - * Creates a transaction with the given messages, fee and memo. Then signs and broadcasts the transaction. + * Creates a transaction with the given messages, fee, memo and timeout height. Then signs and broadcasts the transaction. * * This method is useful if you want to send a transaction in broadcast, * without waiting for it to be placed inside a block, because for example @@ -614,6 +616,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { * @param messages * @param fee * @param memo + * @param timeoutHeight (optional) timeout height to prevent the tx from being committed past a certain height * * @returns Returns the hash of the transaction */ @@ -622,6 +625,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { messages: readonly EncodeObject[], fee: StdFee | "auto" | number, memo = "", + timeoutHeight?: bigint, ): Promise { let usedFee: StdFee; if (fee == "auto" || typeof fee === "number") { @@ -632,7 +636,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { } else { usedFee = fee; } - const txRaw = await this.sign(signerAddress, messages, usedFee, memo); + const txRaw = await this.sign(signerAddress, messages, usedFee, memo, undefined, timeoutHeight); const txBytes = TxRaw.encode(txRaw).finish(); return this.broadcastTxSync(txBytes); } diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index f2e94818a5..7d8d75e018 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -312,6 +312,7 @@ export class SigningStargateClient extends StargateClient { messages: readonly EncodeObject[], fee: StdFee | "auto" | number, memo = "", + timeoutHeight?: bigint, ): Promise { let usedFee: StdFee; if (fee == "auto" || typeof fee === "number") { @@ -324,7 +325,7 @@ export class SigningStargateClient extends StargateClient { } else { usedFee = fee; } - const txRaw = await this.sign(signerAddress, messages, usedFee, memo); + const txRaw = await this.sign(signerAddress, messages, usedFee, memo, undefined, timeoutHeight); const txBytes = TxRaw.encode(txRaw).finish(); return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs); } @@ -340,6 +341,7 @@ export class SigningStargateClient extends StargateClient { messages: readonly EncodeObject[], fee: StdFee | "auto" | number, memo = "", + timeoutHeight?: bigint, ): Promise { let usedFee: StdFee; if (fee == "auto" || typeof fee === "number") { @@ -350,7 +352,7 @@ export class SigningStargateClient extends StargateClient { } else { usedFee = fee; } - const txRaw = await this.sign(signerAddress, messages, usedFee, memo); + const txRaw = await this.sign(signerAddress, messages, usedFee, memo, undefined, timeoutHeight); const txBytes = TxRaw.encode(txRaw).finish(); return this.broadcastTxSync(txBytes); }