Skip to main content
Tempo API method that creates a new filter for logs matching specified criteria. The filter can be polled with eth_getFilterChanges.

Parameters

  • filterObject — the filter object:
    • fromBlock — (optional) block number (hex) or tag to start from
    • toBlock — (optional) block number (hex) or tag to end at
    • address — (optional) contract address or array of addresses
    • topics — (optional) array of topic filters

Response

  • result — the filter ID

eth_newFilter code examples

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

const PATHUSD = "0x20c0000000000000000000000000000000000000";

const createFilter = async () => {
    const filterId = await provider.send("eth_newFilter", [{
      address: PATHUSD,
      fromBlock: "latest",
      toBlock: "latest"
    }]);
    console.log(`Filter ID: ${filterId}`);
  };

createFilter();