DEX API
获取路径信息

获取路径信息#

通过欧易 DEX 跨链聚合器获取综合最优路径。

提示
DEX 公共 API 已停止使用,如您想继续使用 API 服务,请前往开发者管理平台进行申请。

请求地址#

GET https://www.okx.com/api/v5/dex/cross-chain/quote

请求参数#

参数类型必传描述
fromChainIdInteter源链 ID (如1: Ethereum,更多可查看链 ID 列表)
toChainIdInteter目标链 ID (如1: Ethereum,更多可查看链 ID 列表)
fromTokenAddressString询价币种合约地址 (如0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE )
toTokenAddressString目标币种合约地址 (如TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8 )
amountString币种询价数量
(数量需包含精度,如授权 1.00 USDT 需输入 1000000,授权 1.00 DAI 需输入 1000000000000000000 )
slippageString滑点限制
min:0.005 max:0.5
bridgeIdInteger指定跨链桥 ID (如211 )

响应参数#

参数类型必传描述
fromChainIdInteger源链 ID (如1: Ethereum,更多可查看链 ID 列表 )
toChainIdInteger目标链 ID (如1: Ethereum,更多可查看链 ID 列表 )
fromTokenAmountString询价币种的兑换数量 (如:500000000000000000000000)
fromTokenObject询价币种信息
decimalsInteger币种精度 (如: 18)
tokenContractAddressString币种合约地址 (如 :0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
tokenSymbolString币种简称 (如 WETH)
toTokenObject目标链币种基础信息
decimalsInteger币种精度(如: 6)
tokenContractAddressString币种合约地址(如: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
tokenSymbolString币种简称 (如: USDC)
routerListObject[]询价路径数据集合
routerObject跨链桥基础信息
bridgeIdInteger跨链桥 ID (如211)
bridgeNameString跨链桥名称 (如cBridge)
otherNativeFeeString跨链桥收取的 native token fee
crossChainFeeString跨链桥收取的费用,一般为稳定币或者WETH
crossChainFeeTokenAddressString跨链桥费币种信息(如:0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE 代表主网代币地址)
estimateGasFeeString以 wei 为单位的预估消耗的 gas
estimatedTimeString预估的跨链交易完成时间,以秒为单位
fromDexRouterListObject[]源链兑换路径基础信息, 如果不需要源链兑换路径则返回空
percentString一条路径中单一 DEX 协议的兑换资产占所有 DEX 协议百分比
routerString币种兑换的一条路径
subRouterListObject[]DEX router集合信息
dexProtocolObject[]兑换路径中执行的 DEX 协议
dexNameStringDEX 协议名称
fromTokenObject询价币种信息
decimalsInteger币种精度 (如: 18)
tokenContractAddressString币种合约地址 (如:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
tokenSymbolString币种简称 (如:WETH)
toTokenObject目标币种信息
decimalsInteger币种精度 (如: 6)
tokenContractAddressString币种合约地址 (如:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
tokenSymbolString币种符号 (如:USDC)
toDexRouterListObject[]目标链兑换路径基础信息,如果不需要目标链兑换路径则返回为空
percentString一条路径中单一 DEX 协议的兑换资产占所有 DEX 协议百分比
routerString币种兑换的一条路径
subRouterListObject[]DEX Router集合信息
dexNameStringDEX 协议名称
fromTokenObject询价币种信息
decimalsInteger币种精度如 (如: 18)
tokenContractAddressString币种合约地址(如:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
tokenSymbolString币种简称 (如:WETH)
toTokenObject目标币种信息
decimalsInteger币种精度 (如: 6
tokenContractAddressString币种合约地址 (如:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)
tokenSymbolString币种符号 (如:USDC)
minimumReceivedString目标币种的最小兑换数量 (兑换价格达到滑点限制的极限值时,目标币种的兑换数量)
needApproveInteger是否需要授权
toTokenAmountString目标币种的兑换数量

请求示例#

shell
curl --location --request GET 'https://www.okx.com/api/v5/dex/cross-chain/quote?amount=15&fromChainId=324&toChainId=42161&fromTokenAddress=0x3355df6d4c9c3035724fd0e3914de96a5a83aaf4&toTokenAddress=0xff970a61a04b1ca14834a43f5de4533ebddb5cc8&slippage=0.07' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

响应示例#

200
{
  "code":"0",
  "data":[
{
  "fromChainId":56,
  "fromToken":{
  "decimals":18,
  "tokenContractAddress":"0x55d398326f99059ff775485246999027b3197955",
  "tokenSymbol":"USDT"
},
  "fromTokenAmount":"30000000000000000000",
  "routerList":[
{
  "estimateTime":"290",
  "fromDexRouterList":[
{
  "router":"0x55d398326f99059ff775485246999027b3197955--0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c--0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
  "routerPercent":"100",
  "subRouterList":[
{
  "dexProtocol":[
{
  "dexName":"Uniswap V3",
  "percent":"100"
}
  ],
  "fromToken":{
  "decimals":18,
  "tokenContractAddress":"0x55d398326f99059ff775485246999027b3197955",
  "tokenSymbol":"USDT"
},
  "toToken":{
  "decimals":18,
  "tokenContractAddress":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "tokenSymbol":"WBNB"
}
},
{
  "dexProtocol":[
{
  "dexName":"Uniswap V3",
  "percent":"100"
}
  ],
  "fromToken":{
  "decimals":18,
  "tokenContractAddress":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
  "tokenSymbol":"WBNB"
},
  "toToken":{
  "decimals":18,
  "tokenContractAddress":"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
  "tokenSymbol":"USDC"
}
}
  ]
}
  ],
  "minimumReceived":"28635611",
  "needApprove":1,
  "router":{
  "bridgeId":235,
  "bridgeName":"swft",
  "crossChainFee":"1.090044714717251827012",
  "otherNativeFee":"0",
  "crossChainFeeTokenAddress":"0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"
},
  "toDexRouterList":[
{
  "router":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619--0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  "routerPercent":"100",
  "subRouterList":[
{
  "dexProtocol":[
{
  "dexName":"Uniswap V3",
  "percent":"100"
}
  ],
  "fromToken":{
  "decimals":18,
  "tokenContractAddress":"0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
  "tokenSymbol":"WETH"
},
  "toToken":{
  "decimals":18,
  "tokenContractAddress":"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
  "tokenSymbol":"WMATIC"
}
}
  ]
}
  ],
  "toTokenAmount":"28924860"
}
  ],
  "toChainId":42161,
  "toToken":{
  "decimals":6,
  "tokenContractAddress":"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
  "tokenSymbol":"USDC.e"
}
}
  ],
  "msg":""
}