Version banner. This page documents
@raydium-io/raydium-sdk-v2@0.2.64-alpha, the pin every code demo in this site carries. The SDK is pre-1.0 and the type surface has evolved across releases — pin your version.The pin was advanced from 0.2.42-alpha on 2026-09-09 alongside the program upgrades: 0.2.64-alpha is the SDK’s current release. The raydium-sdk-V2-demo repo that the code-demo pages link to installs 0.2.62-alpha, so pin either if you are following a demo verbatim. The demos on these pages were last executed against 0.2.42-alpha (2026-04); their call signatures were re-checked against the 0.2.64-alpha source on 2026-09-09, but treat any mismatch as a documentation bug and open an issue.Install
.d.ts alongside its JS artifact. Minimum toolchain: Node 18+, TypeScript 5.0+, moduleResolution: "bundler" or "node16".
Initialize
The entry point isRaydium.load:
Raydium.load is async because, by default, it loads the token list (raydium.token.load()) from api-v3.raydium.io. Pass disableLoadToken: true to skip that fetch. The availability feature-check is a separate call to /v3/main/AvailabilityCheckAPI and is already skipped unless you explicitly pass disableFeatureCheck: false. Fee configs are not fetched at load time at all — they come lazily from raydium.api.getCpmmConfigs() / getClmmConfigs() on first use.
The module facades
Once loaded, theraydium object exposes ten module facades plus an API client:
Transaction builders
Every mutating function returns a builder rather than executing immediately:execute— a convenience function that signs + sends. Equivalent tobuilder.execute.builder— theTxBuilderinstance with all instructions and signers accumulated.builder.build()returns aTxBuildDatawhosetransactionis a single legacyTransaction;builder.buildV0()returns aTxV0BuildDatawith a singleVersionedTransaction. OnlybuildMultiTx/buildMultiTxV0produce an array.transaction— the builtTransaction/VersionedTransaction.instructionTypes/signers— the accumulated instruction labels and signer set.extInfo— product-specific extras. For example,cpmm.createPoolreturnsextInfo.address.{poolId, lpMint, vaultA, vaultB};launchpad.createLaunchpadreturnsextInfo.address(aLaunchpadPoolInfopluspoolId).
There is no
innerTransactions field on the return type — destructuring it is a TypeScript
error. Builders whose return type is MakeMultiTxData (for example
clmm.harvestAllRewards, farm.harvestAllRewards, tradeV2.swap,
launchpad.createLaunchpad) expose transactions instead, and their execute requires
{ sequentially: boolean } and resolves to { txIds } rather than { txId }.txVersion controls legacy vs V0 transaction format. V0 (address lookup tables) is the default recommendation — it lets larger swaps fit in a single transaction.
Why async builders?
Almost every builder internally fetches on-chain state: pool info (for quotes), token program ownership (for Token-2022 vs SPL routing), account rent-exemption (for ATA creation), etc. The SDK caches aggressively but the first call for a new pool involves RPC round-trips. Keep a long-livedraydium instance to avoid re-fetching.
CLMM module additions (latest release)
The CLMM facade gained surfaces for the new dynamic-fee, single-sided-fee, and limit-order features:raydium.clmm.createCustomizablePool— superset ofcreatePoolthat acceptscollectFeeOnanddynamicFeeConfig(the config account’sPublicKey). SupplyingdynamicFeeConfigis what enables dynamic fees; there is no separateenableDynamicFeeflag and nodynamicFeeConfigId. ClassiccreatePoolcontinues to work for default-fee pools.raydium.clmm.openLimitOrder— open a single-tick limit order. TakespoolInfo,baseIn(direction),orderTick,amount, and optionallytickArrayBitmap,noneIndex,ownerInfo. Use the exportedgetOrderTick({ baseIn, mintADecimal, mintBDecimal, tickSpacing, price })helper to quantize the tick.raydium.clmm.increaseLimitOrder/decreaseLimitOrder— adjust the unfilled portion of an existing order. Both take{ poolInfo, limitOrder, amount };decreaseLimitOrderadds an optionalslippage. Decreasing reverts on a fully-filled order withInvalidOrderPhase.raydium.clmm.settleLimitOrder/settleAllLimitOrder— sweep filled output to the owner’s ATA.settleLimitOrdertakes only{ limitOrder }— nopoolInfo. Either the order’s owner or the program’slimit_order_adminkeeper can call it.raydium.clmm.closeLimitOrder/closeAllLimitOrder— close fully-settled orders to recover rent.raydium.api.getClmmDynamicConfigs()— REST helper that hits the new/main/clmm-dynamic-configendpoint. (There is no limit-order-config helper or endpoint: limit orders are keyed by tick, not by a per-pool config account.)
@raydium-io/raydium-sdk-v2/<anything> does not resolve in any spelling — import everything from the top-level barrel. (Internally, src/raydium/clmm/utils/ was renamed to src/raydium/clmm/libraries/, but that was never a public entry point.)
End-to-end TypeScript walkthroughs live in products/clmm/code-demos.
Common pitfalls
1. Cluster mismatch
The SDK’s startup config is cluster-specific. Mixingcluster: "mainnet" with a devnet Connection causes silent mis-routing: the SDK quotes against mainnet AmmConfig but sends to devnet. Always pass both.
2. Forgetting to pre-create ATAs
On first interaction with a mint, the user’s Associated Token Account may not exist. The SDK auto-prepends anAssociatedTokenAccount::create instruction when it detects a missing ATA, which costs a small amount of rent. If your wallet is low on SOL this will fail silently. Check and fund before retrying.
3. Stale poolInfo
poolInfo is a cached snapshot. If the pool state has changed since you fetched it (a large trade moved the price, say), the swap’s minAmountOut may be computed against the old state and land below the on-chain amount-out, reverting. Re-fetch poolInfo immediately before building high-value transactions, or use the SDK’s computeAmountOut which re-queries reserves.
4. Priority fees
The SDK does not add compute-unit prices by default. In high-volume windows (new-pool launches, meme-coin events) this means your transaction competes with many others and may not land. Supply an explicitcomputeBudgetConfig:
integration-guides/priority-fee-tuning for sizing guidance.
5. Slippage tolerance must match the pool type
CPMM and AMM v4 are CPMM math (low impact on normal trades). CLMM is piecewise (impact jumps at tick crossings). If you copy a 0.5% slippage tolerance from a CPMM example into a CLMM swap that crosses several ticks, the transaction is likely to revert. The SDK’scomputeAmountOut returns priceImpact; size your tolerance above it.
6. BN vs number
All amount fields in the SDK are bn.js BN instances — never JavaScript number. Converting amount values via .toNumber() silently truncates at 2^53; for any value above ~9 quadrillion (not uncommon on 9-decimal mints), this produces the wrong result. Keep everything in BN until the final UI render.
Versioning policy
@raydium-io/raydium-sdk-v2is the only SDK Raydium maintains. All docs, demos, and integration guidance target it.- An older v1 package (
@raydium-io/raydium-sdk) exists on npm for historical reasons. Maintenance ended after CPMM and LaunchLab shipped (v1 never gained support for either), and there have been no v1 releases since 2024. Treat v1 as end-of-life: do not use it for new code, and migrate any remaining v1 integrations to v2. - SDK v2 is pre-1.0. Breaking changes between 0.x minor releases are possible; pin the version you’ve verified against and check the GitHub release notes when upgrading.
Upgrading
When upgrading between SDK minor versions:- Re-check the return type of every mutating call — shape changes (e.g.
extInfo) land frequently. - Regenerate
poolInfofetch signatures — a field may have been renamed. - Re-verify your slippage handling; the SDK has shifted between auto-bound and opt-in bound behaviors across releases.
- If you use
raydium.tradeV2(routing), re-verify the route shape — it is the most unstable part of the surface. Note the facade was renamed fromtradetotradeV2; the old name no longer exists.
Getting help
For SDK and API questions:- GitHub issues — file at github.com/raydium-io/raydium-sdk-V2/issues for bugs and feature requests. The Raydium team monitors actively.
- Discord —
#dev-supportchannel at discord.gg/raydium for synchronous help. - Telegram — developer chat linked from raydium.io (avoid unverified Telegram groups).
security/disclosure.
Pointers
sdk-api/rest-api— the HTTP complement to the SDK.sdk-api/trade-api— server-built swap transactions.sdk-api/anchor-idl— regenerating clients directly from program IDLs.sdk-api/python-integration— Python equivalent viasolana-py.integration-guides/priority-fee-tuning— sizingcomputeBudgetConfig.
- Raydium SDK v2 source
- Raydium SDK release notes.

