Documentation Index
Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
Use this file to discover all available pages before exploring further.
What an IDL is
Anchor programs on Solana publish an IDL (Interface Definition Language) file describing their instructions, account layouts, error enum, and struct schemas. The IDL is the source of truth for client code generation — the TS SDK, Rust CPI crate, and third-party clients are all generated from (or hand-written against) it. Raydium publishes IDLs for CPMM, CLMM, and LaunchLab. AMM v4, Stable AMM, and Farm (v3 / v5 / v6) predate Anchor or are otherwise not Anchor-distributed — their account structures are hand-maintained in the SDK.Where to find them
IDLs live in a dedicated repository:| Program | IDL file |
|---|---|
| CPMM | raydium_cpmm/raydium_cp_swap.json |
| CLMM | raydium_clmm/raydium_clmm.json |
| LaunchLab | raydium_launchpad/raydium_launchpad.json |
| AMM v4 | no official IDL — see raydium-sdk-V2/src/raydium/liquidity/layout.ts for hand-written layouts |
| Stable AMM | no official IDL — layouts in the SDK |
| Farm | no official IDL — layouts in the SDK |
Regenerating a TypeScript client
Anchor’s codegen produces a typed client from the IDL:raydium.cpmm.swap(...) helper which wraps the Anchor methods plus all the bookkeeping (ATA creation, transfer-fee adjustment, compute budget, Token-2022 program routing). Regenerate only when you need a layer below the SDK.
Regenerating a Rust client (CPI crate)
Raydium publishes Anchor crates for the programs that have IDLs:cpi feature exposes cpi::accounts::<Ix> account structs and cpi::<ix>() invokers — ready-to-use CPI wrappers. See sdk-api/rust-cpi for usage patterns.
If you prefer to generate fresh bindings:
Regenerating a Python client
There is no official Raydium Python SDK. Third-party generators include:anchorpy— Python port of@coral-xyz/anchor. Generates typed method builders from IDLs.solders— low-level Solana primitives (transactions, keypairs, pubkeys) in Rust bindings; used underneathanchorpy.
sdk-api/python-integration for a fuller walk-through.
IDL change policy
Raydium follows these rules for IDL stability:- Instruction discriminators never change. Adding new instructions extends the enum at the end; existing discriminators remain stable.
- Account struct layouts evolve only additively. New fields go at the end, preceded by a size bump in the on-chain schema. Existing fields keep their offsets.
- Error enum codes are append-only. An existing error code always means the same thing.
- Breaking changes ship in new programs. When a redesign is needed, the team deploys a new program ID (e.g. CPMM as a fresh program rather than upgrading AMM v4). Old pools continue to run on the old program; new pools go to the new one.
What to do when the IDL changes
- Update the SDK.
npm update @raydium-io/raydium-sdk-v2. - Regenerate your client code if you use Anchor codegen directly.
- Diff the account layout. The new layout’s trailing fields are the only thing your code hasn’t seen; confirm whether you need them.
- Don’t assume old instruction discriminators are invalid. Per rule 1, they still work.
- Re-run integration tests against devnet before rolling to mainnet.
IDL troubleshooting
”Invalid discriminator” errors
Usually means a client built against version N of the IDL is trying to invoke an instruction that existed only in a pre-deploy version of the program. Re-pull the IDL from the live program:Account decode failures
Ifprogram.account.<Name>.fetch(pubkey) throws with “Invalid account discriminator”, the account was created by a previous program version and Anchor is rejecting its 8-byte discriminator. The fix is to use the raw layout parser from the SDK (PoolInfoLayout.decode(accountData)) which does not enforce Anchor discriminators.
Missing instructions in the generated client
Anchor’s TS codegen only generates methods for instructions whose IDL entry has aname that parses as a valid identifier. Raydium’s instructions all satisfy this, but if you see a mismatch, check whether the IDL file is from the current SDK release.
Pointers
sdk-api/rust-cpi— using the Rust CPI crates.sdk-api/python-integration— Python viaanchorpy.sdk-api/typescript-sdk— the higher-level TS client.


