Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to chain id in wildcard event filters #287

Open
chrisais9 opened this issue Oct 24, 2024 · 2 comments
Open

Access to chain id in wildcard event filters #287

chrisais9 opened this issue Oct 24, 2024 · 2 comments
Labels

Comments

@chrisais9
Copy link

https://docs.envio.dev/docs/HyperIndex/wildcard-indexing

photo_2024-10-24 19 51 41

Not quite suitable for multichain indexer. Since it doesn't hold event context. I can't parse right WETH address for it which are different per chain.

@JonoPrest
Copy link
Collaborator

Hey @chrisais9,

Interesting. Just FYI, although it's not a nice API this is achievable if you define the event separately per chain in your config. And give the contract a different name. You can pass the same contractRegister callback to each of them with different eventConfig options.

Since the filter is not reactive to the event that gets passed to the handler, but rather, it defines the filters applied in hypersync before returning to the indexer.

Do you have any suggestions for a preferred API?

Maybe a field called "getEventFilters" which is a callback that takes (chainId) => eventFilters. Then a different set of eventFilters can be created per chain on the indexer start up?

@chrisais9
Copy link
Author

chrisais9 commented Oct 25, 2024

Hey @chrisais9,

Interesting. Just FYI, although it's not a nice API this is achievable if you define the event separately per chain in your config. And give the contract a different name. You can pass the same contractRegister callback to each of them with different eventConfig options.

Since the filter is not reactive to the event that gets passed to the handler, but rather, it defines the filters applied in hypersync before returning to the indexer.

Do you have any suggestions for a preferred API?

Maybe a field called "getEventFilters" which is a callback that takes (chainId) => eventFilters. Then a different set of eventFilters can be created per chain on the indexer start up?

Callback approach with chainId sounds great! Would be enough for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants