Swap API
OKX DEX is an aggregator of various decentralized exchanges (also known as DEXs, such as Uniswap, Curve, Balancer, etc.) on different blockchains, allowing multi-chain and cross-chain trading. Our goal is to provide users with the best possible prices through intelligent routing.
OKX DEX inquiry and transaction process |
---|
|
- Automatically find liquidity pools with the maximum on-chain liquidity depth
- Comprehensively calculate price, slippage, and transaction costs
- Select the best quote for users based on a comprehensive comparison of quotes from various DEXs and PMMs through the smart order splitting algorithm
OKX DEX Swap trading process |
---|
|
- Get information of the supported networks through /supported/chain.
- Get information of the supported tokens through /aggregator/all-tokens.
- Build the request for /quote data based on information of the supported networks and tokens.
- Following the quote request, obtain the user’s authorization to allow the OKX DEX router to perform asset operations on their wallet.
- Build the request for /approve-transaction to get the user’s wallet authorization.
- Build /swap information based on the returned quote router data and obtain the transaction data required for the swap.
- Broadcast the returned swap transaction information to the blockchain.