For a complete guide to all Envio indexer features, visit the documentation website.
This example builds on our wildcard indexing example, which demonstrates how to index all events that match a given event signature.
In this version, we add an additional feature that filters those events further based on specific topics within the event data.
You can learn more about Topic Filtering in the documentation: https://docs.envio.dev/docs/HyperIndex/wildcard-indexing#topic-filtering
To enable topic filtering, simply pass eventFilters: { TOPIC_NAME: TOPIC_VALUE } in the handler configuration.
ERC20.Transfer.handler(
async ({ event, context }) => {
// ...your handler logic
},
{
wildcard: true,
eventFilters: [
{ TOPIC_NAME: TOPIC_VALUE}, // filter 1
{ TOPIC_NAME: TOPIC_VALUE} // filter 2
]
}
);Before running the indexer locally, make sure you have the following installed:
Add your Envio API key to the .env file, then start the indexer:
pnpm devIf you make changes to config.yaml or schema.graphql, regenerate the type files:
pnpm codegenWhile indexer is running, visit the Envio Console(https://envio.dev/console) to open the GraphQL Playground and query your indexed data.