查询交易状态#
根据 txhash 查询单链兑换最终交易状态。
请求地址#
GET https://web3.okx.com/api/v5/dex/aggregator/history
请求参数#
| 参数 | 类型 | 必传 | 描述 | 
|---|---|---|---|
| chainIndex | String | 是 | 链的唯一标识。 如 1: Ethereum,更多可查看这里。 | 
| chainId | String | 是 | 链的唯一标识。 即将废弃。 | 
| txHash | String | 是 | 通过 OKX DEX API 发出的兑换交易 hash | 
| isFromMyProject | Boolean | 否 | "传 true,判断是否来自当前请求的 API Key 下的订单。不传或传 false,查询任意来自 OKX DEX API 发出的订单" | 
响应参数#
| 参数 | 类型 | 描述 | 
|---|---|---|
| chainId | String | 链的唯一标识。 (如1: Ethereum,更多可查看这里) | 
| txHash | String | 交易 Hash | 
| height | String | 交易发生的区块高度 | 
| txTime | String | 交易时间;Unix时间戳的毫秒数格式 | 
| status | String | pending(执行中)success(成功)fail(失败) | 
| txType | String | 交易行为。Approve,Wrap,Unwrap,Swap | 
| fromAddress | String | 发送地址 | 
| dexrouter | String | 交互地址 | 
| toAddress | String | 接收地址 | 
| fromTokenDetails | Array | 询价详情 | 
| >symbol | String | 询价币种简称 | 
| >amount | String | 询价币种的兑换数量,按最小数量返回,如 ETH 链,wei。 | 
| >tokenAddress | String | 询价币种合约地址 (如0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) | 
| toTokenDetails | Array | 兑换详情 | 
| >symbol | String | 目标币种简称 | 
| >amount | String | 目标币种的兑换数量,按最小数量返回。 | 
| >tokenAddress | String | 目标币种合约地址 (如0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) | 
| referalAmount | String | 分佣金额 | 
| errorMsg | String | 错误信息 | 
| gasLimit | String | gas限额 | 
| gasUsed | String | gas消耗。以最小数量返回,例如 ETH 链,wei。 | 
| gasPrice | String | gas价格。以最小数量返回,例如 ETH 链,wei。 | 
| txFee | String | 手续费,返回主链币消耗数量,Solana 链和 SUI 链交易时返回 | 
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v5/dex/aggregator/history?chainIndex=784&txHash=5GePcvqEakoUtArW8PHULDSQds95vcgeiTznvbnb8hCV' \
--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": {
        "chainIndex": "784",
        "dexRouter": "0x51159f25f262ae01e87532b673de3b38df8f0ecc2dc0581f1033df6b84b84955",
        "errorMsg": "",
        "fromAddress": "0x4b9df646075d8621e2578f14818427e4c708709744ea3b827136056f85f88da7",
        "fromTokenDetails": {
            "amount": "892919000000.000",
            "symbol": "HIPPO",
            "tokenAddress": "0x8993129d72e733985f7f1a00396cbd055bad6f817fee36576ce483c8bbb8b87b::sudeng::SUDENG"
        },
        "gasLimit": "",
        "gasPrice": "",
        "gasUsed": "",
        "height": "99502953",
        "referralAmount": "892919000",
        "status": "success",
        "toAddress": "0x4b9df646075d8621e2578f14818427e4c708709744ea3b827136056f85f88da7",
        "toTokenDetails": {
            "amount": "1532443840.00000000",
            "symbol": "SUI",
            "tokenAddress": "0x2::sui::SUI"
        },
        "txFee": "7976416",
        "txHash": "5GePcvqEakoUtArW8PHULDSQds95vcgeiTznvbnb8hCV",
        "txTime": "1736390263909",
        "txType": "swap"
    },
    "msg": ""
}
