Skip to main content
POST
eth_newFilter
curl --request POST \
  --url https://rpc.testnet.tempo.xyz/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "eth_newFilter",
  "params": [
    {
      "fromBlock": "latest",
      "toBlock": "latest",
      "address": "0x20c0000000000000000000000000000000000000",
      "topics": []
    }
  ],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
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();

Body

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

Filter object

id
integer
default:1

Response

200 - application/json

The filter ID

jsonrpc
string
id
integer
result
string

The filter ID