Skip to main content
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

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.
When mint validation is not skipped, pass token badge remaining accounts at index 0 (token A) and index 1 (token B) for mints that are not permissionless-supported. initialize_pool and initialize_pool_with_dynamic_config skip those checks when the private config has CreatePoolWithoutMintValidation. initialize_customizable_pool always validates mints. Token-2022 wrapped SOL is still rejected.

Positions

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

Add and remove liquidity update pool rewards, position rewards, fees, reserves, and liquidity before transferring tokens.

Swaps

Swap Modes

swap2 accepts SwapMode: New integrations should prefer swap2 and SDK getQuote2 because they share exact-in, partial-fill, and exact-out semantics.

Fees And Rewards

Reward index 0 and 1 are the only supported reward slots.

Config And Operator Instructions

permission is set at config creation and is immutable. There is no instruction to update Config.permission. Public configs (default pool_creator_authority) must use permission = 0. The only defined bit today is CreatePoolWithoutMintValidation (1 << 0). InvalidConfigPermission (6072) is returned when a public config is given a non-zero permission, or when permission bits are outside the defined ConfigPermission range.
Token-2022 wrapped SOL is rejected during mint validation even when CreatePoolWithoutMintValidation is set. Use the standard wrapped SOL mint.
claim_protocol_fee and zap_protocol_fee are removed. Use claim_protocol_fee2.