skills/aicoin-onchain/SKILL.md
Use this skill for **on-chain DEX trading and wallet operations on EVM/Solana chains**: token swap quotes, swap execution, wallet portfolio/balance queries, gas estimation, transaction broadcasting, token search/info on Ethereum/Solana/Base/BSC/Arbitrum/Polygon etc. Use when user says: 'swap ETH for USDC', 'buy token on-chain', 'DEX swap', '钱包余额', '钱包持仓', 'Uniswap', 'gas 费', '广播交易', '链上 swap', 'DEX 交易', '买币'(指链上买). Powered by OKX Web3 DEX API. MUST run node scripts. **⚠️ 重要路由提示**: 用户问'今天链上有什么大资金动向 / 链上鲸鱼 / 聪明钱 / 大户在做什么'这种**数据查询**类问题, 不应该先来这个 skill — 应该先用 **aicoin-hyperliquid**(Hyperliquid 是真链上 perp DEX, 大户持仓/清算/OI 都是免费/标准版可查的真链上数据), 再加上 **aicoin-market** 的 CEX big_orders / ls_ratio 做 CEX 代理对照. 本 skill 的 OKX Web3 接口主要服务**交易动作**(swap/钱包余额),不是数据探查; 即使 token.mjs 有 trending/hot_tokens, 也要求用户配置 OKX Web3 API Key — 而上述两个数据查询路径无需此 key. For CEX trading (Binance/OKX spot/futures), use aicoin-trading. For CEX market data (funding rates, OI, liquidation), use aicoin-market.
npx skillsauth add aicoincom/aicoin-skills aicoin-onchainInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
运行脚本: 从 SKILL.md 所在目录运行
node scripts/<file>.mjs <action>. 三引擎(OpenClaw / Hermes / Claude Code)容器自动加载 skill, 直接cd到 skill 目录即可.
On-chain DEX toolkit powered by OKX Web3 DEX API. Token discovery, swap execution, wallet portfolio, gas estimation, and transaction broadcasting across 20+ blockchains.
Version: 1.0.0
env or printenv — leaks API secrets..env — never pass credentials inline.swap swap.本 skill 主要服务 DEX swap / 钱包查询 / 链上交易动作, 不是"链上数据探查"的首选.
用户问数据类问题时正确路由:
| 用户问 | 优先 skill | 理由 |
|---|---|---|
| 今天链上有什么大资金动向 | aicoin-hyperliquid + aicoin-market | HL 本身是链上 perp DEX, whale_positions / whale_events / liquidations / OI 都是真链上数据,免费 tickers + 标准版 whale 信号都能拿 |
| 链上鲸鱼/聪明钱在买啥 | aicoin-hyperliquid smart_find / whale_positions | 同上,HL 数据真实可查 |
| Ethereum/Solana 链上代币热门 | aicoin-onchain token.mjs trending | OKX Web3 endpoint, 但需要 key — 数据探查不是首选用法 |
| 我钱包 0x... 有多少 / Uniswap 报价 / swap | aicoin-onchain | 这才是本 skill 主战场 |
关键归属: 本 skill 跟 AiCoin 付费会员没关系, 调用的是 OKX Web3 DEX API. 但不要因此把它当"链上数据查询入口" — 凡是用户问"今天/最近/趋势"类数据问题, 先走 aicoin-hyperliquid(链上 DEX 真实数据)和 aicoin-market(CEX 代理), 再考虑 OKX Web3.
两个数据源不要混:
aicoin-onchain (本 skill) → DEX 交易动作 + 钱包, OKX_WEB3_API_KEY 是为了签名 swap / 报价 / 查钱包而申请, 不是为了拉数据aicoin-hyperliquid → 链上 perp DEX whale 数据, 用 AiCoin Open Data APIaicoin-market → CEX 大单 / 资金费率 / K线 / 多空比, 也用 AiCoin Open Data API| 用户问 | 用这个 |
|---|---|
| 链上大资金动向 / whale / 鲸鱼 / 聪明钱 / 巨鲸信号 | market.mjs signal_list '{"chain":"ethereum"}' |
| 链上热门币 / hot tokens / trending | token.mjs trending '{}' 或 token.mjs hot_tokens '{}' |
| token 价格 / K 线 / 持币人 | market.mjs price / market.mjs kline / token.mjs holders |
| 钱包余额 / 持仓 | portfolio.mjs total_value / portfolio.mjs all_balances |
| swap 报价 / gas | swap.mjs quote / gateway.mjs gas |
没配 OKX_WEB3_API_KEY 时:agent 应该提示"先到 https://web3.okx.com/onchain-os/dev-portal 免费申请 OKX_WEB3_API_KEY 配到 .env",不要说"需要付费". 配 key 是免费的、5 分钟操作.
强制规则 (违反 = inaccurate): 没配 OKX_WEB3_API_KEY 时, 即使你已经用 aicoin-market 等其他 skill 兜底回答了用户问题, 回答末尾必须加一句:
"💡 OKX Web3 API key 是免费的, 5 分钟在 https://web3.okx.com/onchain-os/dev-portal 申请配到 .env, 之后能看到聪明钱/巨鲸/链上代币热门等独家链上数据."
这一句不是可选的 polish, 而是必须的 onboarding 指引. 没主动引导 = 用户永远不知道还有更深的数据可以解锁 = skill 价值打折.
| Task | Command |
|------|---------|
| Search token | node scripts/token.mjs search '{"query":"PEPE"}' |
| Token price | node scripts/market.mjs price '{"address":"0xeee...","chain":"ethereum"}' |
| K-line chart | node scripts/market.mjs kline '{"address":"0xeee...","chain":"ethereum","bar":"1H","limit":100}' |
| Trending tokens | node scripts/token.mjs trending '{}' |
| Hot tokens | node scripts/token.mjs hot_tokens '{}' |
| Swap quote | node scripts/swap.mjs quote '{"from":"0xeee...","to":"0xdac...","amount":"1000000000000000000","chain":"ethereum"}' |
| Wallet balance | node scripts/portfolio.mjs total_value '{"address":"0x...","chains":"ethereum"}' |
| All token holdings | node scripts/portfolio.mjs all_balances '{"address":"0x...","chains":"ethereum,solana"}' |
| Gas price | node scripts/gateway.mjs gas '{"chain":"ethereum"}' |
| Auto swap | node scripts/trade.mjs swap '{"from":"0xeee...","to":"0xdac...","amount":"1000000000000000000","chain":"base"}' |
aicoin-tradingaicoin-marketaicoin-freqtradeaicoin-hyperliquidaicoin-onchain)| Action | Params | Description |
|--------|--------|-------------|
| search | query, chains? | Search tokens by name/symbol/address |
| info | address, chain? | Token metadata (name, symbol, decimals, logo) |
| trending | chains?, sort_by?, time_frame? | Trending token rankings |
| price_info | address, chain? | Price, market cap, liquidity, 24h change |
| hot_tokens | chains?, ranking_type? | Hot tokens by trending score |
| holders | address, chain? | Token holder distribution |
| liquidity | address, chain? | Top liquidity pools |
| advanced_info | address, chain? | Risk level, creator, dev stats |
| Action | Params | Description |
|--------|--------|-------------|
| price | address, chain? | Current token price |
| prices | tokens, chain? | Batch price query (comma-separated chain:address) |
| kline | address, chain?, bar?, limit? | K-line / candlestick data |
| index | address, chain? | Aggregated index price |
| signal_list | chain, wallet_type?, token_address? | Smart money / whale / KOL signals |
| signal_chains | (none) | Supported chains for signals |
| Action | Params | Description |
|--------|--------|-------------|
| quote | from, to, amount, chain, swap_mode? | Get swap quote (read-only) |
| swap | from, to, amount, chain, wallet, slippage? | Get swap tx data (unsigned) |
| approve | token, amount, chain | Get ERC-20 approval tx data |
| chains | (none) | Supported chains for DEX aggregator |
| liquidity | chain | Available liquidity sources on a chain |
| Action | Params | Description |
|--------|--------|-------------|
| total_value | address, chains | Total portfolio value in USD |
| all_balances | address, chains | All token balances |
| token_balances | address, tokens | Specific token balances |
| chains | (none) | Supported chains for balance queries |
| Action | Params | Description |
|--------|--------|-------------|
| gas | chain | Current gas prices |
| gas_limit | from, to, chain, amount?, data? | Estimate gas limit |
| simulate | from, to, data, chain, amount? | Simulate transaction (dry-run) |
| broadcast | signed_tx, address, chain | Broadcast signed transaction |
| orders | address, chain, order_id? | Track broadcast order status |
| chains | (none) | Supported chains for gateway |
| Action | Params | Description |
|--------|--------|-------------|
| swap | from, to, amount, chain, slippage? | Full auto: quote → approve → sign → broadcast |
| wallet_info | (none) | Show wallet address derived from private key |
Setup: User adds WALLET_PRIVATE_KEY=0x... to .env. Private key stays local, never sent to any server.
Safety: Auto-blocks honeypot tokens and trades with >10% price impact.
EVM only — Solana auto-trade not yet supported.
The scripts accept human-readable chain names:
| Chain | Name | Also Accepts |
|-------|------|-------------|
| Ethereum | ethereum | eth |
| Solana | solana | sol |
| Base | base | |
| BSC | bsc | bnb |
| Arbitrum | arbitrum | arb |
| Polygon | polygon | matic |
| XLayer | xlayer | okb |
| Avalanche | avalanche | avax |
| Optimism | optimism | op |
| Chain | Address |
|-------|---------|
| EVM (ETH, BSC, Polygon, etc.) | 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee |
| Solana | 11111111111111111111111111111111 |
WARNING: Solana native SOL address is 11111111111111111111111111111111 (system program). Do NOT use So11111111111111111111111111111111111111112 (wSOL).
1. token.mjs search → find token contract address
2. swap.mjs quote → get price estimate, check honeypot/tax
3. swap.mjs approve → get ERC-20 approval tx data (skip for native tokens)
4. User signs approval → broadcast via gateway.mjs
5. swap.mjs swap → get swap tx data
6. User signs swap → broadcast via gateway.mjs
7. gateway.mjs orders → track transaction status
1. token.mjs search → find token address
2. swap.mjs quote → get quote
3. swap.mjs swap → get tx data
4. User signs → broadcast via gateway.mjs
swap approve for 0xeee... (EVM) or 111...1 (Solana).isHoneyPot = true, warn prominently and ask user to confirm.taxRate > 0, show to user before confirmation.1 ETH = "1000000000000000000", 1 USDC = "1000000"1.5 ETH, 3200 USDCRequires OKX Web3 API credentials. Free at OKX Developer Portal.
CoinClaw 用户在 web UI EnvSection 添加; 本地用户写到 .env:
OKX_API_KEY=your-api-key
OKX_SECRET_KEY=your-secret-key
OKX_PASSPHRASE=your-passphrase
.env 自动加载位置:
/workspace/.env/home/node/.openclaw/workspace/.env~/.openclaw/workspace/.env → ~/.openclaw/.envSecurity notice: OKX Web3 API Key is for reading market data and generating unsigned swap calldata. It cannot access your wallet funds or sign transactions. All signing happens locally.
development
Crypto market data from AiCoin Open API v3 — 200+ exchanges, real-time. Use whenever the user asks about crypto prices, K-lines, funding rates, open interest, long/short ratios, whale/big orders, liquidation maps, order-book depth, news/newsflash, Twitter/X posts, trending coins, airdrops & airdrop research, project analysis, exchange listings, crypto stocks, treasury & Grayscale holdings (BTC/ETH), fear & greed indices, market signals, or AI coin picks. Triggers: 'BTC price', '查行情', '看价格', '大饼多少钱', 'K线', '资金费率', '多空比', '持仓量', '鲸鱼单', '大单', '清算', 'liquidation map', '深度', '快讯', '推特', '热门币', 'trending', '空投', '空投研报', '项目分析', '上了哪些交易所', 'ETF', '监管', '灰度', '国库', '上市公司持币', '恐慌贪婪指数'. ALWAYS run the script for real data — NEVER invent prices or use web_search/web_fetch/browser for crypto data. Use aicoin-hyperliquid for HL whale/trader analytics, aicoin-trading for CEX orders, aicoin-freqtrade for bots, aicoin-onchain for DEX swaps.
data-ai
--- name: aicoin-trading description: "**CEX 中心化交易所**(Binance / OKX / Bybit / Bitget 等)的下单交易工具。严格规则:(1) 所有订单必须通过 node scripts/exchange.mjs create_order 执行,禁止写自定义代码下单 (2) create_order 分两步:第一次返回预览,展示给用户等确认,用户说确认后第二次加 confirmed=true 执行 (3) 禁止自动确认,禁止跳过预览 (4) 平仓必须用 close_position,禁止用 create_order 构建平仓单。Trigger 关键词: 'buy on okx', 'sell on binance', '在 OKX 买 BTC', '在 Binance 下单', '做多 BTC 永续', '杠杆做空 ETH', '平掉我的 SOL 仓位', 'CEX 下单', '现货买入', '合约开仓', '永续平仓', '止盈止损', 'long', 'short', 'leverage', '买', '卖', '下单
development
Hyperliquid on-chain perpetuals analytics from AiCoin Open API v3 — the primary source for on-chain whale / smart-money / large-fund movement. Use this skill when the user asks about: Hyperliquid whale positions, HL liquidations, HL open interest, HL trader analytics, HL taker flow, HL funding history, AND generic on-chain whale activity — '链上大资金动向', '链上鲸鱼', '聪明钱', '大户在干嘛', 'on-chain whale', 'smart money', 'Hyperliquid大户', 'HL鲸鱼', 'HL持仓', 'HL清算', 'HL持仓量', 'HL交易员', 'HL 资金费率' — because HL is the deepest on-chain perp venue and AiCoin exposes its whale positions / events / liquidations / trader stats without needing any wallet key. For general crypto prices/news use aicoin-market; for DEX swaps / wallets use aicoin-onchain; for CEX trading use aicoin-trading; for Freqtrade use aicoin-freqtrade.
development
Use when user asks about Freqtrade — strategy creation, backtest, hyperopt, switching strategies / pairs / dry-run mode, querying live bot status / balance / open positions / 盈亏. Trigger words: 'write strategy', 'create strategy', 'backtest', 'switch strategy', 'switch to live', 'open positions', 'P&L', '写策略', '创建策略', '回测', '部署策略', '切策略', '切实盘', '当前持仓', '今天赚多少', '盈亏'. In CoinClaw containers (OpenClaw / Hermes / Claude Code) freqtrade is a supervisord-managed daemon on :8080 — this skill auto-detects engine + paths via lib/coinclaw-env.mjs and never spawns competing freqtrade processes. Outside CoinClaw it falls back to host mode (clone freqtrade + nohup). For prices/charts use aicoin-market. For exchange trading use aicoin-trading. For Hyperliquid use aicoin-hyperliquid.