Aaradhya Textile Industry Aaradhya Textile Industry

Error Closing a Position in a Raydium CLMM Pool Using Priority Fees

I am writing this article to help users troubleshoot a common issue when closing positions in Raydium CLMM pools using priority fees in Solana.

The issue is caused by a known limitation in the Raydium SDK that prevents it from properly retrieving and identifying transactions associated with closed positions. This error is not specific to a specific 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 in 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 in the chain and minimize storage requirements. Unfortunately, this means that users like you have to manually retrieve the Transaction object to close the position.

Fixing the problem

To resolve this issue, users can use the getTransaction function from the Raydium SDK txManager module to retrieve the transaction associated with the closed position:

const { txManager } = require('raydium-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();

Please note that you will need to import the txManager module from the Raydium SDK and use it in your code.

Additional Tips

By following these steps and understanding the limitations of the Raydium SDK, users can resolve the error “Name “Transaction” cannot be found” when closing positions in Raydium CLMM pools using priority fees.

Leave a Reply

Your email address will not be published. Required fields are marked *