What problem does it solve?
Indexing every event on a chain wastes processing time when you only care about specific addresses or parameter values. This Skill shows how to use the HyperIndex where handler option to filter events by indexed parameters, cutting down the volume of events your handlers must process.
Core Features & Use Cases
- Static Filters: Pass a single object (AND across fields) or an array of objects (OR across entries) to match indexed event parameters like
from and to addresses.
- Dynamic Per-Chain Filters: Use a function receiving
{ chain } to return different filters per chain ID, skip chains entirely with return false, or filter by dynamically registered contract addresses via chain.<ContractName>.addresses.
- Per-Event startBlock: Set
block.number._gte (or block.height._gte on Fuel) to override the contract-level start_block for a single event.
- Use Case: You index ERC20 Transfer events across chains 100 and 137 but only care about transfers involving a whitelist of addresses. Use the function form of
where to return OR'd param filters per chain and skip all other chains.
Quick Start
Ask the AI to add a where filter to your ERC20 Transfer event handler so it only processes transfers involving your whitelisted addresses on specific chains.