I can help you with this article. Here is the draft:
Title:
Solana: Raydium SDK v2 does not show liquidity in CLMM position when closing demand
Introduction:
As a Raydium user, I encountered a problem when trying to close a liquidity pool position on the Solana blockchain using their SDK v2. Despite having a liquidity pool with active trading pairs, closing a position still creates a transaction id (tx id) without any noticeable progress or updates.
Problem:
To test SDK v2, I opened a liquidity pool position in ClosePosition.ts. However, when trying to close this position using closePosition.ts, I ran into a problem where no significant progress was made. The generated tx id was not related to the transaction itself, but rather was related to another 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 position id
try {
await sdk.closePosition(
chainId,
liquidityPoolId,
assetIds,
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, the transaction identifier is not created.
Possible Cause:
Given that SDK v2 uses a different event stream than OpenPosition, it is possible that the transaction identifier is returned with the wrong event type (ClosePositionEvent). Additionally, the SDK may experience some issues with network connectivity or smart contract deployment, causing the transaction to get stuck in a suspended state.
Temporary solution:
To resolve this issue, I would recommend checking the following:
- Make sure there are enough liquidity pool assets in the Solana blockchain.
- Make sure that the liquidity pool is correctly configured and deployed in the chain.
- Check for network connectivity issues or smart contract deployment errors using tools like Truffle or Solana CLI.
Conclusion:
I hope this article helped shed some light on a problem I encountered when closing a liquidity pool position in Raydium SDK v2. If you’re having similar issues, feel free to provide more details and context so we can better help each other out.