A Solana RPC client used to interact with the blockchain.
The address of the liquidity pool where the position will be opened.
The parameters for increasing liquidity, where you must choose one (liquidity
, tokenA
, or tokenB
). The SDK will compute the other two.
The lower bound of the price range for the position.
The upper bound of the price range for the position.
Optional
slippageToleranceBps: number = SLIPPAGE_TOLERANCE_BPSThe slippage tolerance for adding liquidity, in basis points (BPS).
Optional
funder: TransactionSigner = FUNDERThe account funding the transaction.
A promise that resolves to an object containing instructions, quote, position mint address, and initialization costs for increasing liquidity.
import { openPositionInstructions, setWhirlpoolsConfig } from '@orca-so/whirlpools';
import { generateKeyPairSigner, createSolanaRpc, devnet, address } from '@solana/web3.js';
await setWhirlpoolsConfig('solanaDevnet');
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 param = { tokenA: 1_000_000n };
const lowerPrice = 0.00005;
const upperPrice = 0.00015;
const { quote, instructions, initializationCost, positionMint } = await openPositionInstructions(
devnetRpc,
whirlpoolAddress,
param,
lowerPrice,
upperPrice,
100,
wallet
);
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.