
Okx Dex Market
Query OKX OnchainOS DEX market data from the CLI with human-readable chain names, wallet-capable chains, and x402 payment notification handling after free quota.
Overview
OKX DEX Market is an agent skill for the Build phase that integrates OKX OnchainOS DEX market APIs via CLI, including chain aliases, wallet chains, and x402 payment notification handling.
Install
npx skills add https://github.com/okx/onchainos-skills --skill okx-dex-marketWhat is this skill?
- 6 chains with wallet address creation: XLayer, Solana, Ethereum, Base, BSC, Arbitrum (chainIndex table)
- 17+ additional chains for wallet interaction via onchainos wallet chains
- Canonical x402 Market API payment notifications: 5 event codes shared across okx-dex-market, token, signal, and trenches
- Non-blocking notifications[] pattern with filled user-facing copy before returning data
- CLI auto-signs x402 when user is logged in
- 6 chains support wallet address creation
- 5 x402 payment notification event codes
- 4 related skills share the same notification canonical doc
Adoption & trust: 7.2k installs on skills.sh; 284 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need DEX market data from OKX but chain indices, wallet support, and paid-quota x402 events are scattered across multiple onchainos skills.
Who is it for?
Indie builders coding DeFi agents or market scanners that already use the onchainos CLI and must handle quota exhaustion gracefully.
Skip if: Non-crypto products, manual trading without automation, or teams that refuse on-chain API payments and need only static documentation.
When should I use this skill?
Building or debugging OKX OnchainOS Market API flows, chain aliases, or shared payment notification copy for market-related CLI calls.
What do I get? / Deliverables
Your agent calls market endpoints with correct chain names, explains payment notifications with the five standard codes, and keeps UX consistent with other OKX DEX skills.
- Correct chainIndex / chain name usage in CLI commands
- User-facing handling of notifications[] payment events
- Consistent copy aligned with four sibling OKX DEX skills
Recommended Skills
Journey fit
DEX market integration is implemented as external API wiring during product build, not as a launch-day marketing task. Integrations subphase covers third-party on-chain data providers and payment-gated API flows in your agent or app.
How it compares
OKX OnchainOS integration skill with shared x402 semantics—not a generic CEX REST tutorial.
Common Questions / FAQ
Who is okx-dex-market for?
Solo developers building on-chain trading, signal, or market-data agents that consume OKX OnchainOS Market API through the official CLI.
When should I use okx-dex-market?
During Build integrations when implementing DEX market reads, chain selection, or x402 payment UX for OKX market endpoints.
Is okx-dex-market safe to install?
It involves wallet chains and signed payments; review the Security Audits panel on this Prism page and never expose keys in prompts or logs.
SKILL.md
READMESKILL.md - Okx Dex Market
# Shared Chain Name Support > This file is shared across all onchainos skills. The CLI accepts human-readable chain names and resolves them automatically. The following 6 chains support **wallet address creation** (i.e., you can generate a wallet address on these chains): | Chain | Name | chainIndex | |---|---|---| | XLayer | `xlayer` | `196` | | Solana | `solana` | `501` | | Ethereum | `ethereum` | `1` | | Base | `base` | `8453` | | BSC | `bsc` | `56` | | Arbitrum | `arbitrum` | `42161` | > **Note**: The wallet supports interacting with 17+ chains beyond this list (e.g., Polygon, Avalanche, Optimism). > Run `onchainos wallet chains` for the full list of supported chains. # Payment Notifications (Market API x402) Some Market API endpoints may require x402 payment after the free quota is exhausted. The CLI handles signing automatically once the user is logged in and surfaces the following events in the response `notifications[]` array. This document is the canonical source for the 5 event codes, their user-facing copy, placeholder sources, and the agent handling procedure. It is consumed by `okx-dex-market`, `okx-dex-token`, `okx-dex-signal`, and `okx-dex-trenches`. --- ## Response Shapes Every CLI call may include a `notifications[]` field. Two response patterns: **Non-blocking (informational)**: ```json { "ok": true, "data": { /* ... */ }, "notifications": [{ "code": "...", "data": {} }] } ``` Print the filled copy once, then display `data` as usual. **Blocking (first-time charging flip)**: ```json { "confirming": true, "notifications": [{ "code": "MARKET_API_*_OVER_QUOTA", "data": { "tier": "premium", "payment": [ { "amount": "0.0005", "asset": "0xUSDG", "name": "Global Dollar", "symbol": "USDG", "network": "X Layer", "chainId": 196, "payTo": "0xPAYTO", "isDefault": false }, { "amount": "0.0005", "asset": "0xUSDT", "name": "Tether USD", "symbol": "USDT", "network": "X Layer", "chainId": 196, "payTo": "0xPAYTO", "isDefault": true } ] } }] } ``` Each `payment[]` entry is already display-ready: `amount` is a decimal string (not minimal units), `network` is the chain's human-readable name (falls back to the raw CAIP-2 string on chain-cache miss), and `chainId` is the numeric EVM chain id the `onchainos payment default set` CLI expects. `name` carries the full human-readable asset name (e.g. "Global Dollar"); `symbol` is the short ticker (e.g. "USDG"). Older servers only returned the ticker in `name` and leave `symbol` as `""` — render `<symbol> (<name>)` when both are present and differ, otherwise fall back to `<name>` alone. `isDefault` flags the entry whose `(asset, network)` matches the user's saved default (at most one per list); when no default is saved, every entry is `false`. **Never auto-retry.** The user must always confirm before paying — even when a default asset is saved, the picker still fires on every first-time tier charging flip so the user can switch assets or cancel. Once they pick (or confirm the sole option) and `payment default set` has run, rerun the exact same command — the CLI will auto-sign the matching accepts entry on the second call. --- ## Handling Procedure Before formatting the CLI result: 1. **Check `notifications[]`**. If absent or empty, proceed normally. 2. **For each `notification.code`**: - Look up the copy in the code table below. - Fill placeholders using the resolution rules. 3. **If `confirming: true` is present on the envelope**: - Do NOT auto-retry. - Present the filled copy to the user. - **If `notifications[].data.payment[]` has ≥ 2 entries**, render them as a numbered token list — one line per entry — using the asset label (`<symbol> (<name>)` when both are present and differ, else just `<name>`), `amo