Skip to main content

eth_getFilterChanges

Polling method for a filter, which returns an array of events that have occurred since the last poll on the Celo network.

Parameters​

  • id (string, required): The filter ID returned from eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter

Returns​

An array containing different data types depending on the filter type:

For log filters (eth_newFilter):​

Array of log objects with:

  • address (string): Address from which this log originated
  • topics (array of strings): Array of 0 to 4 32-byte DATA topics
  • data (string): Contains non-indexed arguments of the log
  • blockNumber (string): Block number where this log was included
  • blockHash (string): Hash of the block where this log was included
  • transactionHash (string): Hash of the transaction that created this log
  • transactionIndex (string): Transaction index position in the block
  • logIndex (string): Integer of the log index position in the block
  • removed (boolean): true when the log was removed due to a chain reorganization

For block filters (eth_newBlockFilter):​

Array of 32-byte block hashes for blocks that were newly created

For pending transaction filters (eth_newPendingTransactionFilter):​

Array of 32-byte transaction hashes for transactions that entered the pending state

Implementation Example​

curl -X POST https://api-celo-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getFilterChanges",
"params": ["0x16"],
"id": 1
}'

Response Example​

For log filters:​

{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x1234567890abcdef1234567890abcdef12345678",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000",
"blockNumber": "0x1b4",
"blockHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
"transactionHash": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"transactionIndex": "0x1",
"logIndex": "0x0",
"removed": false
}
]
}

For block filters:​

{
"jsonrpc": "2.0",
"id": 1,
"result": [
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321"
]
}

Notes​

  • This method only returns changes that occurred since the last poll
  • Filters timeout if not accessed within a certain time period (typically 5 minutes)
  • The first call to eth_getFilterChanges returns all events since filter creation
  • Subsequent calls return only new events since the previous call
  • Use eth_getFilterLogs to retrieve all accumulated logs regardless of polling

Need help? Contact our support team or check the Celo documentation.