{
  "schemaVersion": "1.0",
  "item": {
    "slug": "okx-dex",
    "name": "okx-dex",
    "source": "tencent",
    "type": "skill",
    "category": "通讯协作",
    "sourceUrl": "https://clawhub.ai/ricky321u/okx-dex",
    "canonicalUrl": "https://clawhub.ai/ricky321u/okx-dex",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/okx-dex",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=okx-dex",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "_meta.json",
      "README.md",
      "SKILL.md",
      "scripts/test_okx.sh"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/okx-dex"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/okx-dex",
    "agentPageUrl": "https://openagent3.xyz/skills/okx-dex/agent",
    "manifestUrl": "https://openagent3.xyz/skills/okx-dex/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/okx-dex/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "OKX DEX Aggregator 🧭",
        "body": "OKX Wallet DEX API provides aggregated swap quotes and transaction data across multiple chains (EVM + non‑EVM)."
      },
      {
        "title": "Environment Variables",
        "body": "VariableDescriptionRequiredOKX_API_KEYOKX API keyYesOKX_SECRET_KEYOKX API secretYesOKX_PASSPHRASEOKX API passphraseYes"
      },
      {
        "title": "API Base URL",
        "body": "https://web3.okx.com"
      },
      {
        "title": "Authentication (Required Headers)",
        "body": "All requests must include the following headers:\n\nOK-ACCESS-KEY\nOK-ACCESS-TIMESTAMP (UTC ISO time)\nOK-ACCESS-PASSPHRASE\nOK-ACCESS-SIGN (Base64(HMAC_SHA256(prehash, secret)))\n\nPrehash string:\n\nTIMESTAMP + METHOD + REQUEST_PATH_WITH_QUERY + BODY\n\nFor GET requests, BODY is empty and REQUEST_PATH_WITH_QUERY must include the query string.\nFor POST requests, BODY is the raw JSON string."
      },
      {
        "title": "Get Supported Chains (Aggregator)",
        "body": "API_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/supported/chain\"\nQUERY=\"chainIndex=1\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '.'"
      },
      {
        "title": "Get Tokens",
        "body": "API_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\nCHAIN_INDEX=\"1\"  # Ethereum\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/all-tokens\"\nQUERY=\"chainIndex=${CHAIN_INDEX}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '.data[:5]'"
      },
      {
        "title": "Get Swap Quote (Quote Only)",
        "body": "API_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nFROM_TOKEN=\"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\"  # ETH (native)\nTO_TOKEN=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"    # USDC\nAMOUNT=\"1000000000000000000\"  # 1 ETH in wei\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/quote\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&fromTokenAddress=${FROM_TOKEN}&toTokenAddress=${TO_TOKEN}&amount=${AMOUNT}&swapMode=exactIn\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '{\n    fromTokenAmount: .data[0].fromTokenAmount,\n    toTokenAmount: .data[0].toTokenAmount,\n    tradeFee: .data[0].tradeFee,\n    router: .data[0].router\n  }'"
      },
      {
        "title": "Get Swap Transaction (Router Call Data)",
        "body": "Note: slippagePercent is required by the swap endpoint and is expressed as a\ndecimal percentage (e.g., 0.01 = 1%).\n\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nFROM_TOKEN=\"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\"\nTO_TOKEN=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\nAMOUNT=\"1000000000000000000\"  # 1 ETH in wei\nslippagePercent=\"0.01\"  # 1%\nWALLET=\"<YOUR_WALLET_ADDRESS>\"\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/swap\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&fromTokenAddress=${FROM_TOKEN}&toTokenAddress=${TO_TOKEN}&amount=${AMOUNT}&swapMode=exactIn&slippagePercent=${slippagePercent}&userWalletAddress=${WALLET}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '{\n    tx: .data[0].tx,\n    router: .data[0].routerResult.router,\n    priceImpactPercent: .data[0].routerResult.priceImpactPercent,\n    dexRouterList: (.data[0].routerResult.dexRouterList // [])\n  }'"
      },
      {
        "title": "Get Approval Transaction (EVM)",
        "body": "Note: Some responses may omit to/value. If to is null, use the chain's\ndexTokenApproveAddress from the Supported Chains response as the target.\n\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nTOKEN_ADDRESS=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"  # USDC\nAMOUNT=\"1000000000\"  # 1,000,000 USDC (6 decimals)\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/approve-transaction\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&tokenContractAddress=${TOKEN_ADDRESS}&approveAmount=${AMOUNT}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '{\n    data: .data[0].data,\n    dexContractAddress: .data[0].dexContractAddress,\n    gasLimit: .data[0].gasLimit,\n    gasPrice: .data[0].gasPrice\n  }'"
      },
      {
        "title": "Get Approval Transaction (EVM) with to from Supported Chains",
        "body": "API_KEY=\"${OKX_API_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nTOKEN_ADDRESS=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"  # USDC\nAMOUNT=\"1000000000\"  # 1,000,000 USDC (6 decimals)\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/supported/chain\"\nQUERY=\"chainIndex=${CHAIN_INDEX}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"OKX_SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\nAPPROVE_TO=$(curl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq -r '.data[0].dexTokenApproveAddress')\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/approve-transaction\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&tokenContractAddress=${TOKEN_ADDRESS}&approveAmount=${AMOUNT}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"OKX_SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq --arg to \"${APPROVE_TO}\" '{\n    data: .data[0].data,\n    dexContractAddress: (.data[0].dexContractAddress // $to),\n    gasLimit: .data[0].gasLimit,\n    gasPrice: .data[0].gasPrice\n  }'"
      },
      {
        "title": "Safety Rules",
        "body": "ALWAYS display swap details before execution.\nWARN if price impact is high or priceImpactProtectionPercent is exceeded.\nCHECK token allowance (EVM) before swap execution.\nVERIFY slippage settings (slippagePercent).\nFor approve responses, if to is null, use dexTokenApproveAddress for the chain.\nNEVER execute without explicit user confirmation."
      },
      {
        "title": "Links",
        "body": "OKX DEX API Reference (v6)"
      }
    ],
    "body": "OKX DEX Aggregator 🧭\n\nOKX Wallet DEX API provides aggregated swap quotes and transaction data across multiple chains (EVM + non‑EVM).\n\nEnvironment Variables\nVariable\tDescription\tRequired\nOKX_API_KEY\tOKX API key\tYes\nOKX_SECRET_KEY\tOKX API secret\tYes\nOKX_PASSPHRASE\tOKX API passphrase\tYes\nAPI Base URL\nhttps://web3.okx.com\n\nAuthentication (Required Headers)\n\nAll requests must include the following headers:\n\nOK-ACCESS-KEY\nOK-ACCESS-TIMESTAMP (UTC ISO time)\nOK-ACCESS-PASSPHRASE\nOK-ACCESS-SIGN (Base64(HMAC_SHA256(prehash, secret)))\n\nPrehash string:\n\nTIMESTAMP + METHOD + REQUEST_PATH_WITH_QUERY + BODY\n\nFor GET requests, BODY is empty and REQUEST_PATH_WITH_QUERY must include the query string.\nFor POST requests, BODY is the raw JSON string.\nGet Supported Chains (Aggregator)\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/supported/chain\"\nQUERY=\"chainIndex=1\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '.'\n\nGet Tokens\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\nCHAIN_INDEX=\"1\"  # Ethereum\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/all-tokens\"\nQUERY=\"chainIndex=${CHAIN_INDEX}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '.data[:5]'\n\nGet Swap Quote (Quote Only)\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nFROM_TOKEN=\"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\"  # ETH (native)\nTO_TOKEN=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"    # USDC\nAMOUNT=\"1000000000000000000\"  # 1 ETH in wei\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/quote\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&fromTokenAddress=${FROM_TOKEN}&toTokenAddress=${TO_TOKEN}&amount=${AMOUNT}&swapMode=exactIn\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '{\n    fromTokenAmount: .data[0].fromTokenAmount,\n    toTokenAmount: .data[0].toTokenAmount,\n    tradeFee: .data[0].tradeFee,\n    router: .data[0].router\n  }'\n\nGet Swap Transaction (Router Call Data)\n\nNote: slippagePercent is required by the swap endpoint and is expressed as a decimal percentage (e.g., 0.01 = 1%).\n\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nFROM_TOKEN=\"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\"\nTO_TOKEN=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\nAMOUNT=\"1000000000000000000\"  # 1 ETH in wei\nslippagePercent=\"0.01\"  # 1%\nWALLET=\"<YOUR_WALLET_ADDRESS>\"\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/swap\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&fromTokenAddress=${FROM_TOKEN}&toTokenAddress=${TO_TOKEN}&amount=${AMOUNT}&swapMode=exactIn&slippagePercent=${slippagePercent}&userWalletAddress=${WALLET}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '{\n    tx: .data[0].tx,\n    router: .data[0].routerResult.router,\n    priceImpactPercent: .data[0].routerResult.priceImpactPercent,\n    dexRouterList: (.data[0].routerResult.dexRouterList // [])\n  }'\n\nGet Approval Transaction (EVM)\n\nNote: Some responses may omit to/value. If to is null, use the chain's dexTokenApproveAddress from the Supported Chains response as the target.\n\nAPI_KEY=\"${OKX_API_KEY}\"\nSECRET_KEY=\"${OKX_SECRET_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nTOKEN_ADDRESS=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"  # USDC\nAMOUNT=\"1000000000\"  # 1,000,000 USDC (6 decimals)\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/approve-transaction\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&tokenContractAddress=${TOKEN_ADDRESS}&approveAmount=${AMOUNT}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq '{\n    data: .data[0].data,\n    dexContractAddress: .data[0].dexContractAddress,\n    gasLimit: .data[0].gasLimit,\n    gasPrice: .data[0].gasPrice\n  }'\n\nGet Approval Transaction (EVM) with to from Supported Chains\nAPI_KEY=\"${OKX_API_KEY}\"\nPASSPHRASE=\"${OKX_PASSPHRASE}\"\n\nCHAIN_INDEX=\"1\"  # Ethereum\nTOKEN_ADDRESS=\"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"  # USDC\nAMOUNT=\"1000000000\"  # 1,000,000 USDC (6 decimals)\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/supported/chain\"\nQUERY=\"chainIndex=${CHAIN_INDEX}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"OKX_SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\nAPPROVE_TO=$(curl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq -r '.data[0].dexTokenApproveAddress')\n\nTIMESTAMP=$(python3 - <<'PY'\nfrom datetime import datetime, timezone\nprint(datetime.now(timezone.utc).isoformat(timespec='milliseconds').replace('+00:00','Z'))\nPY\n)\n\nMETHOD=\"GET\"\nREQUEST_PATH=\"/api/v6/dex/aggregator/approve-transaction\"\nQUERY=\"chainIndex=${CHAIN_INDEX}&tokenContractAddress=${TOKEN_ADDRESS}&approveAmount=${AMOUNT}\"\nPATH_WITH_QUERY=\"${REQUEST_PATH}?${QUERY}\"\n\nSIGN=$(python3 - <<PY\nimport hmac, hashlib, base64\nimport os\nmsg = f\"${TIMESTAMP}${METHOD}${PATH_WITH_QUERY}\"\nsecret = os.environ[\"OKX_SECRET_KEY\"].encode()\nprint(base64.b64encode(hmac.new(secret, msg.encode(), hashlib.sha256).digest()).decode())\nPY\n)\n\ncurl -s \"https://web3.okx.com${PATH_WITH_QUERY}\" \\\n  -H \"OK-ACCESS-KEY: ${API_KEY}\" \\\n  -H \"OK-ACCESS-TIMESTAMP: ${TIMESTAMP}\" \\\n  -H \"OK-ACCESS-PASSPHRASE: ${PASSPHRASE}\" \\\n  -H \"OK-ACCESS-SIGN: ${SIGN}\" | jq --arg to \"${APPROVE_TO}\" '{\n    data: .data[0].data,\n    dexContractAddress: (.data[0].dexContractAddress // $to),\n    gasLimit: .data[0].gasLimit,\n    gasPrice: .data[0].gasPrice\n  }'\n\nSafety Rules\nALWAYS display swap details before execution.\nWARN if price impact is high or priceImpactProtectionPercent is exceeded.\nCHECK token allowance (EVM) before swap execution.\nVERIFY slippage settings (slippagePercent).\nFor approve responses, if to is null, use dexTokenApproveAddress for the chain.\nNEVER execute without explicit user confirmation.\nLinks\nOKX DEX API Reference (v6)"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/ricky321u/okx-dex",
    "publisherUrl": "https://clawhub.ai/ricky321u/okx-dex",
    "owner": "ricky321u",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/okx-dex",
    "downloadUrl": "https://openagent3.xyz/downloads/okx-dex",
    "agentUrl": "https://openagent3.xyz/skills/okx-dex/agent",
    "manifestUrl": "https://openagent3.xyz/skills/okx-dex/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/okx-dex/agent.md"
  }
}