Skip to main content
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:
You need:
  • Node 18+ with ESM support ("type": "module" in package.json or .mjs extension).
  • A Solana keypair at ~/.config/solana/id.json (or anywhere — set KEYPAIR). See solana-fundamentals/toolchain for 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.
Set these once per shell:
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:

Version banner

If a script breaks on a newer SDK version, check the SDK’s release notes — the builder return shapes have evolved between minor releases.