L0vdL0vd

eth_getFilterChanges

Returns what a filter matched since the last poll: logs for a log filter, block hashes for a block filter.

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getFilterChanges","params":["0x03000000000000007c9413727849684b"]}'

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x0000000000000000000000008986fc0f130f92ae5f0c9b51236874412530f868"
      ],
      "data": "0x000000000000000000000000000000000000000000000000000000000010f4aa",
      "blockNumber": "0x1936550",
      "transactionHash": "0xb8f020faba49f0fabfa6c4c4db7ed471187c36fe6580ff34258f89153fef65b5",
      "transactionIndex": "0x1",
      "blockHash": "0x9465293ec8f8bf3dc190dd96bca70e8a73b32522e14d405df437b89f06c28447",
      "logIndex": "0x7",
      "removed": false
    },
    {
      "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x000000000000000000000000c127ffd0d5185dac262beff6512053f4aa00f445"
      ],
      "data": "0x000000000000000000000000000000000000000000000000000000000fac4248",
      "blockNumber": "0x1936550",
      "transactionHash": "0x6fe3fc5c051c23c7b1ccd5c1826440a95c2235562921ca66cb58091e8629319c",
      "transactionIndex": "0x7",
      "blockHash": "0x9465293ec8f8bf3dc190dd96bca70e8a73b32522e14d405df437b89f06c28447",
      "logIndex": "0xa",
      "removed": false
    }
  ]
}

示例中较长的数组和十六进制字符串已截断。

参数与您的端点

参数

filterIdstring必填
ID returned by eth_newFilter or eth_newBlockFilter.

返回值

array New log objects or block hashes since the previous call.

addressstring
Contract that emitted the log.
topicsarray
Up to four indexed topics; topic 0 is the event signature hash.
datastring
Non-indexed event arguments, ABI-encoded.
blockNumberstring
Block number, hex.
transactionHashstring
Hash of the transaction that emitted the log.
logIndexstring
Position of the log in the block, hex.
removedboolean
true if the log was removed by a reorg.

适用场景

Poll a filter for what happened since the last call: new logs or new block hashes.

如何解读结果

An array of logs (log filter) or block hashes (block filter). An empty array means nothing new yet.

提示

  • The example filter ID on this page has expired; run eth_newFilter first and paste the new ID into params.
  • Poll at about the block time: every 12 seconds on Ethereum, faster on L2s.

相关方法