fix: enable maxRetries option to SendOptions (#22893)
* Web3.js - enable maxRetries option to SendOptions * Prettier
This commit is contained in:
parent
660f6981c6
commit
28442aa922
|
@ -99,6 +99,8 @@ export type SendOptions = {
|
||||||
skipPreflight?: boolean;
|
skipPreflight?: boolean;
|
||||||
/** preflight commitment level */
|
/** preflight commitment level */
|
||||||
preflightCommitment?: Commitment;
|
preflightCommitment?: Commitment;
|
||||||
|
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
||||||
|
maxRetries?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,6 +113,8 @@ export type ConfirmOptions = {
|
||||||
commitment?: Commitment;
|
commitment?: Commitment;
|
||||||
/** preflight commitment level */
|
/** preflight commitment level */
|
||||||
preflightCommitment?: Commitment;
|
preflightCommitment?: Commitment;
|
||||||
|
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
||||||
|
maxRetries?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3931,6 +3935,9 @@ export class Connection {
|
||||||
const preflightCommitment =
|
const preflightCommitment =
|
||||||
(options && options.preflightCommitment) || this.commitment;
|
(options && options.preflightCommitment) || this.commitment;
|
||||||
|
|
||||||
|
if (options && options.maxRetries) {
|
||||||
|
config.maxRetries = options.maxRetries;
|
||||||
|
}
|
||||||
if (skipPreflight) {
|
if (skipPreflight) {
|
||||||
config.skipPreflight = skipPreflight;
|
config.skipPreflight = skipPreflight;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ export async function sendAndConfirmTransaction(
|
||||||
const sendOptions = options && {
|
const sendOptions = options && {
|
||||||
skipPreflight: options.skipPreflight,
|
skipPreflight: options.skipPreflight,
|
||||||
preflightCommitment: options.preflightCommitment || options.commitment,
|
preflightCommitment: options.preflightCommitment || options.commitment,
|
||||||
|
maxRetries: options.maxRetries,
|
||||||
};
|
};
|
||||||
|
|
||||||
const signature = await connection.sendTransaction(
|
const signature = await connection.sendTransaction(
|
||||||
|
|
Loading…
Reference in New Issue