Polygon
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Polygon
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
eth_newFilter registers a server-side log filter — defined by an address, a block range, and topic criteria — and returns a hex filter ID. You poll that ID with eth_getFilterChanges to pull only the logs that matched since your last poll, without resending the full filter each time. On Polygon, the MATIC-powered PoS chain at https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89), this is the standard way to follow contract events over plain HTTP — handy for tracking activity on busy DeFi venues like QuickSwap or Aave.
Transfer events — for instance from the Polygon USDT contract at 0xc2132D05D31c914a87C6611C10748AEb04B58e8F — on a short interval without re-specifying the full filter each round.Swap events from a long-running indexer or bot, letting the server track your position in the log stream between polls.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | filter | object | Sí | Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]). |
| Tipo | Descripción |
|---|---|
| string | Hex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter. |
Try it live in the Polygon playground.
| Código | Mensaje | Causa |
|---|---|---|
-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. |
filter not found error from eth_getFilterChanges by recreating the filter and resuming from a known block.eth_subscribe log subscription over WebSocket pushes matches to you and is more efficient than repeatedly polling a filter.Parámetros
Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).