I can help you with this article. Here is the draft:
Title: Solana: Raydium SDK v2 does not show liquidity in CLMM position when trying to close
Introduction:
As a Raydium user, I encountered an issue while trying to close a Solana blockchain liquidity pool position using their SDK v2. Despite having a liquidity pool with active trading pairs, closing the position still generates a transaction ID (tx id) without any noticeable progress or updates.
Problem:
To test the SDK v2, I opened a liquidity pool position ClosePosition.ts. However, when trying to close this position using closePosition.ts, I encountered an issue where no significant progress was made. The tx id generated was not related to the transaction itself, but seemed to be related to a different type of event.
Code:
Here is a simplified example of my ClosePosition.ts code:
import { ChainId, sdk } from '@raydium/sdk';
import { ClosePositionRequest } from './ClosePositionRequest';
const chainId = ChainId.SOLANA;
async function closePosition(request: ClosePositionRequest) {
const liquidityPoolId = request.liquidityPoolId;
const assetIds = [request.asset1Id, request.asset2Id];
const positionId = 'position-123'; // example of position ID
try {
await sdk.closePosition(
chainId,
liquidityPoolId,
assetId,
positionId
);
} catch (error) {
console.error(error);
}
}
Problem:
When I run this code, SDK v2 tries to close the liquidity pool position using ClosePosition.ts. However, since there is no visible progress or updates, no tx id is created.
Possible Cause:
Given that SDK v2 uses a different event flow than OpenPosition, it is possible that the transaction ID is returned by the wrong type of event (ClosePositionEvent). Alternatively, the SDK may be experiencing network connectivity or smart contract implementation issues, causing the transaction to get stuck in limbo.
Solution:
To resolve this issue, I recommend checking the following:
- Ensure that there are sufficient liquidity pool assets on the Solana blockchain.
- Verify that the liquidity pool is properly configured and deployed on-chain.
- Check for network connectivity issues or smart contract implementation errors using tools such as Truffle or Solana CLI.
Conclusion:
I hope this article helped clarify the issue I encountered when closing a liquidity fund position in Raydium SDK v2. If you encounter similar issues, please provide more information and context so we can better help each other resolve the issue.