Skip to main content
POST
eth_getFilterChanges
curl --request POST \
  --url https://rpc.testnet.tempo.xyz/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "eth_getFilterChanges",
  "params": [
    "0x..."
  ],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": [
    "<unknown>"
  ]
}
Tempo API method that returns an array of logs or block/transaction hashes that occurred since the last poll. Used with filters created by eth_newFilter, eth_newBlockFilter, or eth_newPendingTransactionFilter.

Parameters

  • filterId — the filter ID returned from a filter creation method

Response

  • result — array of changes since last poll:
    • For log filters: array of log objects
    • For block filters: array of block hashes
    • For pending transaction filters: array of transaction hashes

eth_getFilterChanges code examples

const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

// pathUSD token address
const PATHUSD = "0x20c0000000000000000000000000000000000000";
const TRANSFER_TOPIC = ethers.id("Transfer(address,address,uint256)");

const pollFilter = async () => {
    // Create a log filter for Transfer events
    const filterId = await provider.send("eth_newFilter", [{
      address: PATHUSD,
      topics: [TRANSFER_TOPIC]
    }]);
    console.log(`Created filter: ${filterId}`);

    // Poll for changes every 2 seconds
    const interval = setInterval(async () => {
      const changes = await provider.send("eth_getFilterChanges", [filterId]);

      if (changes.length > 0) {
        console.log(`\nFound ${changes.length} new Transfer events:`);
        for (const log of changes) {
          console.log(`  Block ${parseInt(log.blockNumber, 16)}: ${log.transactionHash}`);
        }
      } else {
        console.log("No new changes...");
      }
    }, 2000);

    // Stop after 20 seconds
    setTimeout(async () => {
      clearInterval(interval);
      await provider.send("eth_uninstallFilter", [filterId]);
      console.log("\nFilter uninstalled");
    }, 20000);
  };

pollFilter();

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_getFilterChanges
params
any[]

Filter ID

id
integer
default:1

Response

200 - application/json

Filter changes

jsonrpc
string
id
integer
result
any[]

Array of log objects or block hashes depending on filter type