Blog

Solana: Raydium SDK v2 showing no liquidity in clmm position when there is liquidity

I can help you with that article. Here is an outline:

Title: Solana: Raydium SDK v2 not showing liquidity in CLMM position when trying to close

Introduction:

As a Raydium user, I encountered an issue when trying to close a liquidity fund position on the Solana blockchain using their SDK v2. Despite having a liquidity pool with active trading pairs, closing the position still produced a transaction ID (tx id) with no noticeable progress or updates.

Problem:

To test the SDK v2, I opened a liquidity position in ClosePosition.ts. However, when I tried to close this position using closePosition.ts, I encountered an issue where no significant progress was made. The tx id produced was not relevant to the transaction itself, but rather 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'; // Sample position ID

try {

await sdk.closePosition(

chainId,

liquidityPoolId,

assetIds,

positionId

);

} catch (error) {

console.error(error);

}

}

Problem:

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

Possible Cause:

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

Solution:

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

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

Conclusion:

I hope this article helped shed some light on an issue I encountered when closing a liquidity fund position on 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.

Minimizing Crypto Investors

Bu gönderiyi paylaş

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.