Cross-chain API

Cross-chain API#

OKX DEX is an aggregator of various high-quality bridges currently on the market (such as Stargate, Across, Celer cBridge, SWFT, etc.) that provides users with multiple cross-chain path choices. It allows users to conduct swaps on the source chain, subsequent cross-chain transactions, and swaps on the destination chain for the desired tokens. OKX’s X Routing algorithm finds the best price across every DEX. We compare prices from Liquidity Providers (LPs) with the best liquidity pools, split orders, and take into consideration prices, slippage, and network gas fees. We then compare the prices of multiple bridges, and obtain the optimal cross-chain quote after comprehensively calculating the amount of cross-chain transactions, cross-chain bridge fees, slippage, and transaction costs.

  • Allow more projects to easily and quickly access the DEX cross-chain aggregator.
  • Convenient, easy to understand, and safe during access and use.
OKX DEX cross-chain quote process
  • The core components mainly include swaps and bridges.
  • Swaps and bridges are combined into different trading modes based on different token pairs, These modes include swapping in the source DEX pool and then using a bridge to complete the transaction, using a bridge to complete the transaction in a single step, and swapping on the source chain first before using a bridge and then swapping on the destination chain to complete the cross-chain swap.
  • Swaps and bridges need on-chain data analysis to complete the whole transaction process.
  • The DEX XBridge contract is the core of the transaction. It supports cross-chain transactions between mainstream EVM chains and between heterogeneous chains.
OKX DEX cross-chain trading process
  • First, get information of the supported chain through /supported/chain.
  • Build the request for /quote data based on information of the supported chain.
  • Build /build-tx information based on the returned quote router data.
  • Broadcast the returned transaction hash information on the chain.
  • Use /status to check the details of this cross-chain transaction based on the hash received from the broadcast.