contract.read.*
cache layer
#1503
Replies: 2 comments 2 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.
-
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
readContract
andwriteContract
in user-land, with some minor modifications.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions