← 返回
开发者工具 Key 中文

Mi Trading

Trade tokens on Solana using the ClawDex CLI. Use when the user asks to swap tokens, check balances, get quotes, or manage a Solana trading wallet.
使用 ClawDex CLI 在 Solana 上交易代币。适用于用户请求兑换代币、查询余额、获取报价或管理 Solana 交易钱包。
davidpolotm
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 955
下载
💾 5
安装
1
版本
#latest

概述

ClawDex — Solana DEX Trading Skill

Trade any Solana token through Jupiter aggregator with simulation, safety guardrails, and full JSON output.

Prerequisites

Before using this skill, ensure ClawDex is installed and configured:

which clawdex || npm install -g clawdex@latest

If not configured yet, run onboarding:

clawdex status --json

If status fails, set up with:

clawdex onboarding \
  --jupiter-api-key "$JUPITER_API_KEY" \
  --rpc "${SOLANA_RPC_URL:-https://api.mainnet-beta.solana.com}" \
  --wallet ~/.config/solana/id.json \
  --json

Commands

Check wallet balances

clawdex balances --json

Returns an array of { token, symbol, mint, balance, decimals } objects. Zero-balance accounts are included in JSON output.

Get a quote (no execution)

clawdex quote --in SOL --out USDC --amount 0.01 --json

Lightweight price check — no simulation, no wallet needed.

Simulate a swap (dry run)

clawdex swap --in SOL --out USDC --amount 0.01 --simulate-only --json

Runs full simulation on-chain without broadcasting. Does not require --yes. Use this to preview the output amount and route before committing.

Execute a swap

clawdex swap --in SOL --out USDC --amount 0.01 --yes --json

--yes is required for non-interactive execution. Without it, ClawDex exits with code 1.

Health check

clawdex status --json

Verify RPC connectivity, wallet validity, and config state.

Trading Workflow

Always follow this sequence:

  1. Health checkclawdex status --json — abort if rpc.healthy is false
  2. Check balancesclawdex balances --json — verify sufficient funds
  3. Simulateclawdex swap --simulate-only --json — preview the trade
  4. Executeclawdex swap --yes --json — only if simulation looks good
  5. Verifyclawdex balances --json — confirm balances updated (may need 5s delay on public RPC)

Token Specification

Tokens can be passed by symbol or mint address:

  • By symbol: SOL, USDC, USDT
  • By mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

Exit Codes

CodeMeaningAgent action
----------------------------
0SuccessContinue
1General errorCheck message
2Config errorRun onboarding
3Safety violationReduce amount or adjust limits
4Simulation failedTry different pair/amount
5Send failedRetry with backoff

Safety

Set guardrails to prevent runaway trades:

clawdex safety set max_slippage_bps=300 max_trade_sol=1 max_price_impact_bps=100

When a guardrail triggers, the JSON response includes a violations array describing what failed.

Important Rules

  • Always use --json for machine-parseable output
  • Always use --yes for real swaps (not needed for --simulate-only)
  • Never skip simulation unless you have a good reason — use --simulate-only first
  • Parse balance as a string, not a number — it preserves full decimal precision
  • Check exit codes — non-zero means the trade did not succeed
  • Wait before verifying — RPC balance reads can lag a few seconds after a swap

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 06:46 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,337
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 671 📥 324,353
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,822