okx-dex-swap

Executes multi-chain token swaps via OKX DEX aggregation with quote, approval, and risk controls.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/Nith567/xlayer-skills-arena --skill okx-dex-swap-nith567
Or copy as Structured Prompt for Agentβ–Ό
Please help me install this Agent Skill.
Skill: okx-dex-swap
Source: https://github.com/Nith567/xlayer-skills-arena/tree/main/okx-dex-swap
Command: npx skills add https://github.com/Nith567/xlayer-skills-arena --skill okx-dex-swap-nith567

SYSTEM DOCUMENTATION & REQUIREMENTS

πŸ’‘ This Skill includes references (resource) components.

What problem does it solve? Swapping tokens across chains requires finding the best route, handling approvals, managing slippage, and avoiding honeypots or MEV attacks. This Skill automates the entire swap workflow through the OKX Onchain OS CLI, aggregating liquidity from 500+ DEX sources across 20+ chains. ## Core Features & Use Cases - Quote and One-Shot Execution: Get read-only price quotes, then execute quote β†’ approve β†’ sign β†’ broadcast in a single command returning the transaction hash. - Risk Controls: Built-in honeypot blocking, tax rate warnings, price impact alerts, and MEV protection thresholds per chain (Ethereum, BSC, Base, Solana via Jito tips). - Token Address Resolution: Resolves native tokens, stablecoins, and arbitrary symbols to correct contract addresses per chain, never guessing contract addresses. - Use Case: A user says "swap 100 USDC for OKB on XLayer" β€” the Skill resolves addresses, fetches a quote showing price impact and gas, confirms with the user, executes the swap, and reports the transaction hash. ## Quick Start Ask the agent to swap a specific amount of one token for another on a named chain, for example "swap 0.5 ETH for USDC on Base".

Frequently Asked Questions about okx-dex-swap

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I swap tokens on XLayer or Base using natural language?β–Ό

State the amount, source token, destination token, and chain, such as "swap 100 USDC for OKB on XLayer". The Skill resolves token addresses, fetches a quote, asks for confirmation, then executes approval and swap in one command.

What chains does the OKX DEX swap aggregator support?β–Ό

It supports 20+ chains including XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, Sui, Tron, and Ton. Run "onchainos swap chains" to list all supported chains and their approval router addresses.

Does the swap skill protect against honeypots and MEV attacks?β–Ό

Yes. Buy-side honeypots are blocked automatically, high tax rates trigger warnings, and MEV protection can be enabled on Ethereum, BSC, and Base via --mev-protection or on Solana via Jito tips when transaction value exceeds chain thresholds.

Why did my swap fail right after the approval transaction?β–Ό

The approval transaction may not be confirmed on-chain yet. Wait based on the chain's block time (about 3 seconds on XLayer or Base, 15 on Ethereum), then retry once. Persistent errors like 82000 or 51006 indicate a dead or illiquid token.

Can I get unsigned swap calldata without broadcasting a transaction?β–Ό

Yes. The "onchainos swap swap" command returns unsigned transaction data including to, data, gas, value, and minReceiveAmount. You handle signing and broadcasting yourself, and the calldata expires within minutes.