raydium について
raydiumは、Solana上のRaydium取引所と流動性基盤を統合する開発者向けスキルガイドです。プールの種類、SDK操作、API、トークン発行を扱います。
主な機能
- 01CLMM、CPMM、AMMプールの解説
- 02TypeScript SDKの統合ガイド
- 03HTTP Trade APIとData API
- 04スワップ、流動性追加、プール作成
- 05LaunchLabによるトークン発行の解説
活用シーン
- 01アプリへのRaydium取引機能の統合
- 02プールデータの取得とスワップ実行
- 03プール作成や流動性の追加
- 04LaunchLabを使ったトークン発行の設定
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ sendaifun/ skills --skill raydiumインストール後、Claude Code で/raydiumを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
docs/clmm-guide.mdtroubleshooting.mdexamples/clmm-pool/README.mdexamples/clmm-position/README.mdexamples/cpmm-pool/README.mdexamples/farming/README.mdexamples/launchlab/README.mdexamples/liquidity/README.mdexamples/swap/README.mdresources/github-repos.mdlaunchlab.mdpool-types.mdprogram-ids.mdsdk-api-reference.mdtrade-api.mdtemplates/raydium-setup.ts詳細
Raydium Protocol - 完全統合ガイド
2021 年以来 DeFi を支えてきた、Solana を代表する AMM および流動性インフラストラクチャである Raydium の統合に関する決定版ガイドです。
Raydium とは?
Raydium は Solana 上の分散型取引所で、以下を提供します。
- トークンスワップ - あらゆる種類のプールをまたぐスマートルーティングによる、高速かつ低コストのスワップ
- 流動性の提供 - 流動性を提供して取引手数料や報酬を獲得
- トークンのローンチ - ボンディングカーブを利用した、許可不要のトークンローンチを実現する LaunchLab
- 無期限取引 - 暗号資産のレバレッジ取引
主な統計
- Solana で最も広く統合されている流動性インフラストラクチャ
- LaunchLab 経由で 35,000 以上のトークンをローンチ(2025 年)
- さまざまな用途に対応する複数のプールタイプ
主な製品
プールタイプ
| タイプ | 説明 | 最適な用途 |
|---|---|---|
| CLMM | 集中流動性マーケットメーカー | プロの LP、ステーブルコインペア、積極的な運用 |
| CPMM | Token22 に対応した定積 AMM(x*y=k) | 新しいトークンのローンチ、シンプルな統合 |
| AMM V4 | クラシック AMM + OpenBook CLOB | 既存市場、ハイブリッド流動性 |
その他の機能
- LaunchLab - ボンディングカーブを利用した、許可不要のトークンローンチ
- ファーム - イールドファーミングとステーキング報酬
- Burn & Earn - 流動性の永久ロック
- Trade API - スワップルーティング用 HTTP API
API の概要
1. SDK(TypeScript)
パッケージ: @raydium-io/raydium-sdk-v2
プール、ポジション、トランザクションを完全に制御できる、プログラムによる統合向けです。
2. Trade API(HTTP)
ベース URL: https://transaction-v1.raydium.io
スワップルーティング向けです。HTTP 経由で見積もりとシリアライズ済みトランザクションを取得できます。
3. Data API
ベース URL: https://api-v3.raydium.io
プールデータ、トークンリスト、ファーム情報、設定を取得できます。
クイックスタート
インストール
npm install @raydium-io/raydium-sdk-v2
# or
yarn add @raydium-io/raydium-sdk-v2
基本設定
import { Raydium } from '@raydium-io/raydium-sdk-v2';
import { Connection, Keypair } from '@solana/web3.js';
import bs58 from 'bs58';
// Setup connection and wallet
const connection = new Connection('https://api.mainnet-beta.solana.com');
const owner = Keypair.fromSecretKey(bs58.decode('YOUR_SECRET_KEY'));
// Initialize SDK
const raydium = await Raydium.load({
connection,
owner,
cluster: 'mainnet',
disableLoadToken: false, // Load token list
});
// Access token data
const tokenList = raydium.token.tokenList;
const tokenMap = raydium.token.tokenMap;
// Access account data
const tokenAccounts = raydium.account.tokenAccounts;
プールタイプ
CLMM(集中流動性)
LP が特定の価格帯に流動性を集中させ、資本効率を高められます。
// Fetch CLMM pool
const poolId = 'POOL_ID_HERE';
const poolInfo = await raydium.clmm.getPoolInfoFromRpc(poolId);
// Or from API (mainnet only)
const poolData = await raydium.api.fetchPoolById({ ids: poolId });
CPMM(定積)
OpenBook 市場を必要としないシンプルな AMM で、Token22 に対応しています。
// Fetch CPMM pool
const cpmmPool = await raydium.cpmm.getPoolInfoFromRpc(poolId);
AMM(レガシー)
OpenBook の中央指値注文板と統合されたクラシック AMM です。
// Fetch AMM pool
const ammPool = await raydium.liquidity.getPoolInfoFromRpc({ poolId });
主な操作
スワップ
import { CurveCalculator } from '@raydium-io/raydium-sdk-v2';
// Calculate swap
const { amountOut, fee } = CurveCalculator.swapBaseInput({
poolInfo,
amountIn: 1000000n, // lamports
mintIn: inputMint,
mintOut: outputMint,
});
// Execute CPMM swap
const { execute } = await raydium.cpmm.swap({
poolInfo,
inputAmount: 1000000n,
inputMint,
slippage: 0.01, // 1%
txVersion: 'V0',
});
await execute({ sendAndConfirm: true });
流動性の追加
// CPMM deposit
const { execute } = await raydium.cpmm.addLiquidity({
poolInfo,
inputAmount: 1000000n,
baseIn: true,
slippage: 0.01,
});
await execute({ sendAndConfirm: true });
プールの作成
// Create CPMM pool
const { execute } = await raydium.cpmm.createPool({
mintA,
mintB,
mintAAmount: 1000000n,
mintBAmount: 1000000n,
startTime: new BN(0),
feeConfig, // from API
txVersion: 'V0',
});
const { txId } = await execute({ sendAndConfirm: true });
プログラム ID
| プログラム | Mainnet | Devnet |
|---|---|---|
| AMM | 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 | DRaya7Kj3aMWQSy19kSjvmuwq9docCHofyP9kanQGaav |
| CLMM | CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK | devi51mZmdwUJGU9hjN27vEz64Gps7uUefqxg27EAtH |
| CPMM | CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C | CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW |
API エンドポイント
// Mainnet API
const API_URL = 'https://api-v3.raydium.io';
// Devnet API
const DEVNET_API = 'https://api-v3.raydium.io/main/';
// Common endpoints
const endpoints = {
tokenList: '/mint/list',
poolList: '/pools/info/list',
poolById: '/pools/info/ids',
farmList: '/farms/info/list',
clmmConfigs: '/clmm/configs',
};
トランザクションオプション
const { execute } = await raydium.cpmm.swap({
poolInfo,
inputAmount,
inputMint,
slippage: 0.01,
txVersion: 'V0', // or 'LEGACY'
computeBudgetConfig: {
units: 600000,
microLamports: 100000, // priority fee
},
});
// Execute with options
const { txId } = await execute({
sendAndConfirm: true,
skipPreflight: true,
});
console.log(`https://solscan.io/tx/${txId}`);
主な機能
| 機能 | CLMM | CPMM | AMM |
|---|---|---|---|
| 集中流動性 | はい | いいえ | いいえ |
| Token22 対応 | 限定的 | はい | いいえ |
| OpenBook 必須 | いいえ | いいえ | はい |
| カスタム価格帯 | はい | いいえ | いいえ |
| LP NFT ポジション | はい | いいえ | いいえ |
LaunchLab(新機能)
LaunchLab は、カスタマイズ可能なボンディングカーブにより、Solana でのトークンローンチを簡素化します。
// Create token with bonding curve via LaunchLab
const { execute } = await raydium.launchLab.createToken({
name: "My Token",
symbol: "MTK",
uri: "https://arweave.net/metadata.json",
initialSupply: 1_000_000_000n,
bondingCurve: "linear", // or "exponential"
graduationThreshold: 85_000_000_000n, // 85 SOL
txVersion: "V0",
});
const { txId } = await execute({ sendAndConfirm: true });
ボンディングカーブからの移行
トークンは、卒業しきい値(デフォルト:85 SOL)に達すると、自動的に AMM プールへ移行します。クリエイターは移行後の取引手数料の 10% を獲得します。
主なマイルストーン(2025 年)
- LaunchLab 経由で 35,000 以上 のトークンをローンチ
- オンチェーン分析用の Orb Explorer をローンチ
V3 プロトコル(近日公開)
Raydium V3 では、以下を組み合わせたハイブリッド流動性モデルが導入されます。
- OpenBook の分散型注文板を備えた AMM プール
- Solana DeFi 全体で 40% 多い流動性 へのアクセス
- LP 向けの資本効率の向上
Resources
- SDK: https://github.com/raydium-io/raydium-sdk-V2
- Demos: https://github.com/raydium-io/raydium-sdk-V2-demo
- IDL: https://github.com/raydium-io/raydium-idl
- CLMM Program: https://github.com/raydium-io/raydium-clmm
- CPMM Program: https://github.com/raydium-io/raydium-cp-swap
- AMM Program: https://github.com/raydium-io/raydium-amm
- CPI Examples: https://github.com/raydium-io/raydium-cpi
Skill Structure
raydium/
├── SKILL.md # This file - complete integration guide
├── resources/
│ ├── sdk-api-reference.md # Complete SDK API
│ ├── trade-api.md # HTTP Trade API reference
│ ├── program-ids.md # All program addresses
│ ├── pool-types.md # Pool type comparison
│ ├── launchlab.md # LaunchLab documentation
│ └── github-repos.md # GitHub repositories reference
├── examples/
│ ├── swap/README.md # Token swap examples
│ ├── clmm-pool/README.md # CLMM pool creation
│ ├── clmm-position/README.md # CLMM position management
│ ├── cpmm-pool/README.md # CPMM pool operations
│ ├── liquidity/README.md # Liquidity management
│ ├── farming/README.md # Farming and staking
│ └── launchlab/README.md # LaunchLab token launches
├── templates/
│ └── raydium-setup.ts # SDK setup template
└── docs/
├── clmm-guide.md # CLMM deep dive
└── troubleshooting.md # Common issues
GitHub Repositories
| Repository | Description |
|---|---|
| raydium-sdk-V2 | TypeScript SDK |
| raydium-sdk-V2-demo | SDK examples |
| raydium-clmm | CLMM program (Rust) |
| raydium-cp-swap | CPMM program (Rust) |
| raydium-amm | AMM V4 program (Rust) |
| raydium-cpi | CPI integration examples |
| raydium-idl | IDL definitions |