返回顶部
c

clawdexClawDex交易工具

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.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
687
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

clawdex

ClawDex — Solana DEX 交易技能

通过 Jupiter 聚合器交易任意 Solana 代币,支持模拟、安全护栏和完整 JSON 输出。

前置条件

使用此技能前,请确保 ClawDex 已安装并配置:

bash
which clawdex || npm install -g clawdex@latest

如果尚未配置,请运行初始化:
bash
clawdex status --json

如果状态检查失败,请通过以下命令进行设置:
bash
clawdex onboarding \
--jupiter-api-key $JUPITERAPIKEY \
--rpc ${SOLANARPCURL:-https://api.mainnet-beta.solana.com} \
--wallet ~/.config/solana/id.json \
--json

命令

查看钱包余额

bash
clawdex balances --json

返回 { token, symbol, mint, balance, decimals } 对象数组。零余额账户也会包含在 JSON 输出中。

获取报价(不执行)

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

轻量级价格查询——无需模拟,无需钱包。

模拟兑换(试运行)

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

在链上执行完整模拟但不广播。不需要 --yes 参数。在正式执行前,使用此命令预览输出金额和路由。

执行兑换

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

--yes 参数是必需的,用于非交互式执行。如果不加此参数,ClawDex 将以退出码 1 退出。

健康检查

bash
clawdex status --json

验证 RPC 连接、钱包有效性和配置状态。

交易流程

始终遵循以下顺序:

  1. 1. 健康检查 — clawdex status --json — 如果 rpc.healthy 为 false 则中止
  2. 检查余额 — clawdex balances --json — 确认资金充足
  3. 模拟 — clawdex swap --simulate-only --json — 预览交易
  4. 执行 — clawdex swap --yes --json — 仅在模拟结果良好时执行
  5. 验证 — clawdex balances --json — 确认余额已更新(公共 RPC 可能需要 5 秒延迟)

代币规范

代币可通过符号或铸币地址传入:

  • - 按符号:SOL、USDC、USDT
  • 按铸币地址:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

退出码

代码含义代理操作
0成功继续
1
一般错误 | 检查消息 | | 2 | 配置错误 | 运行初始化 | | 3 | 安全违规 | 减少金额或调整限制 | | 4 | 模拟失败 | 尝试不同的交易对/金额 | | 5 | 发送失败 | 重试(带退避) |

安全

设置护栏以防止失控交易:
bash
clawdex safety set maxslippagebps=300 maxtradesol=1 maxpriceimpact_bps=100

当护栏被触发时,JSON 响应将包含一个 violations 数组,描述失败原因。

重要规则

  • - 始终使用 --json 以获得机器可解析的输出
  • 始终使用 --yes 进行真实兑换(--simulate-only 不需要)
  • 切勿跳过模拟,除非有充分理由——先使用 --simulate-only
  • 将 balance 解析为字符串,而非数字——以保留完整的小数精度
  • 检查退出码——非零表示交易未成功
  • 等待后再验证——RPC 余额读取在兑换后可能延迟几秒

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 clawdex-trading-1776419971 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 clawdex-trading-1776419971 技能

通过命令行安装

skillhub install clawdex-trading-1776419971

下载

⬇ 下载 clawdex v1.0.0(免费)

文件大小: 2.28 KB | 发布时间: 2026-4-17 18:17

v1.0.0 最新 2026-4-17 18:17
Initial release of clawdex-trading skill.

- Enables token trading, quoting, and balance checks on Solana using the ClawDex CLI.
- Provides clear workflow and safety guardrails for swaps, including simulation before execution.
- Full JSON output supported for all commands for reliable parsing.
- Supports both token symbols and mint addresses for specification.
- Includes detailed error codes and recommendations for safe usage.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部