1

I'm trying to specify skipPreflight in sendTransaction method the next way:

await connection.sendTransaction(transaction, {
        skipPreflight: true,
});

where transaction is VersionedTransaction. According to @solana/web3.js docs, in versioned transaction case this function takes only 2 args, where the first is VersionedTransaction and the second are options.

However, looking at a method realization code, in case of versioned transaction sendTransaction method passes to sendRawTransaction "options" argument, which is the third and because is not defined (I passed only 2 args according to docs), rather than passing the second "signersOrOptions", which I specified to contain options.

So how to pass options to sendTransaction method in VersionedTransaction case?

1
  • I believe this is a bug, please file a PR making the change to properly pass signersOrOptions instead of options on that line.
    – Jon C
    Commented Dec 2, 2022 at 18:25

1 Answer 1

1

You can instead call sendRawTransaction directly.

await connection.sendRawTransaction(transaction.serialize(),
        { skipPreflight: true }
)

Of course, the fundamental solution to getting sendTransaction to work is to fix the bug (and send the PR fix) as mentioned in the comments section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.