根据地址获取事件日志#
查询指定合约地址产生的事件日志,按游标(cursor)翻页返回。本接口仅支持 EVM 系公链。
支持的链:见获取事件日志 API 支持的链(apiName:by-address)。
请求地址#
GET
https://web3.okx.com/api/v6/explorer/log/by-address请求参数#
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识,如 ETH 为 1、BTC 为 0;支持范围见获取事件日志 API 支持的链 |
| address | String | 是 | 合约地址 |
| cursor | String | 否 | 上次响应返回的游标;不传或传空串从第一页开始 |
| limit | String | 否 | 每页条数,默认 100,最大 1000 |
响应参数#
| 参数名 | 类型 | 描述 |
|---|---|---|
| limit | String | 本页条数上限 |
| cursor | String | 下一页游标;空串表示没有更多。请求时原样回传,客户端不应解析或构造 |
| logList | Array | 事件日志列表 |
| > height | String | 区块高度 |
| > address | String | 产生该事件日志的合约地址 |
| > topics | Array | topic 列表,元素为 String |
| > data | String | 事件日志的 data 数据,十六进制字符串 |
| > methodId | String | methodId,触发该日志的方法标识 |
| > blockHash | String | 区块哈希 |
| > transactionTime | String | 交易时间,Unix 时间戳的毫秒数格式 |
| > logIndex | String | 日志 index |
| > txId | String | 交易哈希 |
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v6/explorer/log/by-address?chainIndex=1&address=0xdac17f958d2ee523a2206206994597c13d831ec7&limit=100' \
--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'
响应示例#
json
{
"code": "0",
"msg": "",
"data": [
{
"limit": "100",
"cursor": "100",
"logList": [
{
"height": "21284102",
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
"0x0000000000000000000000001b7baa734c00298b9429b518d621753bb0f6eff2",
"0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45"
],
"data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"methodId": "0x095ea7b3",
"blockHash": "0x5c7e9a2d4f6b8c0e1a1f3c5a0d9e7b2c4a6d8f0b1c3e5a7d9f2b4c6e8a0d1f3b",
"transactionTime": "1733198723000",
"logIndex": "42",
"txId": "0xb8e6c4a1f9d3b5e7c0a2d4f6b8e1c3a5d7f9b2e4c6a8d0f37d4b1e9c3a5f70d2"
}
]
}
]
}
