Marketplace has launched, further enabling blockchain developers! Learn more

Contents

eth_newFilter RPC method

The eth_newFilter EVM method is only supported on the Avalanche C-Chain.

Parameters:

  1. Object - Should contain filter information, all keys are optional:

    fromBlock - (Optional) Integer block number encoded as a hexadecimal, "latest","pending", or "earliest" tags.

    toBlock - (Optional) Integer block number encoded as a hexadecimal, "latest","pending", or "earliest" tags.

    address - (Optional) Contract address or a list of addresses from which logs should originate.

    topics - (Optional) Array of DATA topics. Topics are order-dependent. Go here to learn more about topics.

Returns:

  1. Result - A filter id - to be used when calling eth_getFilterChanges.

Code Examples:

To use the eth_newFilter EVM method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.

const ethers = require("ethers");

const filter = {
  fromBlock: "0xe20360",
  toBlock: "0xe20411",
  address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
};

(async () => {
  const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/");
  const filterId = await provider.send("eth_newFilter", [filter]);
  console.log(filterId);
})();
Ready to get started? Create a free account