Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Is there an issue with the Raydium API? #16

Open
BCIGRA opened this issue Apr 4, 2024 · 7 comments
Open

Is there an issue with the Raydium API? #16

BCIGRA opened this issue Apr 4, 2024 · 7 comments

Comments

@DYSIM
Copy link

DYSIM commented Apr 5, 2024

same here, code worked 2 days ago but no longer

@oxtrue-dev
Copy link

Can anyone solve this problem.?

@WolfXBT
Copy link

WolfXBT commented Apr 6, 2024

Solana is heavily congested. To increase the chances of your transactions being included you must add priority fee to them. Unfortunately it does not guarantee that it will be accepted... Refer to this tweet to know why: https://twitter.com/0xCygaar/status/1776331763477819701

If you want a function that handle priority fee, add this in utils.ts:

export async function createAndSendV0Tx(txInstructions: TransactionInstruction[], wallets: Keypair[]) {

  let latestBlockhash = await connection.getLatestBlockhash('finalized');

  // Set your fee values here 
  const priority_fee_price = ComputeBudgetProgram.setComputeUnitPrice({microLamports: 25000})
  txInstructions.push(priority_fee_price);

  const messageV0 = new TransactionMessage({
    payerKey: wallets[0].publicKey,
    recentBlockhash: latestBlockhash.blockhash,
    instructions: txInstructions
  }).compileToV0Message();
  const transaction = new VersionedTransaction(messageV0);
  
  console.log("Transaction size:", transaction.serialize().length);

  transaction.sign(wallets);

  const txid = await connection.sendTransaction(transaction, { skipPreflight: true, maxRetries: 5 });
  console.log("Transaction sent to network");

  const confirmation = await connection.confirmTransaction({ signature: txid, blockhash: latestBlockhash.blockhash, lastValidBlockHeight: latestBlockhash.lastValidBlockHeight });
  
  if (confirmation.value.err) { throw new Error("Transaction not confirmed.") }
  console.log(`Transaction succesfully confirmed! https://explorer.solana.com/tx/${txid}`);
}

Then in the scripts instead of:

return { txids: await buildAndSendTx(innerTransactions) }

Do this:

return await createAndSendV0Tx(innerTransactions[0].instructions, [wallet]);

If your transaction doesn't show on the explorer after that, try to increase the priority fee and / or change RPC.

You can come to the Raydium discord in the ask-dev channel, you will get more active assistance than here.

@BCIGRA
Copy link
Author

BCIGRA commented Apr 6, 2024

So we need to set the microLamports higher, right?

@WolfXBT
Copy link

WolfXBT commented Apr 6, 2024

As stated in the tweet I shared, the problem is bots spamming the nodes, most transactions don't even get in because they are full. The fee is for when your transaction is received, to be prioritized and not fail. So, having a priority fee + retrying to send your transaction is the solution. But don't set the microLamports too high, 25000-250000 max should do, more would be a waste of money.

4
(Source: 0xCygaar and 0xBreadguy)

@DYSIM
Copy link

DYSIM commented Apr 8, 2024

Priority fees is likely less important than the tx dropping in this case. You can use the method getRecentPriorityFees method to do a check. most txns does not pay that much priority fees to get executed.

For the bot that spams txn on the network layer, is it correct to state there is no fee imposed on them since those dropped txn never made it to chain to pay any fee? So it is a matter of free spamming till your txn gets through.

@BCIGRA
Copy link
Author

BCIGRA commented Apr 8, 2024

Perhaps the node provider (RPC) requires maintenance?

I've attempted various troubleshooting steps. While processing data, I utilize the rpc helius, and for sending transaction data, I employ mainnet beta. Some transactions have gone through, indicating that there may be an issue with the RPC provider node that needs to be addressed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants