ts: disable versioned txs for now because wallets dont support them

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-10-06 11:25:09 +02:00
parent f2cc869795
commit 6808171ee3
1 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,7 @@
import { AnchorProvider } from '@project-serum/anchor';
import {
AddressLookupTableAccount,
Transaction,
TransactionInstruction,
} from '@solana/web3.js';
import { buildVersionedTx } from '../utils';
@ -15,12 +16,23 @@ export async function sendTransaction(
const latestBlockhash = await connection.getLatestBlockhash(
opts.preflightCommitment,
);
const tx = await buildVersionedTx(
provider,
ixs,
opts.additionalSigners,
alts,
);
let tx: Transaction = new Transaction();
const altsEnabled = false;
if (altsEnabled) {
tx = await buildVersionedTx(provider, ixs, opts.additionalSigners, alts);
} else {
const payer = (provider as AnchorProvider).wallet;
tx = new Transaction();
tx.recentBlockhash = latestBlockhash.blockhash;
tx.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;
tx.feePayer = payer.publicKey;
tx.add(...ixs);
if (opts.additionalSigners?.length > 0) {
tx.partialSign(...opts.additionalSigners);
}
await payer.signTransaction(tx);
}
const signature = await connection.sendRawTransaction(tx.serialize(), {
skipPreflight: true,