fix: default preflight commitment to confirmation commitment
This commit is contained in:
parent
c2f77a3473
commit
bde1e3d004
|
@ -2933,15 +2933,10 @@ export class Connection {
|
||||||
const skipPreflight = options && options.skipPreflight;
|
const skipPreflight = options && options.skipPreflight;
|
||||||
const preflightCommitment = options && options.preflightCommitment;
|
const preflightCommitment = options && options.preflightCommitment;
|
||||||
|
|
||||||
if (skipPreflight && preflightCommitment) {
|
|
||||||
throw new Error(
|
|
||||||
'cannot set preflightCommitment when skipPreflight is enabled',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skipPreflight) {
|
if (skipPreflight) {
|
||||||
config.skipPreflight = skipPreflight;
|
config.skipPreflight = skipPreflight;
|
||||||
} else if (preflightCommitment) {
|
}
|
||||||
|
if (preflightCommitment) {
|
||||||
config.preflightCommitment = preflightCommitment;
|
config.preflightCommitment = preflightCommitment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,14 @@ export async function sendAndConfirmRawTransaction(
|
||||||
rawTransaction: Buffer,
|
rawTransaction: Buffer,
|
||||||
options?: ConfirmOptions,
|
options?: ConfirmOptions,
|
||||||
): Promise<TransactionSignature> {
|
): Promise<TransactionSignature> {
|
||||||
|
const sendOptions = options && {
|
||||||
|
skipPreflight: options.skipPreflight,
|
||||||
|
preflightCommitment: options.preflightCommitment || options.commitment,
|
||||||
|
};
|
||||||
|
|
||||||
const signature = await connection.sendRawTransaction(
|
const signature = await connection.sendRawTransaction(
|
||||||
rawTransaction,
|
rawTransaction,
|
||||||
options,
|
sendOptions,
|
||||||
);
|
);
|
||||||
|
|
||||||
const status = (
|
const status = (
|
||||||
|
|
|
@ -23,10 +23,15 @@ export async function sendAndConfirmTransaction(
|
||||||
signers: Array<Account>,
|
signers: Array<Account>,
|
||||||
options?: ConfirmOptions,
|
options?: ConfirmOptions,
|
||||||
): Promise<TransactionSignature> {
|
): Promise<TransactionSignature> {
|
||||||
|
const sendOptions = options && {
|
||||||
|
skipPreflight: options.skipPreflight,
|
||||||
|
preflightCommitment: options.preflightCommitment || options.commitment,
|
||||||
|
};
|
||||||
|
|
||||||
const signature = await connection.sendTransaction(
|
const signature = await connection.sendTransaction(
|
||||||
transaction,
|
transaction,
|
||||||
signers,
|
signers,
|
||||||
options,
|
sendOptions,
|
||||||
);
|
);
|
||||||
|
|
||||||
const status = (
|
const status = (
|
||||||
|
|
Loading…
Reference in New Issue