API Reference

eth_getFilterLogs

Xlayer API - Returns an array of all logs matching filter with given id. Can compute the same results with an eth_getLogs call (see hint below).

Parameters

  • QUANTITY - The filter id.
params: ["0x0700000000000000bf0b1f4b27e765fb"];

Returns

Array - Array of log objects, or an empty array if nothing has changed since last poll.

  • For filters created with eth_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. ["0x3454645634534..."].
  • For filters created with eth_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].
  • For filters created with eth_newFilter logs are objects with following params:
    • removed: TAG - true when the log was removed, due to a chain reorganization. false if its a valid log.
    • logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.
    • transactionIndex: QUANTITY - integer of the transactions index position log was created from. null when its pending log.
    • transactionHash: DATA, 32 Bytes - hash of the transactions this log was created from. null when its pending log.
    • blockHash: DATA, 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log.
    • blockNumber: QUANTITY - the block number where this log was in. null when its pending. null when its pending log.
    • address: DATA, 20 Bytes - address from which this log originated.
    • data: DATA - contains one or more 32 Bytes non-indexed arguments of the log.
    • topics: Array of DATA - Array of 0 to 4 32 Bytes DATA of indexed log arguments.
      • In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declare the event with the anonymous specifier.

Example

Request

curl https://xlayer-mainnet.unifra.io/v1/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x0700000000000000bf0b1f4b27e765fb"],"id":0}'
URL: https://xlayer-mainnet.unifra.io/v1/your-api-key
RequestType: POST
Body:
{
    "jsonrpc":"2.0",
    "method":"eth_getFilterLogs",
    "params":["0x0700000000000000bf0b1f4b27e765fb"],
    "id":0
}

Result

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": [
    {
      "address": "0x2ef3723bb09c311d035334b11614efadbd0d7a24",
      "topics": [
        "0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1"
      ],
      "data": "0x00000000000000000000000000000000000000000014e30b7097abb8528e67dc00000000000000000000000000000000000000000000002da4b76b838c8ae316",
      "blockNumber": "0x226f3c1",
      "transactionHash": "0x0eefcbd79fdf2a32f73e3fe1be5df2a03a4845e65fa8b71c69b7eaf201e02a2e",
      "transactionIndex": "0x5",
      "blockHash": "0xd7931d354db9cdcee8048297b667fa35b7457bb10f1f8089f937e4a34d8d0f78",
      "logIndex": "0x6",
      "removed": false
    },
    {
      "address": "0x2ef3723bb09c311d035334b11614efadbd0d7a24",
      "topics": [
        "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822",
        "0x000000000000000000000000881fb2f98c13d521009464e7d1cbf16e1b394e8e",
        "0x0000000000000000000000004358e3edbf719b5391da4de343d3f2e4b6b183e0"
      ],
      "data": "0x0000000000000000000000000000000000000000000001b0b8635811691400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003af8b13117ee93c",
      "blockNumber": "0x226f3c1",
      "transactionHash": "0x0eefcbd79fdf2a32f73e3fe1be5df2a03a4845e65fa8b71c69b7eaf201e02a2e",
      "transactionIndex": "0x5",
      "blockHash": "0xd7931d354db9cdcee8048297b667fa35b7457bb10f1f8089f937e4a34d8d0f78",
      "logIndex": "0x7",
      "removed": false
    },
    {
      "address": "0x2ef3723bb09c311d035334b11614efadbd0d7a24",
      "topics": [
        "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822",
        "0x000000000000000000000000881fb2f98c13d521009464e7d1cbf16e1b394e8e",
        "0x0000000000000000000000004358e3edbf719b5391da4de343d3f2e4b6b183e0"
      ],
      "data": "0x000000000000000000000000000000000000000000000016c656121bdd1c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031ad3448983df6",
      "blockNumber": "0x226f3c1",
      "transactionHash": "0x0eefcbd79fdf2a32f73e3fe1be5df2a03a4845e65fa8b71c69b7eaf201e02a2e",
      "transactionIndex": "0x5",
      "blockHash": "0xd7931d354db9cdcee8048297b667fa35b7457bb10f1f8089f937e4a34d8d0f78",
      "logIndex": "0x12",
      "removed": false
    }
  ]
}
Language
Click Try It! to start a request and see the response here!