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:
The IDL files are versioned in the repo’s git history; pin to a specific commit if you need byte-for-byte reproducibility.
Some IDLs can also be pulled directly from mainnet:
All three legacy IDL accounts are writable by the IDL authority
2XVnob28A5Qnpcy95UVeHWNT6G8Poy3tpA3AFyAMoZDt, which is separate from the programs’ BPF upgrade authority — so an IDL can be refreshed without redeploying, and can also lag a redeploy. Treat the on-chain IDL as a convenience, not as proof of the deployed bytecode’s shape.
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:raydium_cp_swap and raydium_clmm. There is no crate called raydium_amm_v3 under any spelling. Note the branches differ: raydium-cp-swap’s master still pins anchor-lang 0.32.1, so an Anchor-1.0 integration needs chore/upgrade-anchor; CLMM is on 0.32.1 either way, which is why the two cannot share a crate.
The 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 Anchor’s TypeScript client. 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 sizes are stable; new fields come out of reserved padding. Every Raydium state struct carries a trailing padding region sized at creation, and a new field is carved from that padding rather than appended — so the account’s byte length and the offsets of all pre-existing fields stay fixed. The corollary is that bytes you previously read as padding can become meaningful, and a field can be retired back into padding (as
PlatformConfig.curve_paramswas in the 2026-08-31 release). Re-read the struct definition after an upgrade; do not assume padding stays zero. - 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.

