What this chapter is. Three end-to-end scripts that each perform a real on-chain operation against Raydium. The swap and CPMM scripts are single files you paste, configure with env vars, and run. The CLMM script is a multi-file flow — see its own page for what that involves. Use these to validate your setup before building anything bigger.What this chapter is not. Reference documentation. For the full builder API, parameter reference, and corner cases, see SDK & API and the per-product
code-demos pages.Prerequisites
Run this once:- Node 18+ with ESM support (
"type": "module"inpackage.jsonor.mjsextension). - A Solana keypair at
~/.config/solana/id.json(or anywhere — setKEYPAIR). Seesolana-fundamentals/toolchainfor generating a keypair. - A funded wallet. The swap script needs only its input amount plus a small cushion — a CPMM swap costs ~0.0015 SOL in network fees (see
reference/fee-comparison), plus one-time rent if the swap has to open a token account for you. Creating a pool costs more: the CPMM script alone carries a ~0.15 SOL one-time pool-creation fee before seed liquidity or rent. See each script’s own Setup section for the current figure before funding your wallet. - An RPC URL. Free public RPC works for testing; for anything more than a smoke test, use a paid provider.
Cluster. All three scripts default to mainnet. Devnet needs
RPC_URL=https://api.devnet.solana.com plus cluster: "devnet" inside the script — for the two pool-creation scripts, that’s not the only change; see each script’s own Setup section for what else has to move. Be aware that pool seed liquidity on devnet is sparse; expect to mint your own test tokens.The three scripts
Swap from CLI
Quote and execute a swap through a CPMM pool — the fastest way to confirm your setup works.
Deploy a CPMM pool
Create a new CPMM pool for a token pair you choose, seeded with initial liquidity at the 0.25% fee tier.
Deploy a CLMM pool
Create a new CLMM pool and open an initial concentrated position, at the lowest fee tier by default.
After this chapter
Each script prints its on-chain result — a swap quote and transaction link, new pool addresses, or a new position and its NFT — and a single line pointing at the next page in the SDK & API chapter for the operation it performed. When you’re ready to write your own integration:- Backends and bots → Trade API.
- Frontends and full-control apps → TypeScript SDK.
- On-chain composition → Rust CPI.
- Picking among them → the comparison table at the top of SDK & API.

