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 amm IDL exposes many instructions. Integrators can choose to either use the TypeScript SDK for transaction construction or build through CPI.
Pool Creation
| Instruction | Use |
|---|
initialize_permissioned_pool | Creates a permissioned pool from an arbitrary signer pool account. |
initialize_permissionless_pool | Creates a permissionless pool with the curve’s default fee. |
initialize_permissionless_pool_with_fee_tier | Creates a permissionless pool with an allowed trade fee tier. |
initialize_permissionless_constant_product_pool_with_config | Creates a config-based constant-product pool with the config’s default activation point. |
initialize_permissionless_constant_product_pool_with_config2 | Creates a config-based constant-product pool with an optional activation point override. |
initialize_customizable_permissionless_constant_product_pool | Creates a customizable constant-product launch pool without a config PDA. |
create_mint_metadata | Creates missing Metaplex LP mint metadata for older pools. |
Pool initialization creates or initializes the pool, LP mint, pool-owned Dynamic Vault LP token accounts, protocol fee token accounts, initial liquidity, and LP mint metadata. The two Dynamic Vault accounts and their token vaults must exist or be created as part of the setup flow.
Pool PDA Variants
| Pool type | Address behavior |
|---|
| Permissioned | Pool address is an arbitrary signer account. |
| Permissionless default fee | PDA from curve type byte and sorted token mints. |
| Permissionless fee tier | PDA from curve type byte, sorted token mints, and optional fee-bps seed. The default fee tier omits the fee seed. |
| Config-based constant product | PDA from sorted token mints and config key. |
| Customizable constant product | PDA from pool and sorted token mints. |
Use the SDK or Rust helper derivations instead of rebuilding seeds manually.
Swaps
| Instruction | Use |
|---|
swap | Swaps token A to B or token B to A with exact input and minimum output protection. |
swap validates pool enablement and launch activation, updates depeg virtual price when required, deposits input through one Dynamic Vault, computes trade, protocol, partner, and optional host fees, then withdraws output through the opposite vault.
| Parameter | Meaning |
|---|
in_amount | Exact source token amount. |
minimum_out_amount | Minimum destination token amount accepted by the user. |
| Remaining depeg accounts | Required for stable LST/depeg pools. |
| Optional host fee account | Referral token account that receives the host fee share when provided. |
Liquidity
| Instruction | Use |
|---|
add_balance_liquidity | Adds balanced liquidity by minting a target amount of pool LP, bounded by max token A and B inputs. |
add_imbalance_liquidity | Adds liquidity with imbalanced token A/B inputs. Only supported by stable pools. |
remove_balance_liquidity | Burns pool LP and withdraws token A/B proportionally. This remains available when a pool is disabled. |
remove_liquidity_single_side | Burns pool LP and withdraws one token. Only supported by stable pools. |
bootstrap_liquidity | Re-seeds a depleted pool with token A and token B liquidity. |
get_pool_info | Emits pool token amounts, virtual price, and timestamp for read-style integrations. |
Balanced operations are the normal constant-product path. Stable pools additionally support imbalanced deposits and single-sided withdrawals.
LP Locks
| Instruction | Use |
|---|
create_lock_escrow | Initializes a lock escrow PDA for an owner and pool. |
lock | Transfers LP tokens into the escrow and updates the virtual-price checkpoint. |
claim_fee | Claims token A/B fees accrued by locked LP, bounded by max_amount. |
Lock fee accounting is LP-denominated internally. Claiming converts claimable LP value into token A/B by using the pool’s balanced withdrawal logic.
Configs And Activation
| Instruction | Use |
|---|
create_config | Admin-only instruction that creates a config PDA from config + index. |
close_config | Admin-only instruction that closes a config account and returns rent. |
update_activation_point | Admin-only instruction that updates a launch pool’s activation point before the program-defined cutoff. |
set_whitelisted_vault | Admin-only instruction that updates the launch pool whitelisted alpha vault before pre-activation swaps begin. |
Config-created pools inherit pool_fees, activation_duration, vault_config_key, pool_creator_authority, activation_type, and partner_fee_numerator. If pool_creator_authority is not the default pubkey, that authority must sign pool creation from the config.
ConfigParameters field | Meaning |
|---|
trade_fee_numerator | Trade fee numerator using FEE_DENOMINATOR = 100_000. |
protocol_trade_fee_numerator | Protocol share numerator using FEE_DENOMINATOR = 100_000. |
activation_duration | Duration added to the current slot or timestamp to derive default activation. |
vault_config_key | Alpha Vault config/base key. Default pubkey means no alpha vault. |
pool_creator_authority | Public config when default; private config when non-default. |
activation_type | 0 for slot activation, 1 for timestamp activation. |
index | Config PDA index. |
partner_fee_numerator | Partner share of protocol fees using FEE_DENOMINATOR = 100_000. |
Pool Controls And Fees
| Instruction | Use |
|---|
enable_or_disable_pool | Admin-only instruction that toggles pool enablement. Disabled pools still allow balanced withdrawals. |
set_pool_fees | Updates pool trade, protocol, and partner fee settings, subject to fee authority and validation rules. |
override_curve_param | Updates stable-swap curve parameters without changing the curve type. Only stable amp changes are honored. |
partner_claim_fee | Lets the configured partner authority claim pending partner token A/B fees. |
trade_fee_numerator, protocol_trade_fee_numerator, host fee, and partner fee values use FEE_DENOMINATOR = 100_000, not direct basis points.
Operator And Admin Instructions
| Instruction | Use |
|---|
withdraw_protocol_fees | Operator-gated instruction that withdraws protocol token A/B fees up to caller-provided maximums. |
zap_protocol_fee | Operator-gated instruction that zaps protocol fees through approved Jupiter v6 route accounts. |
create_operator_account | Admin-only instruction that creates an operator permission PDA for a whitelisted address. |
close_operator_account | Admin-only instruction that closes an operator account and returns rent. |
Operator permissions are stored as a bitmap. Bit 0 allows protocol fee claiming, and bit 1 allows protocol fee zapping.
Validation
| Area | Rule |
|---|
| Dynamic Vaults | Pool quotes and transactions need vault state, vault token accounts, vault LP mints, and pool-held vault LP token accounts. Reading only the pool account is not enough. |
| Activation | Launch pools can block swaps until bootstrapping.activation_point. Slot and timestamp activation use different current-point sources. |
| Alpha Vault | Config or customizable pools with alpha-vault support apply stricter activation timing and quote-mint checks on mainnet builds. |
| Stable pools | Single-sided withdrawal and imbalanced deposits are stable-pool features. Constant-product pools should use balanced liquidity operations. |
| Depeg pools | LST/depeg stable pools need remaining stake/depeg accounts for quotes and swaps. |
| Fees | Fee numerators use FEE_DENOMINATOR = 100_000. SDK config helpers that accept bps convert bps into this denominator. |
| Referrals | Host fee routing depends on an optional referral token account passed as a swap remaining account. |
| Disabled pools | Swaps and most liquidity operations are blocked, but balanced withdrawal remains available so LPs can exit. |