Updated on 2024-11-14 GMT+08:00

eth_getFilterChanges

Introduction

The polling method for a filter, which returns an array of logs which occurred since last poll. Call eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter to create a filter. It consumes 108 CUs.

Parameter Description

Parameter

Type

Description

Filter ID

String

The string of the filter ID.

Return Value

  • log object array: an array of log objects, or an empty array if nothing has changed since last poll.
  • For filters created with eth_newBlockFilter, the return values are block hashes (32 bytes), for example, ["0x3454645634534..."].
  • For filters created with eth_newFilter, the logs are objects with the following parameters:
    • address: the address from which this log originated.
    • blockHash: the hash of the block where this log was in. It is null for a pending log.
    • blockNumber: the number of the block where this log was in. It is null for a pending log.
    • data: the non-indexed arguments of the log.
    • logIndex: the hexadecimal of the log index position in the block. It is null for a pending log.
    • removed: true when the log was removed due to a chain reorganization. false if it is a valid log.
    • topics: an array of zero to four 32-byte data of the index 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.
    • transactionHash: 32 bytes. The hash of the transactions from which this log was created. It is null for a pending log.
    • transactionIndex: the hexadecimal of the transactions index position from which the log created. It is null for a pending log.

Request

curl https://your-http-endpoint/v1/<API-KEY> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x16"],"id":73}'