🚀 We’re excited to announce our $35m Series A led by Tiger Global: Press Release, Coindesk, Bloomberg, Business Insider & RefreshMiami!

Contents

eth_getFilterChanges RPC method

Parameters:

  1. Quantity - The filter id that is returned from eth_newFilter, eth_newBlockFilter or eth_newPendingTransactionFilter, .

Returns:

  1. Array - Array of one of the following, depending on the filter type, or empty if no changes since last poll:
    • eth_newBlockFilter

      blockHash - The 32 byte hash of a block that meets your filter requirements.

    • eth_newPendingTransactionFilter

      transactionHash - The 32 byte hash of a transaction that meets your filter requirements.

    • eth_newFilter

      removed - Boolean true if log was removed, due to a chain reorganization. false if its a valid log.

      logIndex - Integer of log index position in the block encoded as a hexadecimal. null if pending.

      transactionIndex - Integer of transactions index position log was created from. null if pending.

      transactionHash - Hash of the transactions this log was created from. null if pending.

      blockHash - Hash of the block where this log was in. null when its pending. null if pending.

      blockNumber - The block number where this log was, encoded as a hexadecimal. null if pending.

      address - The address from which this log originated.

      data - Contains one or more 32 Bytes non-indexed arguments of the log.

      topics - Array of 0 to 4 32 Bytes of indexed log arguments.

Code Examples:

const ethers = require("ethers");

const filter = {
  fromBlock: "0x1",
  toBlock: "0x2",
  address: "0x8888f1f195afa192cfee860698584c030f4c9db1",
  topics: [
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
  ],
};

(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);
  const logs = await provider.send("eth_getFilterChanges", [filterId]);
  console.log(logs);
})();
Ready to try QuickNode? Start your 7-day free trial