Skip to content

Commit

Permalink
feat: add minContextSlot config to sendTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher committed Jun 28, 2022
1 parent 34a3b57 commit fba5eeb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web3.js/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ export type SendOptions = {
preflightCommitment?: Commitment;
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
maxRetries?: number;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number;
};

/**
Expand All @@ -242,6 +244,8 @@ export type ConfirmOptions = {
preflightCommitment?: Commitment;
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
maxRetries?: number;
/** The minimum slot that the request can be evaluated at */
minContextSlot?: number;
};

/**
Expand Down Expand Up @@ -4428,6 +4432,9 @@ export class Connection {
if (options && options.maxRetries) {
config.maxRetries = options.maxRetries;
}
if (options && options.minContextSlot != null) {
config.minContextSlot = options.minContextSlot;
}
if (skipPreflight) {
config.skipPreflight = skipPreflight;
}
Expand Down
1 change: 1 addition & 0 deletions web3.js/src/util/send-and-confirm-raw-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export async function sendAndConfirmRawTransaction(
const sendOptions = options && {
skipPreflight: options.skipPreflight,
preflightCommitment: options.preflightCommitment || options.commitment,
minContextSlot: options.minContextSlot,
};

const signature = await connection.sendRawTransaction(
Expand Down
1 change: 1 addition & 0 deletions web3.js/src/util/send-and-confirm-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export async function sendAndConfirmTransaction(
skipPreflight: options.skipPreflight,
preflightCommitment: options.preflightCommitment || options.commitment,
maxRetries: options.maxRetries,
minContextSlot: options.minContextSlot,
};

const signature = await connection.sendTransaction(
Expand Down

0 comments on commit fba5eeb

Please sign in to comment.