Optimism
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Optimism
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
eth_newFilter creates a server-side log filter on OP Mainnet — the ETH-gas OP Stack rollup at chain ID 10 (0xa) — and returns a hex filter ID. You define the criteria once (a block range, one or more contract addresses, and indexed topics), then poll the ID with eth_getFilterChanges to pull only the matching logs emitted since your last poll, without re-sending the full filter each time. This is the polling counterpart to a WebSocket eth_subscribe logs subscription. Create the filter against https://optimism.therpc.io/YOUR_API_KEY.
Transfer events on an OP Mainnet token by setting address and the Transfer topic once, then calling eth_getFilterChanges on a short interval — every couple of blocks, since OP Mainnet produces one roughly every 2 seconds.Swap events in a long-running process — for example a Velodrome pool — by registering its address and topic and incrementally draining new logs as trades land.| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | filter | object | Ja | Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]). |
| Typ | Beschreibung |
|---|---|
| string | Hex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter. |
Try it live in the Optimism playground.
| Code | Meldung | Ursache |
|---|---|---|
-32000 | filter not found | Provider rejected filter creation, or filter limit per connection was reached. |
-32602 | invalid argument | Malformed filter object or invalid topic format. |
eth_getFilterChanges returns filter not found, you re-register the filter and continue from the last block you processed.eth_subscribe logs subscription is more efficient than repeatedly polling a filter — reserve eth_newFilter for HTTP-only or batch-style consumers.Parameter
Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).