fix: enable maxRetries option to SendOptions (#22893)

* Web3.js - enable maxRetries option to SendOptions

* Prettier
This commit is contained in:
Hareesh Nagaraj 2022-02-03 13:54:43 -05:00 committed by GitHub
parent 660f6981c6
commit 28442aa922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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;
}

View File

@ -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(