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;
|
||||
/** preflight commitment level */
|
||||
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;
|
||||
/** preflight commitment level */
|
||||
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 =
|
||||
(options && options.preflightCommitment) || this.commitment;
|
||||
|
||||
if (options && options.maxRetries) {
|
||||
config.maxRetries = options.maxRetries;
|
||||
}
|
||||
if (skipPreflight) {
|
||||
config.skipPreflight = skipPreflight;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ export async function sendAndConfirmTransaction(
|
|||
const sendOptions = options && {
|
||||
skipPreflight: options.skipPreflight,
|
||||
preflightCommitment: options.preflightCommitment || options.commitment,
|
||||
maxRetries: options.maxRetries,
|
||||
};
|
||||
|
||||
const signature = await connection.sendTransaction(
|
||||
|
|
Loading…
Reference in New Issue