skills/okx-dex-bridge/SKILL.md
Use this skill to bridge tokens, cross-chain swap/transfer, move assets between chains, get cross-chain quotes, compare bridge fees, find the cheapest/fastest route, build bridge calldata, check bridge status, track a cross-chain transaction, list supported chains or bridge protocols, or when the user mentions bridging ETH/USDC/tokens from one chain (Ethereum, BSC, Polygon, Arbitrum, Base, Optimism, etc.) to another. Routes through multiple bridge protocols (Stargate, Across, Relay, Gas.zip) for optimal execution. One-shot execute: a single confirmed call approves (if needed), waits for on-chain confirmation, swaps, and broadcasts. Supports fee comparison, destination address specification, and full lifecycle status tracking until fund arrival.
npx skillsauth add okx/onchainos-skills okx-dex-bridgeInstall 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.
Bridge tokens across chains. This skill orchestrates two happy paths:
execute, one-shot): resolve → quote → confirm → execute → report.status): query until the funds land on the destination chain.There are 7 cross-chain subcommands; this file orchestrates the two flows above. For anything outside them, the References table at the end says which file to open.
onchainos command this session, read and follow ../okx-agentic-wallet/_shared/preflight.md (fallback _shared/preflight.md).../okx-agentic-wallet/_shared/chain-support.md (fallback _shared/chain-support.md).Only these 7 subcommands exist — do not invent new ones.
<IMPORTANT> **When you are not certain of a subcommand's exact flags, run `onchainos cross-chain <subcommand> --help` first** and build the call from the live flag list it prints. `--help` is the source of truth for flags (name, required, default, mutual exclusivity). The signatures in this index and the example commands in the steps below are a routing map, not the full flag list; do not treat them as complete. </IMPORTANT>| # | Command | Role |
|---|---|---|
| 1 | cross-chain bridges [--from-chain] [--to-chain] | List / filter bridge protocols (pair pre-check). |
| 2 | cross-chain tokens [--from-chain] [--to-chain] | List bridgeable from-tokens. |
| 3 | cross-chain quote --from --to --from-chain --to-chain --readable-amount [...] | Read-only quote → routerList[]. |
| 4 | cross-chain approve --chain --token --wallet --bridge-id (--amount \| --readable-amount) | Manual ERC-20 approve (not used in Path A). |
| 5 | cross-chain swap --from --to --from-chain --to-chain --readable-amount --wallet [...] | Unsigned tx / calldata only (not used in Path A). |
| 6 | cross-chain execute --from --to --from-chain --to-chain --readable-amount --wallet [...] | One-shot: quote → approve → wait → swap → broadcast. |
| 7 | cross-chain status (--tx-hash \| --order-id) --bridge-id --from-chain | Query status. |
Path A uses 3, 6. Path B uses 7. bridges is the optional Step 2.5 pre-check. approve / swap are for the manual calldata flow only.
CA sources, in order:
--from/--to.onchainos token search --query <symbol> --chains <chain> — for any symbol the CLI does not resolve. Search on the CORRECT chain.After token search, show results and wait for confirmation. Multiple → numbered list (name/symbol/CA/chain/marketCap), ask user to pick. Single → show details and confirm. Never skip confirmation — wrong token = permanent fund loss.
Native token addresses (do NOT use token search):
| Chain | Native Address |
|---|---|
| EVM (Ethereum, BSC, Polygon, Arbitrum, Base, …) | 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee |
| Solana | 11111111111111111111111111111111 |
</IMPORTANT>
Follow Token Address Resolution. Resolve --from with --from-chain, --to with --to-chain.
--from-chain and --to-chain required — ask if missing.--readable-amount.--slippage only on user request.onchainos wallet status; not logged in → login; multiple accounts → ask which.--receive-address required; family must match --to-chain.--receive-address ≠ wallet → Fund-action gates (second confirmation).execute gates it before broadcasting (Step 5).--bridge-id for the server's optimal route.Fail fast on pairs no bridge connects:
onchainos cross-chain bridges --from-chain <fromChain> --to-chain <toChain>
onchainos cross-chain quote \
--from <address> --to <address> \
--from-chain <chain> --to-chain <chain> \
--readable-amount <amount> \
--wallet <walletAddress> --check-approve \
[--bridge-id <id>] [--sort <0|1|2>] [--allow-bridges <ids>] [--deny-bridges <ids>]
Pass --wallet --check-approve for an accurate needApprove.
--sort — route ranking preference (omit = server picks 0):
0 — optimal (server default)1 — fastest2 — max outputrouterList[] is a multi-bridge list. Render exactly these 7 columns, every time (translate headers to the user's language; the sample row names the source field — do not print it literally). If a value is empty/zero/null, show the default; never drop a column.
| # | Bridge | Est. Receive | Min. Receive | Fee | Est. Time | Approve |
|---|--------------|-----------------|-------------------|-----------------|----------------|---------------|
| n | `bridgeName` | `toTokenAmount` | `minimumReceived` | `crossChainFee` | `estimateTime` | `needApprove` |
otherNativeFee when non-zero; default 0.estimateTime seconds → human (~43s, ~6min).needApprove → Yes/No (default No). Gloss below the table: Yes = first-time approval to the {bridgeName} router; No = allowance sufficient.Render every entry as a row — do NOT collapse to one even when only one is returned. Recommend route #1 (server's top pick by current sort) with a one-line reason (lowest fee / fastest / max output). If routerList is empty → transit-fallback.md.
Get confirmation before execute, after these checks:
priceImpactPercentage > 10% → WARN prominently (empty in pre-prod → treat as 0%).receiveAddress != wallet → Fund-action gates (second confirmation).onchainos cross-chain execute \
--from <address> --to <address> \
--from-chain <chain> --to-chain <chain> \
--readable-amount <amount> \
--wallet <walletAddress> \
[--bridge-id <id> | --route-index <n>] [--sort <0|1|2>] \
[--receive-address <addr>] [--mev-protection]
Pin a route with --bridge-id or --route-index per the user's choice. Apply the quote-freshness rule before broadcasting. Decide --mev-protection per MEV protection.
Outcomes:
action=execute (success) → response carries nextSteps.checkBridgeStatus + fromTxHash, swapOrderId, bridgeId, bridgeName, fromChainIndex (+ approveTxHash if an approval ran). Go to Step 6.action=blocked (insufficient_balance/insufficient_gas) → relay message (deposit / top up gas) and stop; nothing broadcast.action=fallback → no direct route → transit-fallback.md.execution reverted, approve/revoke timeout, backend risk warning) → troubleshooting.md. A risk warning still requires the Fund-action gates before any --force.Cross-chain transfer broadcast.
Route: {bridgeName}
From: {fromAmount} {fromTokenSymbol} on {fromChain}
Expected arrival: ~{toTokenAmount} {toTokenSymbol} on {toChain}
Minimum guaranteed: {minimumReceived} {toTokenSymbol}
Bridge fee: {crossChainFee} {fromTokenSymbol}
Estimated time: ~{estimateTime} seconds
Source TX: {fromTxHash}
Order ID: {swapOrderId}
Bridge: {bridgeName} (id={bridgeId})
Source chain: {fromChain} ({fromChainIndex})
To check arrival status, choose either:
- Tell me in chat with the tx hash, e.g. "check if tx {fromTxHash} has arrived". I will run the command for you.
- Run directly in terminal — paste verbatim (--bridge-id and --from-chain are REQUIRED):
{nextSteps.checkBridgeStatus}
<IMPORTANT>
Keep BOTH options in the status block — never collapse to command-only. The natural-language phrasing MUST embed the actual `fromTxHash`. The terminal command MUST be the `nextSteps.checkBridgeStatus` string verbatim (CLI-assembled → exempt from the untrusted-output rule); do NOT hand-assemble it.
</IMPORTANT>
User queries status after the estimated arrival time. Either form works:
onchainos cross-chain status --tx-hash <fromTxHash> --bridge-id <bridgeId> --from-chain <fromChainIndex>
onchainos cross-chain status --order-id <swapOrderId> --bridge-id <bridgeId> --from-chain <fromChainIndex>
If the most recent execute response is available, reuse its nextSteps.checkBridgeStatus verbatim; otherwise ask the user for the missing values.
Interpret status (the to* fields are empty/zero until SUCCESS — rely on them only after SUCCESS):
| Status | User message |
|---|---|
| SUCCESS | "Cross-chain transfer complete. {toAmount} {toTokenSymbol} arrived on {toChain}. Destination TX: {toTxHash}" |
| PENDING | "Transfer in progress. Bridge: {bridgeName}. Check again shortly. Estimated arrival: ~{estimateTime}." |
| NOT_FOUND | First seconds: "Bridge has not yet indexed your transaction. Wait 10–30s and re-check." Persisting >5min: "Source chain may not have confirmed it. Verify on the explorer." |
sleep-loop in chat. If not SUCCESS, report it and tell the user when to recheck (~estimateTime). Scripted polling → troubleshooting.md → Status Polling.SUCCESS.Every flag that broadcasts a tx or expands spending authority needs an explicit user yes/no. The Step 4 route confirmation covers the in-flight approval; these cover flags that change destination, route, or risk behavior.
| Flag | Effect | Required gate |
|---|---|---|
| --force | Bypasses the backend risk warning (potential honeypot / poisoned contract) | On that warning, explicitly tell the user the risk is "potential fund loss"; re-run with --force only on explicit confirm |
| --bridge-id / --route-index | Pins a specific bridge (overrides optimal route) | Only if the user picked from the table or named a bridge; never pin unprompted |
| --allow-bridges / --deny-bridges | Restricts the bridge set | Only when the user said "use only X" / "don't use X" |
| --receive-address ≠ wallet | Sends to a non-sender address | "Wrong destination = permanent fund loss" + second confirmation of the address |
| --mev-protection | MEV-protected broadcast | Auto-forced for relay/mayan/butterswap; otherwise by size threshold (below) |
When in doubt, ask — a delayed confirm beats a wrong broadcast.
The CLI auto-forces MEV protection for relay / mayan / butterswap — you don't decide those. For other bridges, compute txValueUsd = fromTokenAmount × fromTokenPrice and pass --mev-protection when txValueUsd >= threshold:
| Chain | Threshold | Action |
|---|---|---|
| Ethereum | $2,000 | pass --mev-protection |
| BNB Chain | $200 | pass --mev-protection |
| Base | $200 | pass --mev-protection |
| Other EVM | $100 | no MEV option exists — above this, warn it broadcasts without protection, then proceed |
If fromTokenPrice is unavailable → enable by default. Re-evaluate every time the amount changes; do NOT carry it over from a previous command.
1.5 ETH, 3,200 USDC). Always show both source and destination chain + token.--from/--to/--receive-address) and in display. Solana is case-sensitive — keep as-is.quote and compare new toTokenAmount against the baseline's minimumReceived. A freshly confirmed quote becomes the new baseline.Only when the user explicitly authorized it. Three rules: (1) never assume silent mode; (2) BLOCK-level risks (esp. receiveAddress != wallet) still halt and notify; (3) log every silent tx (timestamp, pair, amount, route, fromTxHash, status) and present on request.
When you hit one of these situations, open the matching file:
| Situation | Read |
|---|---|
| Any error code, failed/stuck tx, status NOT_FOUND or long PENDING, writing a polling script | references/troubleshooting.md |
| routerList empty / action=fallback / "no direct route" / transit tokens | references/transit-fallback.md |
| Need a return-field schema or worked example; running manual approve / swap; any flag a --help couldn't clarify | references/cli-reference.md |
testing
OKX-aggregated DeFi (no specific DApp named) — product discovery, deposit/withdraw/claim execution, AND positions viewing. **If the user names ANY third-party protocol/DApp (Aave, Lido, PancakeSwap, Uniswap, Curve, Compound, Morpho, Pendle, Kamino, Raydium, Hyperliquid, Polymarket, …), route to okx-dapp-discovery — NOT here, even for 'show my Aave positions'.** INVEST triggers: 'invest in DeFi', 'earn yield', 'find best APY', 'deposit/stake for yield', 'search DeFi products', 'redeem/withdraw position', 'claim DeFi rewards', 'borrow against asset', 'repay loan', 'add/remove CLMM liquidity', 'APY/TVL history', 'depth chart', yield farming, lending, staking, liquidity pools. PORTFOLIO triggers: 'check my DeFi positions', 'view DeFi holdings/portfolio', 'my staking/lending positions', 'DeFi balance', 'DeFi 持仓', '我的DeFi资产'. Do NOT use for: DEX swaps (okx-agentic-wallet), token prices (okx-dex-market), wallet token balances (okx-agentic-wallet).
testing
ERC-8004 Agent identity: 注册/更新/上架/下架/搜索agent, register/update/activate/deactivate/search — User/ASP/Evaluator(买家/卖家/仲裁者); 我的agent/ASP, 找做X的ASP/agent有什么服务/endpoint怎么填/查口碑/传头像. + Task Marketplace: 发布/创建任务/接单/协商/验收/deliver/dispute/仲裁/拒绝/stake/unstake/change provider/change budget/修改卖家/修改预算/我的任务/my tasks/what am I working on/我的订阅/订阅列表/订阅详情/my subscriptions/what am I subscribed to/AI服务订阅(view AI-service subscriptions, buyer & ASP)/关闭/取消任务/决策列表/decision list/指定服务商/browse marketplace. + task watch: 监听任务进展/历史消息/未读消息/未决策/outstanding decisions. + okx-a2a missing/uninitialized. Match by meaning. MUST ACTIVATE on inbound envelopes: (1) {agentId, message:{source:"system", event, jobId,...}} system event; (2) {msgType:"a2a-agent-chat", jobId, sender:{role},...} agent-to-agent task chat (sender.role = COUNTERPARTY, not you); (3) literal "Read the okx-ai skill" (or legacy "Read the okx-agent-task skill") in the envelope.
testing
Onchain OS onboarding & guide hub — the single entry for first-time, 'what is this / how do I use it', OKX.AI, and customer-support intents; classifies the intent and routes to the right sub-flow via its Intent Routing table. Covers: (1) Onchain OS onboarding + welcome banner — 'what is onchainos', 'what is onchain os', 'what can it do', 'what can onchainos do', 'what does onchainos do', 'how do I use this', 'how do I play', 'how to use onchainos', 'how to play onchainos', 'how does onchainos work', 'how do I start', 'getting started', 'tutorial', 'onboarding', 'first time', 'I just installed', 'now what', 'what do I do now', 'where do I start', 'who are you', 'what are you', 'introduce onchainos', 'tell me about onchainos', 'I'm new'; (2) OKX.AI intro & role-registration routing (the Agent economic system — roles User / ASP / Evaluator) — 'what is OKX.AI', 'OKX.AI 是什么', 'how to use OKX.AI', 'OKX.AI 快速开始', and any spelling / spacing / casing / typo variant (OKXAI, okx ai, okx-ai, lowercase okx.ai, 啥是okxai); (3) customer support / Help Center — 'contact support', 'talk to a human', 'customer service', 'file a complaint', 'give feedback', 'report a bug / system error', 'help center', 'FAQ', 'user guide', 'something is broken'. NOT for: direct on-chain actions (swap / wallet / balance / token) or Agent task lifecycle (publish / accept / deliver / dispute) — those have their own skills.
testing
List OKX Agentic Wallet exclusive trading competitions, register users for contests, track participation and leaderboard rankings, and claim won rewards. Use when users want to list available trading competitions or trading cups, view competition rules / prize pool / total prizes, register or sign up or enroll or join a contest, check the leaderboard (who is winning) or their own rank (am I in the prize zone, what is my place), ask did I win or query participation / claim status, claim won rewards or prizes from completed competitions, see which wallet account they registered with, or submit Telegram / WeChat / Email / Twitter contact for prize delivery to top-tier winners.