Documentation
    Preparing search index...

    Function decreaseLiquidityInstructions

    • Generates instructions to decrease liquidity from an existing position in an Orca Whirlpool.

      Parameters

      • rpc: Rpc<
            GetAccountInfoApi & GetMultipleAccountsApi & GetMinimumBalanceForRentExemptionApi & GetEpochInfoApi,
        >

        A Solana RPC client for fetching necessary accounts and pool data.

      • positionMintAddress: Address

        The mint address of the NFT that represents ownership of the position from which liquidity will be removed.

      • param: DecreaseLiquidityQuoteParam

        Defines the liquidity removal method (liquidity, tokenA, or tokenB).

      • OptionalslippageToleranceBps: number = SLIPPAGE_TOLERANCE_BPS

        The acceptable slippage tolerance in basis points.

      • Optionalauthority: TransactionSigner = FUNDER

        The account authorizing the liquidity removal.

      Returns Promise<DecreaseLiquidityInstructions>

      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/kit';
      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}`);