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