-
Notifications
You must be signed in to change notification settings - Fork 141
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
feat: cross-chain cached RPC requests #1446
Comments
Hi! Thanks for opening, and especially for including a clear example / use case. The reason we recommend against setting up your own viem clients is that the clients provided in We'd like to add support for caching across chains, because it's a common requirement. The single-chain caching solution uses the block number of the event currently being handled as the "blockTag" argument for any requests than accept one, like So, the key question for cross-chain requests like this is what block number to use on the target chain. A few basic ideas to get the ball rolling:
Appreciate any ideas! |
Thanks for the fast response and full explanation!! Yes, I understand, it's not so clear how to resolve this. Maybe a good first approach is not to use a blockTag argument and use the current block number for the cache information. This solution will be at least enough for our use case. |
Problem / use case
We have a Ponder index working on mainnet and Optimism, and we want to get the ENS name from an address when indexing.
If we use the client from the context, we get an error when we try to get the ENS name from an event on Optimism, saying that the resolver is not available on this chain.
We resolve it by creating a new viem client using mainnet as chain, something like:
It seems to be working ok, but the documentation says "don't do this", and opens an issue for this.
Is there a better way to do this?
Proposed solution
No response
The text was updated successfully, but these errors were encountered: