tradingxminds

I can help you with that article. Here’s a draft:

Title: Solana: Raydium SDK v2 shows no liquidity on CLMM position when trying to close

Introduction:

As a Raydium user, I’ve been experiencing an issue when trying to close a liquidity pool position on the Solana blockchain using their v2 SDK. Despite having a liquidity pool with active trading pairs, closing the position still generates a transaction ID (tx id) without any noticeable progress or update.

The Problem:

To test the v2 SDK, I opened a liquidity pool position in ClosePosition.ts. However, when trying to close this position using closePosition.ts, I encountered an issue where no meaningful progress was made. The transaction ID generated was not relevant to the transaction itself, but rather seemed to be related to a different type of event.

The code:

Below is a simplified example of my ClosePosition.ts code:

import { ChainId , sdk } from '@radium/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'; // Sample position ID

try {

await sdk.closePosition(

chainId,

liquidityPoolId,

assetIds,

positionId

);

} catch (error) {

console.error(error);

} }

} }

The problem:

When I run this code, the SDK v2 tries to close the liquidity pool position using ClosePosition.ts. However, since there is no progress or noticeable updates, no transaction ID is produced.

Possible cause:

Since the SDK v2 uses a different event stream than OpenPosition, it is possible that the transaction ID is being returned by an incorrect event type (ClosePositionEvent). Alternatively, the SDK could be experiencing some issues with network connectivity or smart contract deployment, causing the transaction to get stuck in limbo.

Workaround:

To resolve this issue, I would recommend checking the following:

  • Make sure there are enough liquidity pool assets available on the Solana blockchain.
  • Check that the liquidity pool is properly configured and deployed on-chain.
  • Check for network connectivity issues or smart contract deployment errors using tools such as Truffle or the Solana CLI.

Conclusion:

I hope this article helped clarify an issue I encountered when closing a liquidity pool position in the Raydium SDK v2. If you are experiencing similar issues, please feel free to provide more details and context so we can better help each other resolve the issue.

Leave a Reply

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