Documentation
    Preparing search index...

    Function openPositionInstructionsWithTickBounds

    • Opens a new position in a concentrated liquidity pool within a specific tick range. This function allows you to provide liquidity for the specified range of ticks and adjust liquidity parameters accordingly.

      Note: This function cannot be used with Splash Pools.

      Parameters

      • rpc: IncreaseLiquidityRpc

        RPC client. Requires: GetAccountInfoApi, GetMultipleAccountsApi, GetMinimumBalanceForRentExemptionApi

      • poolAddress: Address

        The address of the liquidity pool where the position will be opened.

      • param: IncreaseLiquidityParam

        Maximum amounts of token A and B to deposit.

      • lowerTickIndex: number

        The lower bound of the tick range for the position.

      • upperTickIndex: number

        The upper bound of the tick range for the position.

      • Optionalconfig: OpenPositionConfig = {}

        The parameters to build the open position with tick bounds instruction.

      Returns Promise<OpenPositionInstructions>

      A promise that resolves to an object containing instructions, position mint address, and initialization cost.

      import { openPositionInstructionsWithTickBounds, WhirlpoolDeployment } from '@orca-so/whirlpools';
      import { generateKeyPairSigner, createSolanaRpc, devnet, address } from '@solana/kit';

      const devnetRpc = createSolanaRpc(devnet('https://api.devnet.solana.com'));
      const wallet = await generateKeyPairSigner(); // CAUTION: This wallet is not persistent.

      const whirlpoolAddress = address("POOL_ADDRESS");
      const lowerTickIndex = -44320;
      const upperTickIndex = -22160;

      const { instructions, initializationCost, positionMint } = await openPositionInstructionsWithTickBounds(
      devnetRpc,
      whirlpoolAddress,
      { tokenMaxA: 1_000_000n, tokenMaxB: 0n },
      lowerTickIndex,
      upperTickIndex,
      {
      slippageToleranceBps: 100,
      withTokenMetadataExtension: true,
      funder: wallet,
      whirlpoolDeployment: WhirlpoolDeployment.devnet,
      },
      );