mit einem Klick
indexing-filters
// Use when filtering events by indexed parameters to reduce processing volume. eventFilters with static arrays, dynamic per-chain functions, contract address filtering, and conditional enable/disable.
// Use when filtering events by indexed parameters to reduce processing volume. eventFilters with static arrays, dynamic per-chain functions, contract address filtering, and conditional enable/disable.
Use when processing every block (or every Nth block) for time-series data, periodic snapshots, or block-level aggregations. onBlock API, interval option, and block handler context.
Use when writing or editing config.yaml. Chain/contract structure, addresses, start_block, event selection, field_selection, custom event names, env vars, address_format, schema/output paths, YAML validation, and deprecated options.
Use when making RPC calls, fetch requests, or any external I/O from handlers. Effect API with createEffect, S schema validation, context.effect(), preload optimization (handlers run twice), cache and rateLimit options.
Use when indexing contracts deployed by factory contracts at runtime. contractRegister API, dynamic contract config (no address), async registration, and same-block event coverage.
Use when writing or editing event handlers. Handler registration, context API (entity CRUD, getWhere queries, chain, log), spread updates, indexer runtime API, and common pitfalls.
Use when deploying an indexer across multiple chains. Entity ID namespacing to avoid collisions, chain-specific configuration patterns, and the context.chain runtime API.
| name | indexing-filters |
| description | Use when filtering events by indexed parameters to reduce processing volume. eventFilters with static arrays, dynamic per-chain functions, contract address filtering, and conditional enable/disable. |
The eventFilters handler option filters events by indexed parameters. Works with or without wildcard: true.
ERC20.Transfer.handler(
async ({ event, context }) => { /* ... */ },
{
wildcard: true,
eventFilters: [{ from: ZERO_ADDRESS }, { to: ZERO_ADDRESS }],
}
);
Each filter object is OR'd together. Within a filter, fields are AND'd. Arrays in a field position match any value in the array.
ERC20.Transfer.handler(
async ({ event, context }) => { /* ... */ },
{
wildcard: true,
eventFilters: { from: ZERO_ADDRESS, to: WHITELISTED },
}
);
Return filters based on chainId. Return false to skip the chain entirely, [] to skip all events, true to allow all:
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
const WHITELISTED = {
137: ["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" as const],
100: ["0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" as const],
};
ERC20.Transfer.handler(
async ({ event, context }) => { /* ... */ },
{
wildcard: true,
eventFilters: ({ chainId }) => {
if (chainId !== 100 && chainId !== 137) return false;
return [
{ from: ZERO_ADDRESS, to: WHITELISTED[chainId] },
{ from: WHITELISTED[chainId], to: ZERO_ADDRESS },
];
},
}
);
addresses — Filter by Registered ContractsFor dynamically registered contracts, use addresses to filter by their addresses:
ERC20.Transfer.handler(
async ({ event, context }) => { /* ... */ },
{
wildcard: true,
eventFilters: ({ chainId, addresses }) => {
if (chainId !== 100 && chainId !== 137) return false;
return [
{ from: ZERO_ADDRESS, to: addresses },
{ from: addresses, to: ZERO_ADDRESS },
];
},
}
);
return false → disable handler for that chainreturn true → accept all events (no filtering)Full reference: https://docs.envio.dev/docs/HyperIndex-LLM/hyperindex-complete