获取交易历史#
查询地址维度下的6个月内的交易历史,按时间倒序排列。
请求路径#
GET https://web3.okx.com/api/v6/dex/post-transaction/transactions-by-address
请求参数#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| address | String | 是 | 具体某条链的账户地址。 | 
| chains | String | 是 | 筛选需要获取交易历史的链,多条链以","分隔。最多支持 50 个。(如 1代表Ethereum。更多可查看这里。) | 
| tokenContractAddress | String | 否 | 代币地址。 1:传""代表查询对应链的主链币。2:传具体的代币合约地址,代表查询对应的代币。3:不传,代表查询主链币和所有代币。 | 
| begin | String | 否 | 开始时间,查询晚于该时间的交易历史。Unix 时间戳,用毫秒表示。 | 
| end | String | 否 | 结束时间,查询早于该时间的交易历史。若 begin 和 end 都不传,查询当前时间以前的交易历史。Unix 时间戳,用毫秒表示。 | 
| cursor | String | 否 | 游标。 | 
| limit | String | 否 | 返回条数,默认返回最近的 20 条。多链查询最多支持 20 条,单链查询最多 100 条。 | 
响应参数#
| Parameter | Type | Description | 
|---|---|---|
| transactions | Array | 交易列表 | 
| >chainIndex | String | 链 ID | 
| >txHash | String | 交易 hash | 
| >itype | String | 交易的层级类型 0:外层主链币转移1:合约内层主链币转移2:token转移 | 
| >methodId | String | 合约调用函数 | 
| >nonce | String | 发起者地址发起的第几笔交易 | 
| >txTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 | 
| >from | Array | 交易输入 | 
| >>address | String | 发送/输入地址,多签交易时,逗号分隔 | 
| >>amount | String | 输入数量 | 
| >to | Array | 交易输出 | 
| >>address | String | 接收。输出地址,多签交易时,逗号分隔 | 
| >>amount | String | 输出数量 | 
| >tokenContractAddress | String | 代币的合约地址 | 
| >amount | String | 交易数量 | 
| >symbol | String | 交易数量对应的币种 | 
| >txFee | String | 手续费 | 
| >txStatus | String | 交易状态、success 成功、fail 失败、pending 等待确认 | 
| >hitBlacklist | Boolean | false:不是黑名单 true:是黑名单 | 
| cursor | String | 游标 | 
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api//v5/dex/post-transaction/transactions-by-address?address=0x50c476a139aab23fdaf9bca12614cdd54a4244e4&chains=1'\
--header 'Content-Type: application/json' \
--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",
    "msg": "success",
    "data": [
        {
            "cursor": "1706197403",
            "transactionList": [
                {
                    "chainIndex": "1",
                    "txHash": "0x963767695543cfb7804039c470b110b87adf9ab69ebc002b571523b714b828ca",
                    "methodId": "",
                    "nonce": "",
                    "txTime": "1724213411000",
                    "from": [
                        {
                            "address": 
                                "0xae7ab96520de3a18e5e111b5eaab095312d7fe84"
                                "amount": ""
                        }
                    ],
                    "to": [
                        {
                            "address": 
                                "0x50c476a139aab23fdaf9bca12614cdd54a4244e4"
                                "amount": ""
                        }
                    ],
                    "tokenContractAddress": "0xe13c851c331874028cd8f681052ad3367000fb13",
                    "amount": "1",
                    "symbol": "claim rewards on stethdao.net",
                    "txFee": "",
                    "txStatus": "success",
                    "hitBlacklist": true,
                    "tag": "Risk Airdrop",
                    "itype": "2"
                }
            ]
        }
    ]
}
