A Solana RPC client for fetching necessary accounts and pool data.
The mint address of the NFT that represents ownership of the position from which liquidity will be removed.
Defines the liquidity removal method (liquidity, tokenA, or tokenB).
Optional
slippageToleranceBps: number = SLIPPAGE_TOLERANCE_BPSThe acceptable slippage tolerance in basis points.
Optional
authority: TransactionSigner = FUNDERThe account authorizing the liquidity removal.
A promise resolving to an object containing the decrease liquidity quote and instructions.
import { decreaseLiquidityInstructions, setWhirlpoolsConfig } from '@orca-so/whirlpools';
import { createSolanaRpc, devnet, address } from '@solana/web3.js';
import { loadWallet } from './utils';
await setWhirlpoolsConfig('solanaDevnet');
const devnetRpc = createSolanaRpc(devnet('https://api.devnet.solana.com'));
const wallet = await loadWallet();
const positionMint = address("HqoV7Qv27REUtmd9UKSJGGmCRNx3531t33bDG1BUfo9K");
const param = { tokenA: 10n };
const { quote, instructions } = await decreaseLiquidityInstructions(
devnetRpc,
positionMint,
param,
100,
wallet
);
console.log(`Quote token max B: ${quote.tokenEstB}`);
Generates instructions to decrease liquidity from an existing position in an Orca Whirlpool.