1

I'm currently using the solana/web3.js and raydium-sdk library to perform swap with tokens. Everything seems to be working fine, however, I after sending my transaction with the sendTransaction function:

  async sendVersionedTransaction(tx: VersionedTransaction) {
    const txid = await this.connection.sendTransaction(tx, {
      skipPreflight: true,
    });

    return txid;
  }

I often have a transaction with no data like this: https://solscan.io/tx/5tRonjzQzaxB67Hr4ZpYEQbiK9Uzfcjir66cC4tbACoeU6yBoenb1wDHdDepU5GpQ6cBKCHkJUrCCiHRxUG1D7aq

I can't tell when or why it is happening since it can be random at times. Anybody knows why ?

2 Answers 2

2

The transaction you sent was dropped, likely because it did not have enough priority fees to be included in the block.

To add priority fees to your transaction, you can follow the priority fee guide which showcases the compute budget instructions:

const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
  units: 300,
});

const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
  microLamports: 20000,
});

const transaction = new Transaction()
  .add(modifyComputeUnits)
  .add(addPriorityFee)
  .add(
    SystemProgram.transfer({
      fromPubkey: payer.publicKey,
      toPubkey: toAccount,
      lamports: 10000000,
    }),
  );

Note: You may need to add more compute units depending on your transaction. It is recommended to figure out how many you need to avoid overpaying for your transaction.

1
0

Any luck with this? Im having the same issue....some of my transactions, specifically when I am swapping back to SOL get dropped. Is there a way to find out why it was dropped?

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.