Merge pull request #797 from cosmos/794-broadcasttx-options
Allow signing clients to customize broadcast timing
This commit is contained in:
commit
2b8a9041bc
@ -8,6 +8,8 @@ and this project adheres to
|
||||
|
||||
### Added
|
||||
|
||||
- @cosmjs/cosmwasm-stargate: Add `broadcastTimeoutMs` and
|
||||
`broadcastPollIntervalMs` options added to `SigningCosmWasmClientOptions`.
|
||||
- @cosmjs/proto-signing: Add `serialize` and `serializeWithEncryptionKey`
|
||||
methods to `DirectSecp256k1HdWallet`. Also add `deserialize` and
|
||||
`deserializeWithEncryptionKey` static methods.
|
||||
@ -15,6 +17,8 @@ and this project adheres to
|
||||
helper functions and `KdfConfiguration` type.
|
||||
- @cosmjs/proto-signing: Export `makeCosmoshubPath` helper.
|
||||
- @cosmjs/stargate: Export `makeCosmoshubPath` helper.
|
||||
- @cosmjs/stargate: Add `broadcastTimeoutMs` and `broadcastPollIntervalMs`
|
||||
options added to `SigningStargateClientOptions`.
|
||||
|
||||
## [0.25.1] - 2021-05-06
|
||||
|
||||
|
||||
@ -136,11 +136,15 @@ export interface SigningCosmWasmClientOptions {
|
||||
readonly prefix?: string;
|
||||
readonly gasPrice?: GasPrice;
|
||||
readonly gasLimits?: Partial<GasLimits<CosmWasmFeeTable>>;
|
||||
readonly broadcastTimeoutMs?: number;
|
||||
readonly broadcastPollIntervalMs?: number;
|
||||
}
|
||||
|
||||
export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
public readonly fees: CosmWasmFeeTable;
|
||||
public readonly registry: Registry;
|
||||
public readonly broadcastTimeoutMs: number | undefined;
|
||||
public readonly broadcastPollIntervalMs: number | undefined;
|
||||
|
||||
private readonly signer: OfflineSigner;
|
||||
private readonly aminoTypes: AminoTypes;
|
||||
@ -186,6 +190,8 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
this.registry = registry;
|
||||
this.aminoTypes = aminoTypes;
|
||||
this.signer = signer;
|
||||
this.broadcastTimeoutMs = options.broadcastTimeoutMs;
|
||||
this.broadcastPollIntervalMs = options.broadcastPollIntervalMs;
|
||||
}
|
||||
|
||||
/** Uploads code and returns a receipt, including the code ID */
|
||||
@ -430,7 +436,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
|
||||
): Promise<BroadcastTxResponse> {
|
||||
const txRaw = await this.sign(signerAddress, messages, fee, memo);
|
||||
const txBytes = TxRaw.encode(txRaw).finish();
|
||||
return this.broadcastTx(txBytes);
|
||||
return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs);
|
||||
}
|
||||
|
||||
public async sign(
|
||||
|
||||
@ -151,11 +151,15 @@ export interface SigningStargateClientOptions {
|
||||
readonly prefix?: string;
|
||||
readonly gasPrice?: GasPrice;
|
||||
readonly gasLimits?: Partial<GasLimits<CosmosFeeTable>>;
|
||||
readonly broadcastTimeoutMs?: number;
|
||||
readonly broadcastPollIntervalMs?: number;
|
||||
}
|
||||
|
||||
export class SigningStargateClient extends StargateClient {
|
||||
public readonly fees: CosmosFeeTable;
|
||||
public readonly registry: Registry;
|
||||
public readonly broadcastTimeoutMs: number | undefined;
|
||||
public readonly broadcastPollIntervalMs: number | undefined;
|
||||
|
||||
private readonly signer: OfflineSigner;
|
||||
private readonly aminoTypes: AminoTypes;
|
||||
@ -201,6 +205,8 @@ export class SigningStargateClient extends StargateClient {
|
||||
this.registry = registry;
|
||||
this.aminoTypes = aminoTypes;
|
||||
this.signer = signer;
|
||||
this.broadcastTimeoutMs = options.broadcastTimeoutMs;
|
||||
this.broadcastPollIntervalMs = options.broadcastPollIntervalMs;
|
||||
}
|
||||
|
||||
public async sendTokens(
|
||||
@ -306,7 +312,7 @@ export class SigningStargateClient extends StargateClient {
|
||||
): Promise<BroadcastTxResponse> {
|
||||
const txRaw = await this.sign(signerAddress, messages, fee, memo);
|
||||
const txBytes = TxRaw.encode(txRaw).finish();
|
||||
return this.broadcastTx(txBytes);
|
||||
return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user