eth_getFilterChanges
Polling method for a filter on Zetachain, returns an array of logs since last poll.
Use Cases#
- Event streaming - Get new events incrementally
- Real-time monitoring - Track contract activity for omnichain DeFi, native Bitcoin smart contracts, cross-chain asset management, and unified liquidity aggregation
- Efficient indexing - Process only new events
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
filterId | QUANTITY | Yes | Filter ID from eth_newFilter |
Request#
{
"jsonrpc": "2.0",
"method": "eth_getFilterChanges",
"params": ["0x1"],
"id": 1
}
Code Examples#
- cURL
- JavaScript
curl -X POST https://api-zetachain-mainnet-archive.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getFilterChanges",
"params": ["0x1"],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-zetachain-mainnet-archive.dwellir.com/YOUR_API_KEY');
// Poll loop
async function pollFilter(filterId, interval = 2000) {
while (true) {
const changes = await provider.send('eth_getFilterChanges', [filterId]);
if (changes.length > 0) {
console.log('New events:', changes);
}
await new Promise(r => setTimeout(r, interval));
}
}
Related Methods#
eth_newFilter- Create filtereth_uninstallFilter- Remove filter