批量查询区块交易列表#
批量获取公链下的某些区块的交易列表,最多返回最近10000笔交易。
请求路径#
GET
https://web3.okx.com/api/v5/xlayer/block/transaction-list-multi请求参数#
| 参数名 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| chainShortName | String | 是 | 公链缩写符号,例如 XLAYER |
| startBlockHeight | String | 是 | 开始查询的区块高度 |
| endBlockHeight | String | 是 | 结束查询的区块高度 |
| protocolType | String | 否 | 不同类型的交易 普通交易:transaction 内部交易:internal 20代币:token_20 721代币:token_721 1155代币:token_1155 默认是transaction |
| limit | String | 否 | 返回条数,默认返回最近的20条,最多100条 |
| page | String | 否 | 页码 |
响应参数#
| 参数名 | 类型 | 描述 |
|---|---|---|
| page | String | 当前页码 |
| limit | String | 当前页共多少条数据 |
| totalPage | String | 总共多少页 |
| chainFullName | String | 公链全称,例如:X Layer |
| chainShortName | String | 公链缩写符号,例如:XLAYER |
| transactionList | Array | 交易列表 |
| > txId | String | 交易哈希 |
| > methodId | String | 方法 |
| > blockHash | String | 区块哈希 |
| > height | String | 交易发生的区块 |
| > transactionTime | String | 交易时间;Unix时间戳的毫秒数格式,如 1597026383085 |
| > from | String | 发送方地址 |
| > isFromContract | Bol | From地址是否是合约地址 |
| > isToContract | Bol | To地址是否是合约地址 |
| > to | String | 接收方地址 |
| > amount | String | 交易数量 |
| > transactionSymbol | String | 交易数量对应的币种 |
| > txFee | String | 手续费 |
| > state | String | 交易状态 success:成功 fail:失败 pending:等待确认 |
| > tokenId | String | NFT的ID |
| > tokenContractAddress | String | 代币合约地址 |
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v5/xlayer/block/transaction-list-multi?chainShortName=xlayer&startBlockHeight=31118669&endBlockHeight=31118670&limit=1' \
--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": [
{
"page": "1",
"limit": "1",
"totalPage": "12",
"transactionList": [
{
"height": "31118670",
"txId": "0x41c1001e8fb26edd4b2ccf9856daa0e90a0c523466bb90378529536269523619",
"methodId": "0xc480dd84",
"blockHash": "0xe5472915fcd492f0c0b65103959925888d4bae32ae008ba87bca85b48fc59225",
"transactionTime": "1755483960000",
"from": "0x4323c64481650c3edcad6be9f4feaa85931005ac",
"isFromContract": false,
"isToContract": true,
"to": "0xed65f249af632aba04737b570be3680e98d5ea37",
"amount": "0",
"transactionSymbol": "OKB",
"txFee": "0.000865481865481",
"state": "success",
"tokenId": "",
"tokenContractAddress": ""
}
]
}
]
}
