fix type error with version txs

This commit is contained in:
tjs 2022-11-18 14:22:12 -05:00
parent 8dcedfb501
commit 14e20f9668
1 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,6 @@ import {
AddressLookupTableAccount,
MessageV0,
Signer,
Transaction,
TransactionInstruction,
VersionedTransaction,
} from '@solana/web3.js';
@ -27,13 +26,15 @@ export async function sendTransaction(
recentBlockhash: latestBlockhash.blockhash,
addressLookupTableAccounts: alts,
});
const vtx = new VersionedTransaction(message);
let vtx = new VersionedTransaction(message);
if (opts?.additionalSigners?.length) {
vtx.sign([...opts?.additionalSigners]);
}
if (typeof payer.signTransaction === 'function') {
await payer.signTransaction(vtx as any);
vtx = (await payer.signTransaction(
vtx as any,
)) as unknown as VersionedTransaction;
} else {
vtx.sign([((provider as AnchorProvider).wallet as any).payer as Signer]);
}