Skip to content

enviodev/topic-filtering

Repository files navigation

Topic Filtering

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
        ] 
    }
);

Prerequisites

Before running the indexer locally, make sure you have the following installed:

Running the Indexer

Add your Envio API key to the .env file, then start the indexer:

pnpm dev

If you make changes to config.yaml or schema.graphql, regenerate the type files:

pnpm codegen

GraphQL Playground

While indexer is running, visit the Envio Console(https://envio.dev/console) to open the GraphQL Playground and query your indexed data.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published