set lastValidBlockHeight for tx confirmation
This commit is contained in:
parent
3e462c5530
commit
fc63328af1
|
@ -8,9 +8,11 @@ export async function sendTransaction(
|
||||||
) {
|
) {
|
||||||
const connection = provider.connection;
|
const connection = provider.connection;
|
||||||
const payer = provider.wallet;
|
const payer = provider.wallet;
|
||||||
transaction.recentBlockhash = (
|
const latestBlockhash = await connection.getLatestBlockhash(
|
||||||
await connection.getLatestBlockhash(opts.preflightCommitment)
|
opts.preflightCommitment,
|
||||||
).blockhash;
|
);
|
||||||
|
transaction.recentBlockhash = latestBlockhash.blockhash;
|
||||||
|
transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;
|
||||||
transaction.feePayer = payer.publicKey;
|
transaction.feePayer = payer.publicKey;
|
||||||
if (opts.additionalSigners?.length > 0) {
|
if (opts.additionalSigners?.length > 0) {
|
||||||
transaction.partialSign(...opts.additionalSigners);
|
transaction.partialSign(...opts.additionalSigners);
|
||||||
|
|
Loading…
Reference in New Issue