RPC client. Requires: GetAccountInfoApi, GetMultipleAccountsApi, GetMinimumBalanceForRentExemptionApi
The address of the liquidity pool where the position will be opened.
Maximum amounts of token A and B to deposit.
The lower bound of the price range for the position.
The upper bound of the price range for the position.
Optionalconfig: OpenPositionConfig = {}The parameters to build the open position instruction.
A promise that resolves to an object containing instructions, position mint address, and initialization cost.
import { openPositionInstructions, 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 lowerPrice = 0.00005;
const upperPrice = 0.00015;
const { instructions, initializationCost, positionMint } = await openPositionInstructions(
devnetRpc,
whirlpoolAddress,
{ tokenMaxA: 1_000_000n, tokenMaxB: 0n },
lowerPrice,
upperPrice,
{
slippageToleranceBps: 100,
withTokenMetadataExtension: true,
funder: wallet,
whirlpoolDeployment: WhirlpoolDeployment.devnet,
},
);
Opens a new position in a concentrated liquidity pool within a specific price range. This function allows you to provide liquidity for the specified range of prices and adjust liquidity parameters accordingly.
Note: This function cannot be used with Splash Pools.