Avalanche
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Avalanche
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_newFilter creates a server-side log filter on the Avalanche C-Chain (chain ID 43114, gas paid in AVAX) and returns a hex filter ID. You define which logs you care about — by block range, contract address, and indexed topics — once, then poll the ID with eth_getFilterChanges to receive only the new matching logs since your last poll, without re-sending the full filter each time. This is the efficient way to watch contract events such as ERC-20 transfers or DEX swaps over a long-running connection. Create the filter at https://avalanche.therpc.io/YOUR_API_KEY.
Transfer events on a short interval — the C-Chain's ~1–2s block time means a few-second poll keeps up — without re-specifying the full filter on every call.Swap events from a long-running indexer or bot.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | filter | object | 是 | Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]). |
| 类型 | 描述 |
|---|---|
| string | Hex filter ID. Pass this to eth_getFilterChanges, eth_getFilterLogs, or eth_uninstallFilter. |
Try it live in the Avalanche playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-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, recreate the filter and continue from where you left off.eth_subscribe over a WebSocket connection is more efficient than repeatedly polling a filter; reserve polling for HTTP-only setups.参数
Filter object. Fields: `fromBlock` (string), `toBlock` (string), `address` (string | string[]), `topics` ((string | string[] | null)[]).