Skip to main content

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

InstructionTypeScript SDKUse
initialize_poolcreatePoolCreate a permissionless pool from a static config.
initialize_pool_with_dynamic_configcreateCustomPoolWithDynamicConfigCreate a pool from a dynamic config where the creator supplies pool-specific parameters.
initialize_customizable_poolcreateCustomPoolCreate 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

InstructionTypeScript SDKUse
create_positioncreatePositionMint a Token-2022 position NFT and initialize an empty position.
close_positionclosePositionClose an empty position account and position NFT.
split_positionsplitPositionSplit liquidity, fees, rewards, and inner vesting by independent percentage fields.
split_position2splitPosition2Split 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

InstructionTypeScript SDKUse
add_liquidityaddLiquidity, createPositionAndAddLiquidityAdd liquidity to an existing or newly created position.
remove_liquidityremoveLiquidityWithdraw a selected amount of unlocked liquidity.
remove_all_liquidityremoveAllLiquidity, removeAllLiquidityAndClosePosition, mergePositionWithdraw all currently unlocked liquidity.
lock_positionlockPositionLock liquidity with an external vesting account.
lock_inner_positionlockPosition({ innerPosition: true })Lock liquidity using embedded Position.inner_vesting.
refresh_vestingrefreshVestingRelease available vested liquidity into unlocked liquidity.
permanent_lock_positionpermanentLockPositionMove unlocked liquidity into permanent lock.
Add and remove liquidity update pool rewards, position rewards, fees, reserves, and liquidity before transferring tokens.

Swaps

InstructionTypeScript SDKUse
swapswapLegacy exact-in swap path.
swap2swap2Current exact-in, partial-fill, and exact-out swap path.

Swap Modes

swap2 accepts SwapMode:
ModeParameter meaning
ExactInamount_0 is input amount; amount_1 is minimum output
PartialFillamount_0 is input amount; amount_1 is minimum output; execution may stop at pool bounds
ExactOutamount_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

InstructionTypeScript SDKUse
claim_position_feeclaimPositionFee, claimPositionFee2Claim pending LP fees from a position.
initialize_rewardinitializeReward, initializeAndFundRewardInitialize one of the two reward slots.
fund_rewardfundReward, initializeAndFundRewardFund reward emissions.
claim_rewardclaimRewardClaim pending liquidity mining rewards.
withdraw_ineligible_rewardwithdrawIneligibleRewardWithdraw undistributable rewards after campaign constraints allow it.
update_reward_durationupdateRewardDurationUpdate reward campaign duration.
update_reward_funderupdateRewardFunderUpdate the funder authority for a reward slot.
Reward index 0 and 1 are the only supported reward slots.