OpenViSTAI · Agents · Blockchain · Crypto
Menu
Exchanges & Trading

OKX DEX Scripts

OKX DEX Scripts is a public TypeScript repository of scripts for interacting with the OKX DEX API. It covers single-chain and cross-chain DEX operations across EVM-compatible networks, Solana, TON and TRON, with examples for quotes, swap data, token and chain information, liquidity, bridges and swaps.

Independent OpenViST project profile, based on linked sources.

OKX DEX Scripts — OpenViST project profile in Exchanges & Trading.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you are building with the OKX DEX API and want TypeScript scripts and a documented Node.js workflow for specific network operations.

Who it is for

  • Developers integrating OKX DEX API operations into Node.js or TypeScript projects.
  • Builders who need examples for single-chain quotes, swap-related data or cross-chain DEX requests.
  • Developers adapting network-specific DEX scripts for applications or services.

Documented uses

  • Request swap quotes using chain IDs, token addresses, amount and slippage parameters.
  • Retrieve token, chain, liquidity and bridge information through the provided scripts.
  • Explore cross-chain quote operations and the repository’s documented Solana swap command.
  • Use the shared authentication utility to generate signed headers for OKX API requests.
Before you choose

Requirements & limits

The repository is public and provides Git clone instructions. Its setup requires OKX API credentials; a Web3 wallet is listed for generating those credentials.

  • Requires Node.js 20.17.0 or later, Git and npm.
  • API authentication uses a project ID, API key, secret key and passphrase.
  • The README shows wallet address and private key environment values; protect secrets and avoid committing the .env file.
  • Quote requests need valid chain and token addresses, an amount in the token’s smallest unit and a slippage parameter.
  • The README identifies EVM, Solana, TON and TRON, and says EVM scripts accept valid EVM chain IDs.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Request a Solana swap quote using the documented example

Generate authenticated headers and send the example SOL-to-USDC quote request.

Before you start

  • The repository setup and required OKX credentials, including project ID, API key, secret key, and passphrase
  • A Solana quote request using chain ID 501 and token addresses shown in the README

Steps

  1. Set the request parameters to chain ID 501, wrapped SOL as the source token, USDC as the destination token, amount 10000000000 in lamports, and slippage 0.1.

  2. Create an ISO timestamp and set the request path to /api/v5/dex/aggregator/quote; serialize the parameters as a query string.

  3. Use the shared getHeaders utility with the timestamp, GET method, request path, and query string to generate signed headers.

  4. Send a GET request to https://www.okx.com followed by the request path and query string, using the generated headers.

Expected outcome

The example sends an authenticated Solana quote request to the OKX DEX API; the README identifies `lib/solana/swap/solana-quote.ts` as the complete implementation.

Guide limitations

  • The documented example shows how to send the request but does not provide a verified response or guarantee a quote.
  • The example is a quote request, not a swap execution.
  • The shared authentication utility requires the OKX credential environment variables.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
17 October 2026
Original website title
okx/dex-api-library · Official homepage title · retained in its source language