Error with Closing Position on Radium CLMM Pool using Priority Fees
I’m writing this article to help users troubleshoot a common issue when closing positions on Radium CLMM pools using priority fees in Solana.
The problem is caused by a known limitation in the Raydium SDK, which prevents it from properly retrieving and identifying transactions associated with closed positions. This error is not specific to any particular API or functionality, but rather a design choice made by the Raydium team to optimize performance and reduce latency.
Understanding the Issue
When you close a position on a CLMM pool using priority fees in Solana, the SDK creates a new transaction (or “Transaction”) that represents the closing action. However, due to the way transactions are stored and retrieved from the blockchain, this transaction cannot be identified or accessed by the Raydium SDK.
This is likely an attempt by the team to reduce the number of transactions on-chain and minimize storage requirements. Unfortunately, this means that users like you must manually retrieve the Transaction object in order to close the position.
Fixing the Issue
To resolve this issue, users can use the getTransaction
function from the Raydium SDK’s txManager
module to retrieve a transaction associated with the closed position:
const { txManager } = require('radium-sdk');
// Create a new transaction object for the closed position
const transaction = await txManager.createTransaction({
clmmPool: 'CLMM_Pool',
closePosition: true,
});
// Get the transaction object
const transactionObj = await txManager.getTxByHash(transaction.hash);
// Close the position
transactionObj . close ( ) ;
Note that you’ll need to import the txManager
module from the Raydium SDK and use it in your code.
Additional Tips
- Make sure you’re using the latest version of the Raydium SDK, as the fix may not be available in earlier versions.
- If you’re still experiencing issues, try increasing the transaction timeout or enabling debug logging to help diagnose the problem.
- Keep in mind that this workaround assumes you have already retrieved the transaction object manually. To avoid errors in the future, consider using a more robust approach like storing transactions in a database or using a centralized storage solution.
By following these steps and understanding the limitations of the Raydium SDK, users can resolve the “Cannot find name ‘Transaction'” error when closing positions on Raydium CLMM pools using priority fees.