contract.read.* cache layer
#1503
Replies: 2 comments 3 replies
-
|
This can already be achieved (on the client) by wrapping Viem in an external caching layer like TanStack Query (they also have a Core API if you want Vanilla JS only, and also React/Vue/Svelte/Solid APIs). This is what our other library Wagmi does already, which uses Viem under the hood. This is more of a "higher-level" solution though. From a "lower-level" perspective, I generally wonder if immutable resources like |
Beta Was this translation helpful? Give feedback.
-
|
You may want to check out Blutgang? https://github.com/rainshowerLabs/blutgang |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
contract.read.*in localStorage.e.g
.write(...)on a contract should probably just evict automatically. You could imagine that a programmer might listen for ethereum events, and trigger a cache eviction based on an event popping up.e.g:
contract.evictCache()FWIW -- I think all of this can be implemented today by overwriting
readContractandwriteContractin user-land, with some minor modifications.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions