0

I am using "@solana/web3.js": "^1.90.0". While sending versioned transactions I am getting "Invalid Arguments". I have a retry logic in place that retries failed transactions with the same arguments until the transaction lands on chain. After multiple retries it lands with the same arguments same transaction instructions. I am not sure what I am doing wrong. I have recently switched from using normal Transactions to Versioned Transactions. Is there something I have to add while converting?

Below is the code snippet of how I am converting my normal Transaction to VersionedTransaction

// tx is a signed Transaction object
latestBlockHash =  await connection.getLatestBlockhash('finalized'); // Fetches the latest blockhash
tx.recentBlockhash = latestBlockHash.blockhash;
tx.lastValidBlockHeight = latestBlockHash.lastValidBlockHeight;
               
// Coverting tx to a signed VersionedTransaction object
const compiledTxMessage1 = tx.compileMessage();
const txMessage1 = new MessageV0(compiledTxMessage1);
tx = new VersionedTransaction(txMessage1);
tx.sign(signers);

1 Answer 1

1

Try to remove lastValidBlockHeight. VersionedTransaction only needs recentBlockhash.

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.