Documentation Index
Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
Use this file to discover all available pages before exploring further.
The cp-amm IDL exposes many instructions. Integrators can choose to either use the TypeScript SDK for transaction construction or build through CPI.
Pool Creation
| Instruction | TypeScript SDK | Use |
|---|
initialize_pool | createPool | Create a permissionless pool from a static config. |
initialize_pool_with_dynamic_config | createCustomPoolWithDynamicConfig | Create a pool from a dynamic config where the creator supplies pool-specific parameters. |
initialize_customizable_pool | createCustomPool | Create a customizable launch pool without a config PDA. |
Pool creation initializes the pool, vaults, first position, and Token-2022 position NFT. Pool PDAs sort mints in the seed list, but transaction builders should use the canonical token_a_mint and token_b_mint fields from pool state after creation.
Positions
| Instruction | TypeScript SDK | Use |
|---|
create_position | createPosition | Mint a Token-2022 position NFT and initialize an empty position. |
close_position | closePosition | Close an empty position account and position NFT. |
split_position | splitPosition | Split liquidity, fees, rewards, and inner vesting by independent percentage fields. |
split_position2 | splitPosition2 | Split all supported position state by one numerator over SPLIT_POSITION_DENOMINATOR. |
Position ownership is checked through the position NFT token account. The token account must hold exactly one NFT and be owned by the signer.
Liquidity And Locks
| Instruction | TypeScript SDK | Use |
|---|
add_liquidity | addLiquidity, createPositionAndAddLiquidity | Add liquidity to an existing or newly created position. |
remove_liquidity | removeLiquidity | Withdraw a selected amount of unlocked liquidity. |
remove_all_liquidity | removeAllLiquidity, removeAllLiquidityAndClosePosition, mergePosition | Withdraw all currently unlocked liquidity. |
lock_position | lockPosition | Lock liquidity with an external vesting account. |
lock_inner_position | lockPosition({ innerPosition: true }) | Lock liquidity using embedded Position.inner_vesting. |
refresh_vesting | refreshVesting | Release available vested liquidity into unlocked liquidity. |
permanent_lock_position | permanentLockPosition | Move unlocked liquidity into permanent lock. |
Add and remove liquidity update pool rewards, position rewards, fees, reserves, and liquidity before transferring tokens.
Swaps
| Instruction | TypeScript SDK | Use |
|---|
swap | swap | Legacy exact-in swap path. |
swap2 | swap2 | Current exact-in, partial-fill, and exact-out swap path. |
Swap Modes
swap2 accepts SwapMode:
| Mode | Parameter meaning |
|---|
ExactIn | amount_0 is input amount; amount_1 is minimum output |
PartialFill | amount_0 is input amount; amount_1 is minimum output; execution may stop at pool bounds |
ExactOut | amount_0 is desired output; amount_1 is maximum input |
New integrations should prefer swap2 and SDK getQuote2 because they share exact-in, partial-fill, and exact-out semantics.
Fees And Rewards
| Instruction | TypeScript SDK | Use |
|---|
claim_position_fee | claimPositionFee, claimPositionFee2 | Claim pending LP fees from a position. |
initialize_reward | initializeReward, initializeAndFundReward | Initialize one of the two reward slots. |
fund_reward | fundReward, initializeAndFundReward | Fund reward emissions. |
claim_reward | claimReward | Claim pending liquidity mining rewards. |
withdraw_ineligible_reward | withdrawIneligibleReward | Withdraw undistributable rewards after campaign constraints allow it. |
update_reward_duration | updateRewardDuration | Update reward campaign duration. |
update_reward_funder | updateRewardFunder | Update the funder authority for a reward slot. |
Reward index 0 and 1 are the only supported reward slots.