meteora-plugin

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pre-flight Dependencies (auto-injected by Plugin Store CI)

飞行前依赖项(由插件商店CI自动注入)

Run once per session before first use. These checks ensure required tools are installed.
首次使用前每个会话运行一次。这些检查确保所需工具已安装。

Version check (auto-injected)

版本检查(自动注入)

AI Agent Instruction: Run this version check before executing any commands from this skill. If an update is applied, re-read this SKILL.md before proceeding — the instructions may have changed.
bash
undefined
AI Agent指令:在执行此技能的任何命令之前运行此版本检查。如果应用了更新,请在继续前重新阅读此SKILL.md——说明可能已更改。
bash
undefined

Check for skill updates (1-hour cache)

Check for skill updates (1-hour cache)

UPDATE_CACHE="$HOME/.plugin-store/update-cache/meteora-plugin" CACHE_MAX=3600 LOCAL_VER="0.3.7" DO_CHECK=true
if [ -f "$UPDATE_CACHE" ]; then CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0) NOW=$(date +%s) AGE=$(( NOW - CACHE_MOD )) [ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false fi
if [ "$DO_CHECK" = true ]; then REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/okx/plugin-store/main/skills/meteora-plugin/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}') if [ -n "$REMOTE_VER" ]; then mkdir -p "$HOME/.plugin-store/update-cache" echo "$REMOTE_VER" > "$UPDATE_CACHE" fi fi
REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER") if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then echo "Update available: meteora-plugin v$LOCAL_VER -> v$REMOTE_VER. Updating..." npx skills add okx/plugin-store --skill meteora-plugin --yes --global 2>/dev/null || true echo "Updated meteora-plugin to v$REMOTE_VER. Please re-read this SKILL.md." fi
undefined
UPDATE_CACHE="$HOME/.plugin-store/update-cache/meteora-plugin" CACHE_MAX=3600 LOCAL_VER="0.3.7" DO_CHECK=true
if [ -f "$UPDATE_CACHE" ]; then CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0) NOW=$(date +%s) AGE=$(( NOW - CACHE_MOD )) [ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false fi
if [ "$DO_CHECK" = true ]; then REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/okx/plugin-store/main/skills/meteora-plugin/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}') if [ -n "$REMOTE_VER" ]; then mkdir -p "$HOME/.plugin-store/update-cache" echo "$REMOTE_VER" > "$UPDATE_CACHE" fi fi
REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER") if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then echo "Update available: meteora-plugin v$LOCAL_VER -> v$REMOTE_VER. Updating..." npx skills add okx/plugin-store --skill meteora-plugin --yes --global 2>/dev/null || true echo "Updated meteora-plugin to v$REMOTE_VER. Please re-read this SKILL.md." fi
undefined

Install onchainos CLI + Skills (auto-injected)

安装onchainos CLI + Skills(自动注入)

bash
undefined
bash
undefined

1. Install onchainos CLI

1. Install onchainos CLI

onchainos --version 2>/dev/null || curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh
onchainos --version 2>/dev/null || curl -fsSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh

2. Install onchainos skills (enables AI agent to use onchainos commands)

2. Install onchainos skills (enables AI agent to use onchainos commands)

npx skills add okx/onchainos-skills --yes --global
npx skills add okx/onchainos-skills --yes --global

3. Install plugin-store skills (enables plugin discovery and management)

3. Install plugin-store skills (enables plugin discovery and management)

npx skills add okx/plugin-store --skill plugin-store --yes --global
undefined
npx skills add okx/plugin-store --skill plugin-store --yes --global
undefined

Install meteora-plugin binary + launcher (auto-injected)

安装meteora-plugin二进制文件 + 启动器(自动注入)

bash
undefined
bash
undefined

Install shared infrastructure (launcher + update checker, only once)

Install shared infrastructure (launcher + update checker, only once)

LAUNCHER="$HOME/.plugin-store/launcher.sh" CHECKER="$HOME/.plugin-store/update-checker.py" if [ ! -f "$LAUNCHER" ]; then mkdir -p "$HOME/.plugin-store" curl -fsSL "https://raw.githubusercontent.com/okx/plugin-store/main/scripts/launcher.sh" -o "$LAUNCHER" 2>/dev/null || true chmod +x "$LAUNCHER" fi if [ ! -f "$CHECKER" ]; then curl -fsSL "https://raw.githubusercontent.com/okx/plugin-store/main/scripts/update-checker.py" -o "$CHECKER" 2>/dev/null || true fi
LAUNCHER="$HOME/.plugin-store/launcher.sh" CHECKER="$HOME/.plugin-store/update-checker.py" if [ ! -f "$LAUNCHER" ]; then mkdir -p "$HOME/.plugin-store" curl -fsSL "https://raw.githubusercontent.com/okx/plugin-store/main/scripts/launcher.sh" -o "$LAUNCHER" 2>/dev/null || true chmod +x "$LAUNCHER" fi if [ ! -f "$CHECKER" ]; then curl -fsSL "https://raw.githubusercontent.com/okx/plugin-store/main/scripts/update-checker.py" -o "$CHECKER" 2>/dev/null || true fi

Clean up old installation

Clean up old installation

rm -f "$HOME/.local/bin/meteora-plugin" "$HOME/.local/bin/.meteora-plugin-core" 2>/dev/null
rm -f "$HOME/.local/bin/meteora-plugin" "$HOME/.local/bin/.meteora-plugin-core" 2>/dev/null

Download binary

Download binary

OS=$(uname -s | tr A-Z a-z) ARCH=$(uname -m) EXT="" case "${OS}_${ARCH}" in darwin_arm64) TARGET="aarch64-apple-darwin" ;; darwin_x86_64) TARGET="x86_64-apple-darwin" ;; linux_x86_64) TARGET="x86_64-unknown-linux-musl" ;; linux_i686) TARGET="i686-unknown-linux-musl" ;; linux_aarch64) TARGET="aarch64-unknown-linux-musl" ;; linux_armv7l) TARGET="armv7-unknown-linux-musleabihf" ;; mingw_x86_64|msys_x86_64|cygwin_x86_64) TARGET="x86_64-pc-windows-msvc"; EXT=".exe" ;; mingw_i686|msys_i686|cygwin_i686) TARGET="i686-pc-windows-msvc"; EXT=".exe" ;; mingw_aarch64|msys_aarch64|cygwin*_aarch64) TARGET="aarch64-pc-windows-msvc"; EXT=".exe" ;; esac mkdir -p ~/.local/bin curl -fsSL "https://github.com/okx/plugin-store/releases/download/plugins/meteora-plugin@0.3.7/meteora-plugin-${TARGET}${EXT}" -o ~/.local/bin/.meteora-plugin-core${EXT} chmod +x ~/.local/bin/.meteora-plugin-core${EXT}
OS=$(uname -s | tr A-Z a-z) ARCH=$(uname -m) EXT="" case "${OS}_${ARCH}" in darwin_arm64) TARGET="aarch64-apple-darwin" ;; darwin_x86_64) TARGET="x86_64-apple-darwin" ;; linux_x86_64) TARGET="x86_64-unknown-linux-musl" ;; linux_i686) TARGET="i686-unknown-linux-musl" ;; linux_aarch64) TARGET="aarch64-unknown-linux-musl" ;; linux_armv7l) TARGET="armv7-unknown-linux-musleabihf" ;; mingw_x86_64|msys_x86_64|cygwin_x86_64) TARGET="x86_64-pc-windows-msvc"; EXT=".exe" ;; mingw_i686|msys_i686|cygwin_i686) TARGET="i686-pc-windows-msvc"; EXT=".exe" ;; mingw_aarch64|msys_aarch64|cygwin*_aarch64) TARGET="aarch64-pc-windows-msvc"; EXT=".exe" ;; esac mkdir -p ~/.local/bin curl -fsSL "https://github.com/okx/plugin-store/releases/download/plugins/meteora-plugin@0.3.7/meteora-plugin-${TARGET}${EXT}" -o ~/.local/bin/.meteora-plugin-core${EXT} chmod +x ~/.local/bin/.meteora-plugin-core${EXT}

Symlink CLI name to universal launcher

Symlink CLI name to universal launcher

ln -sf "$LAUNCHER" ~/.local/bin/meteora-plugin
ln -sf "$LAUNCHER" ~/.local/bin/meteora-plugin

Register version

Register version

mkdir -p "$HOME/.plugin-store/managed" echo "0.3.7" > "$HOME/.plugin-store/managed/meteora-plugin"
undefined
mkdir -p "$HOME/.plugin-store/managed" echo "0.3.7" > "$HOME/.plugin-store/managed/meteora-plugin"
undefined

Report install (auto-injected, runs once)

报告安装情况(自动注入,仅运行一次)

bash
REPORT_FLAG="$HOME/.plugin-store/reported/meteora-plugin"
if [ ! -f "$REPORT_FLAG" ]; then
  mkdir -p "$HOME/.plugin-store/reported"
  # Device fingerprint → SHA256 → 32-char device ID
  DEV_RAW="$(hostname):$(uname -s):$(uname -m):$HOME"
  DEV_ID=$(echo -n "$DEV_RAW" | shasum -a 256 | head -c 32)
  # HMAC signature (obfuscated key, same as CLI binary)
  _K=$(echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d 2>/dev/null || echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | openssl base64 -d)
  HMAC_SIG=$(echo -n "${_K}${DEV_ID}" | shasum -a 256 | head -c 8)
  DIV_ID="${DEV_ID}${HMAC_SIG}"
  unset _K
  # Report to Vercel stats
  curl -s -X POST "https://plugin-store-dun.vercel.app/install" \
    -H "Content-Type: application/json" \
    -d '{"name":"meteora-plugin","version":"0.3.7"}' >/dev/null 2>&1 || true
  # Report to OKX API (with HMAC-signed device token)
  curl -s -X POST "https://www.okx.com/priapi/v1/wallet/plugins/download/report" \
    -H "Content-Type: application/json" \
    -d '{"pluginName":"meteora-plugin","divId":"'"$DIV_ID"'"}' >/dev/null 2>&1 || true
  touch "$REPORT_FLAG"
fi

bash
REPORT_FLAG="$HOME/.plugin-store/reported/meteora-plugin"
if [ ! -f "$REPORT_FLAG" ]; then
  mkdir -p "$HOME/.plugin-store/reported"
  # Device fingerprint → SHA256 → 32-char device ID
  DEV_RAW="$(hostname):$(uname -s):$(uname -m):$HOME"
  DEV_ID=$(echo -n "$DEV_RAW" | shasum -a 256 | head -c 32)
  # HMAC signature (obfuscated key, same as CLI binary)
  _K=$(echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | base64 -d 2>/dev/null || echo 'OE9nNWFRUFdfSVJkektrMExOV2RNeTIzV2JibXo3ZWNTbExJUDFIWnVoZw==' | openssl base64 -d)
  HMAC_SIG=$(echo -n "${_K}${DEV_ID}" | shasum -a 256 | head -c 8)
  DIV_ID="${DEV_ID}${HMAC_SIG}"
  unset _K
  # Report to Vercel stats
  curl -s -X POST "https://plugin-store-dun.vercel.app/install" \
    -H "Content-Type: application/json" \
    -d '{"name":"meteora-plugin","version":"0.3.7"}' >/dev/null 2>&1 || true
  # Report to OKX API (with HMAC-signed device token)
  curl -s -X POST "https://www.okx.com/priapi/v1/wallet/plugins/download/report" \
    -H "Content-Type: application/json" \
    -d '{"pluginName":"meteora-plugin","divId":"'"$DIV_ID"'"}' >/dev/null 2>&1 || true
  touch "$REPORT_FLAG"
fi

Architecture

架构

  • Read operations (
    get-pools
    ,
    get-pool-detail
    ,
    get-swap-quote
    ) → direct REST API calls to
    https://dlmm.datapi.meteora.ag
    ; no wallet or confirmation needed
  • get-user-positions
    → queries on-chain via Solana
    getProgramAccounts
    + BinArray accounts; computes token amounts directly from chain state; no wallet or confirmation needed
  • Swap (
    swap
    ) → after user confirmation, executes via
    onchainos swap execute --chain solana
    ; CLI handles signing and broadcast automatically
  • Add liquidity (
    add-liquidity
    ) → builds a Solana transaction natively in Rust (initialize position + add liquidity instructions), submits via
    onchainos wallet contract-call --chain 501
    ; uses SpotBalanced strategy distributing tokens across 70-bin position centered at active bin; auto-wraps SOL to WSOL when needed; retries once on simulation errors
  • Remove liquidity (
    remove-liquidity
    ) → builds
    removeLiquidityByRange
    + optional
    claimFee
    +
    closePositionIfEmpty
    instructions, submits via
    onchainos wallet contract-call --chain 501
    ; 600k compute budget requested
  • 读取操作
    get-pools
    get-pool-detail
    get-swap-quote
    )→ 直接向
    https://dlmm.datapi.meteora.ag
    发起REST API调用;无需钱包或确认
  • get-user-positions
    → 通过Solana
    getProgramAccounts
    + BinArray账户查询链上数据;直接从链上状态计算代币数量;无需钱包或确认
  • 兑换
    swap
    )→ 用户确认后,通过
    onchainos swap execute --chain solana
    执行;CLI自动处理签名和广播
  • 添加流动性
    add-liquidity
    )→ 在Rust中原生构建Solana交易(初始化仓位 + 添加流动性指令),通过
    onchainos wallet contract-call --chain 501
    提交;采用SpotBalanced策略,将代币分配到以活跃仓位为中心的70-bin区间;必要时自动将SOL包装为WSOL;模拟出错时重试一次
  • 移除流动性
    remove-liquidity
    )→ 构建
    removeLiquidityByRange
    + 可选
    claimFee
    +
    closePositionIfEmpty
    指令,通过
    onchainos wallet contract-call --chain 501
    提交;申请600k计算预算

Supported Operations

支持的操作

get-pools — List liquidity pools

get-pools — 列出流动性池

Search and list Meteora DLMM pools. Supports filtering by token pair, sorting by TVL, APY, volume, and fee/TVL ratio.
meteora get-pools [--page <n>] [--page-size <n>] [--sort-key tvl|volume|apr|fee_tvl_ratio] [--order-by asc|desc] [--search-term <token_symbol_or_address>]
Examples:
meteora get-pools --search-term SOL-USDC --sort-key tvl --order-by desc
meteora get-pools --sort-key apr --order-by desc --page-size 5

搜索并列出Meteora DLMM池。支持按代币对过滤,按TVL、APY、交易量和手续费/TVL比率排序。
meteora get-pools [--page <n>] [--page-size <n>] [--sort-key tvl|volume|apr|fee_tvl_ratio] [--order-by asc|desc] [--search-term <token_symbol_or_address>]
示例:
meteora get-pools --search-term SOL-USDC --sort-key tvl --order-by desc
meteora get-pools --sort-key apr --order-by desc --page-size 5

get-pool-detail — Get pool details

get-pool-detail — 获取池详情

Retrieve full details for a specific DLMM pool: configuration, TVL, fee structure, reserves, APY.
meteora get-pool-detail --address <pool_address>
Example:
meteora get-pool-detail --address 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6

检索特定DLMM池的完整详情:配置、TVL、手续费结构、储备金、APY。
meteora get-pool-detail --address <pool_address>
示例:
meteora get-pool-detail --address 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6

get-swap-quote — Get swap quote

get-swap-quote — 获取兑换报价

Get an estimated swap quote for a token pair using the onchainos DEX aggregator on Solana.
meteora get-swap-quote --from-token <mint> --to-token <mint> --amount <readable_amount>
Output fields:
from_token
,
from_symbol
,
to_token
,
to_symbol
,
from_amount_readable
,
from_amount_raw
,
to_amount_readable
(human-readable, e.g.
"84.132157"
),
to_amount_raw
,
price_impact_pct
,
price_impact_warning
Examples:
meteora get-swap-quote --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0

使用Solana上的onchainos DEX聚合器获取代币对的预估兑换报价。
meteora get-swap-quote --from-token <mint> --to-token <mint> --amount <readable_amount>
输出字段:
from_token
from_symbol
to_token
to_symbol
from_amount_readable
from_amount_raw
to_amount_readable
(人类可读格式,例如
"84.132157"
)、
to_amount_raw
price_impact_pct
price_impact_warning
示例:
meteora get-swap-quote --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0

get-user-positions — View LP positions

get-user-positions — 查看LP仓位

View a user's DLMM LP positions with token amounts computed from on-chain BinArray data.
meteora get-user-positions [--wallet <address>] [--pool <pool_address>]
If
--wallet
is omitted, uses the currently logged-in onchainos wallet.
Output fields per position:
position_address
,
pool_address
,
owner
,
token_x_mint
,
token_y_mint
,
token_x_amount
,
token_y_amount
,
token_x_decimals
,
token_y_decimals
,
bin_range
(lower_bin_id / upper_bin_id),
active_bins
,
source
Use
position_address
directly as
--position
when calling
remove-liquidity
.
Examples:
meteora get-user-positions
meteora get-user-positions --wallet GbE9k66MjLRQC7RnMCkRuSgHi3Lc8LJQXWdCmYFtGo2
meteora get-user-positions --pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6

查看用户的DLMM LP仓位,代币数量从链上BinArray数据计算得出。
meteora get-user-positions [--wallet <address>] [--pool <pool_address>]
如果省略
--wallet
,则使用当前登录的onchainos钱包。
每个仓位的输出字段:
position_address
pool_address
owner
token_x_mint
token_y_mint
token_x_amount
token_y_amount
token_x_decimals
token_y_decimals
bin_range
(lower_bin_id / upper_bin_id)、
active_bins
source
调用
remove-liquidity
时,直接使用
position_address
作为
--position
参数。
示例:
meteora get-user-positions
meteora get-user-positions --wallet GbE9k66MjLRQC7RnMCkRuSgHi3Lc8LJQXWdCmYFtGo2
meteora get-user-positions --pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6

swap — Execute a token swap

swap — 执行代币兑换

Execute a token swap on Solana via the onchainos DEX aggregator. Supports dry run mode.
meteora swap --from-token <mint> --to-token <mint> --amount <readable_amount> [--slippage <pct>] [--wallet <address>] [--dry-run]
Execution Flow:
  1. Run with
    --dry-run
    to preview the quote — outputs
    estimated_output
    (human-readable),
    estimated_output_raw
    ,
    price_impact_pct
  2. Ask user to confirm the swap details (from/to tokens, amount, estimated output, slippage)
  3. Execute after explicit user approval:
    meteora swap --from-token ... --to-token ... --amount ...
  4. Report transaction hash and Solscan link
Examples:
undefined
通过onchainos DEX聚合器在Solana上执行代币兑换。支持试运行模式。
meteora swap --from-token <mint> --to-token <mint> --amount <readable_amount> [--slippage <pct>] [--wallet <address>] [--dry-run]
执行流程:
  1. 使用
    --dry-run
    运行以预览报价——输出
    estimated_output
    (人类可读格式)、
    estimated_output_raw
    price_impact_pct
  2. 请求用户确认兑换详情(转出/转入代币、数量、预估输出、滑点)
  3. 用户明确批准后执行:
    meteora swap --from-token ... --to-token ... --amount ...
  4. 报告交易哈希和Solscan链接
示例:
undefined

Preview swap (dry run)

预览兑换(试运行)

meteora --dry-run swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0
meteora --dry-run swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0

Execute swap (after user confirmation)

执行兑换(用户确认后)

meteora swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0 --slippage 0.5

**Risk warnings:**
- Price impact > 5%: warning displayed, recommend splitting the trade
- APY > 50% on a pool: high-risk warning displayed

---
meteora swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0 --slippage 0.5

**风险提示:**
- 价格影响>5%:显示警告,建议拆分交易
- 池APY>50%:显示高风险警告

---

add-liquidity — Add liquidity to a DLMM pool

add-liquidity — 向DLMM池添加流动性

Add liquidity to a Meteora DLMM pool using the SpotBalanced strategy. Creates a new position (width=70 bins, centered at the active bin) if one doesn't exist, and deposits token X and/or token Y into the specified bin range.
meteora add-liquidity --pool <pool_address> [--amount-x <float>] [--amount-y <float>] [--bin-range <n>] [--wallet <address>] [--dry-run]
Parameters:
  • --pool
    — DLMM pool (LbPair) address (required)
  • --amount-x
    — Amount of token X to deposit in human-readable units, e.g.
    0.01
    (default: 0)
  • --amount-y
    — Amount of token Y to deposit in human-readable units, e.g.
    1.5
    (default: 0)
  • --bin-range
    — Half-range in bins around the active bin for liquidity distribution; max 34 (default: 10)
  • --wallet
    — Wallet address; omit to use the onchainos logged-in wallet
  • --dry-run
    — Preview only; no transaction submitted
Output fields:
ok
,
pool
,
wallet
,
position
,
amount_x
,
amount_y
,
tx_hash
,
explorer_url
Execution Flow:
  1. Run with
    --dry-run
    to preview: shows position PDA, bin range, token accounts, estimated transaction
  2. Ask user to confirm token amounts, pool, and that they understand liquidity provisioning risk
  3. Execute after explicit user approval:
    meteora add-liquidity --pool <addr> --amount-x ... --amount-y ...
  4. If position doesn't exist, it is initialized in the same transaction (requires ~0.06 SOL for rent)
  5. Report position PDA and Solscan link
Notes:
  • Position is always 70 bins wide (MAX_BIN_PER_POSITION), centered at the current active bin
  • The wallet needs ~0.06 SOL for position account rent when creating a new position
  • Liquidity distribution uses SpotBalanced strategy (proportional to current pool ratio)
  • Both token amounts are maximums; actual deposited may be less depending on pool ratio
Examples:
undefined
使用SpotBalanced策略向Meteora DLMM池添加流动性。如果仓位不存在,则创建新仓位(宽度=70个bin,以活跃仓位为中心),并将代币X和/或代币Y存入指定的bin区间。
meteora add-liquidity --pool <pool_address> [--amount-x <float>] [--amount-y <float>] [--bin-range <n>] [--wallet <address>] [--dry-run]
参数:
  • --pool
    — DLMM池(LbPair)地址(必填)
  • --amount-x
    — 存入的代币X数量(人类可读单位,例如
    0.01
    ,默认值:0)
  • --amount-y
    — 存入的代币Y数量(人类可读单位,例如
    1.5
    ,默认值:0)
  • --bin-range
    — 围绕活跃仓位的流动性分配半区间(bin数量);最大34(默认值:10)
  • --wallet
    — 钱包地址;省略则使用登录的onchainos钱包
  • --dry-run
    — 仅预览;不提交交易
输出字段:
ok
pool
wallet
position
amount_x
amount_y
tx_hash
explorer_url
执行流程:
  1. 使用
    --dry-run
    运行以预览:显示仓位PDA、bin区间、代币账户、预估交易
  2. 请求用户确认代币数量、池信息,并确认了解流动性提供风险
  3. 用户明确批准后执行:
    meteora add-liquidity --pool <addr> --amount-x ... --amount-y ...
  4. 如果仓位不存在,将在同一交易中初始化(需要约0.06 SOL作为租金)
  5. 报告仓位PDA和Solscan链接
注意事项:
  • 仓位宽度始终为70个bin(MAX_BIN_PER_POSITION),以当前活跃仓位为中心
  • 创建新仓位时,钱包需要约0.06 SOL作为仓位账户租金
  • 流动性分配采用SpotBalanced策略(与当前池比率成比例)
  • 两个代币数量均为最大值;实际存入数量可能根据池比率减少
示例:
undefined

Preview adding liquidity to JitoSOL-USDC pool

预览向JitoSOL-USDC池添加流动性

meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5 --dry-run
meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5 --dry-run

Execute (after user confirmation)

执行(用户确认后)

meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5
meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5

Narrow range (5 bins each side instead of default 10)

缩小区间(每侧5个bin,而非默认10个)

meteora add-liquidity --pool <addr> --amount-x 0.1 --amount-y 10 --bin-range 5

---
meteora add-liquidity --pool <addr> --amount-x 0.1 --amount-y 10 --bin-range 5

---

remove-liquidity — Remove liquidity from a DLMM position

remove-liquidity — 从DLMM仓位移除流动性

Remove some or all liquidity from an existing Meteora DLMM position. Optionally close the position account afterwards to reclaim rent (~0.057 SOL).
meteora remove-liquidity --pool <pool_address> --position <position_address> [--pct <1-100>] [--close] [--wallet <address>] [--dry-run]
Parameters:
  • --pool
    — DLMM pool (LbPair) address (required)
  • --position
    — Position PDA address; obtain from
    get-user-positions
    output (required)
  • --pct
    — Percentage of liquidity to remove, 1–100 (default: 100)
  • --close
    — Close the position account after full removal (100%) to reclaim ~0.057 SOL rent
  • --wallet
    — Wallet address; omit to use the onchainos logged-in wallet
  • --dry-run
    — Preview only; no transaction submitted
Output fields:
ok
,
pool
,
position
,
wallet
,
pct_removed
,
position_closed
,
tx_hash
,
explorer_url
Use
position_address
from
get-user-positions
output directly as
--position
.
Execution Flow:
  1. Run with
    --dry-run
    to preview: shows bin range, token accounts, and whether the position will be closed
  2. Ask user to confirm — especially if
    --close
    is used (permanent, reclaims rent)
  3. Execute after explicit user approval
  4. Token X and token Y are returned to the wallet's associated token accounts (created on-chain if missing)
  5. If
    --close
    is set and
    --pct 100
    , the position account is closed and ~0.057 SOL is returned
Notes:
  • Attempting to remove from an empty position without
    --close
    returns
    "ok": false
    with a helpful tip; no on-chain call is made
  • --close
    only takes effect when
    --pct 100
    (full removal); partial removals cannot close the position
  • If the position is already empty (liquidity withdrawn) and
    --close
    is set, the binary automatically claims any pending fees (
    claim_fee
    ) then closes the account (
    close_position_if_empty
    ) in a single transaction, reclaiming rent
Examples:
undefined
从现有Meteora DLMM仓位移除部分或全部流动性。可选在之后关闭仓位账户以收回租金(约0.057 SOL)。
meteora remove-liquidity --pool <pool_address> --position <position_address> [--pct <1-100>] [--close] [--wallet <address>] [--dry-run]
参数:
  • --pool
    — DLMM池(LbPair)地址(必填)
  • --position
    — 仓位PDA地址;从
    get-user-positions
    输出获取(必填)
  • --pct
    — 要移除的流动性百分比,1–100(默认值:100)
  • --close
    — 完全移除(100%)后关闭仓位账户以收回约0.057 SOL租金
  • --wallet
    — 钱包地址;省略则使用登录的onchainos钱包
  • --dry-run
    — 仅预览;不提交交易
输出字段:
ok
pool
position
wallet
pct_removed
position_closed
tx_hash
explorer_url
直接使用
get-user-positions
输出中的
position_address
作为
--position
参数。
执行流程:
  1. 使用
    --dry-run
    运行以预览:显示bin区间、代币账户,以及仓位是否会被关闭
  2. 请求用户确认——尤其是使用
    --close
    时(永久性操作,收回租金)
  3. 用户明确批准后执行
  4. 代币X和代币Y将返回至钱包的关联代币账户(如果不存在则在链上创建)
  5. 如果设置了
    --close
    --pct 100
    ,仓位账户将被关闭并返回约0.057 SOL
注意事项:
  • 尝试从空仓位移除流动性且未使用
    --close
    时,返回
    "ok": false
    并显示提示信息;不会发起链上调用
  • --close
    仅在
    --pct 100
    (完全移除)时生效;部分移除无法关闭仓位
  • 如果仓位已空(流动性已提取)且设置了
    --close
    ,二进制文件将自动在单个交易中领取所有待处理手续费(
    claim_fee
    )然后关闭账户(
    close_position_if_empty
    ),收回租金
示例:
undefined

Preview removing all liquidity from a position

预览从仓位移除所有流动性

meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --dry-run
meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --dry-run

Remove 50% of liquidity

移除50%流动性

meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --pct 50
meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --pct 50

Remove all liquidity and close the position (reclaims rent)

移除所有流动性并关闭仓位(收回租金)

meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --close

---
meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --close

---

quickstart — Check wallet balances and get a recommended deposit command

quickstart — 检查钱包余额并获取推荐的存入命令

Check your SOL and USDC balances against the current pool state and receive a ready-to-run
add-liquidity
command based on what you can afford.
meteora quickstart --pool <pool_address> [--wallet <address>]
Parameters:
  • --pool
    — DLMM pool (LbPair) address (required)
  • --wallet
    — Wallet address; omit to use the onchainos logged-in wallet
Output fields:
ok
,
wallet
,
pool
,
sol_balance
,
usdc_balance
,
active_id
,
bin_step
,
token_x_mint
,
token_y_mint
,
suggestion
(one of
two_sided
/
x_only
/
y_only
/
insufficient_funds
),
recommended_command
Execution Flow:
  1. Reads SOL and USDC balances from the logged-in wallet
  2. Fetches current pool state to determine active bin and token pair
  3. Computes the maximum deposit amounts affordable with current balances
  4. Returns a ready-to-run
    add-liquidity
    command
Example:
meteora quickstart --pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6

根据当前池状态检查你的SOL和USDC余额,并根据你的可承受额度返回可直接运行的
add-liquidity
命令。
meteora quickstart --pool <pool_address> [--wallet <address>]
参数:
  • --pool
    — DLMM池(LbPair)地址(必填)
  • --wallet
    — 钱包地址;省略则使用登录的onchainos钱包
输出字段:
ok
wallet
pool
sol_balance
usdc_balance
active_id
bin_step
token_x_mint
token_y_mint
suggestion
two_sided
/
x_only
/
y_only
/
insufficient_funds
之一)、
recommended_command
执行流程:
  1. 从登录钱包读取SOL和USDC余额
  2. 获取当前池状态以确定活跃bin和代币对
  3. 计算当前余额可承受的最大存入金额
  4. 返回可直接运行的
    add-liquidity
    命令
示例:
meteora quickstart --pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6

Token Addresses (Solana Mainnet)

代币地址(Solana主网)

TokenMint Address
SOL (native)
11111111111111111111111111111111
Wrapped SOL
So11111111111111111111111111111111111111112
USDC
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
USDT
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB

代币Mint地址
SOL(原生)
11111111111111111111111111111111
Wrapped SOL
So11111111111111111111111111111111111111112
USDC
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
USDT
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB

Typical User Scenarios

典型用户场景

Scenario 1: Swap SOL for USDC on Meteora

场景1:在Meteora上将SOL兑换为USDC

undefined
undefined

Step 1: Find best SOL-USDC pool

Step 1: 找到最佳SOL-USDC池

meteora get-pools --search-term SOL-USDC --sort-key tvl --order-by desc --page-size 3
meteora get-pools --search-term SOL-USDC --sort-key tvl --order-by desc --page-size 3

Step 2: Get swap quote

Step 2: 获取兑换报价

meteora get-swap-quote --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0
meteora get-swap-quote --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0

Step 3: Preview swap (dry run)

Step 3: 预览兑换(试运行)

meteora --dry-run swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0
meteora --dry-run swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0

Step 4: Ask user to confirm, then execute

Step 4: 请求用户确认,然后执行

meteora swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0 --slippage 0.5
undefined
meteora swap --from-token So11111111111111111111111111111111111111112 --to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --amount 1.0 --slippage 0.5
undefined

Scenario 2: Check LP positions

场景2:检查LP仓位

undefined
undefined

View all positions for logged-in wallet

查看登录钱包的所有仓位

meteora get-user-positions
meteora get-user-positions

Filter by specific pool

按特定池过滤

meteora get-user-positions --pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6
undefined
meteora get-user-positions --pool 5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6
undefined

Scenario 3: Find high-yield pools

场景3:寻找高收益池

undefined
undefined

Top pools by APY

按APY排序的顶级池

meteora get-pools --sort-key apr --order-by desc --page-size 10
undefined
meteora get-pools --sort-key apr --order-by desc --page-size 10
undefined

Scenario 4: Add liquidity to a pool

场景4:向池添加流动性

undefined
undefined

Step 1: Find the pool

Step 1: 找到池

meteora get-pools --search-term JitoSOL-USDC --sort-key tvl --order-by desc --page-size 3
meteora get-pools --search-term JitoSOL-USDC --sort-key tvl --order-by desc --page-size 3

Step 2: Preview the liquidity position

Step 2: 预览流动性仓位

meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5 --dry-run
meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5 --dry-run

Step 3: Ask user to confirm, then execute

Step 3: 请求用户确认,然后执行

meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5
undefined
meteora add-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --amount-x 0.01 --amount-y 1.5
undefined

Scenario 5: Remove liquidity from a position

场景5:从仓位移除流动性

undefined
undefined

Step 1: Find your positions

Step 1: 找到你的仓位

meteora get-user-positions
meteora get-user-positions

Step 2: Preview removal (dry run)

Step 2: 预览移除操作(试运行)

meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --dry-run
meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --dry-run

Step 3: Ask user to confirm, then remove all and close position

Step 3: 请求用户确认,然后移除所有流动性并关闭仓位

meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --close
undefined
meteora remove-liquidity --pool 8skykrYgFFpQNMhqhKbZoVKXFss55uGPUXhVMfnCzqJv --position <position_addr> --close
undefined