1

I wonder if someone use Wagmi hooks for Ethereum and it's caching mechanism. Since docs doesn't say much about it (Wagmi docs) can somebody explain me how it acutualy works? If i use useContractRead with scopeKey: 'myScope' and caching cacheTime: 1000*60*10 // 10 minutes then every time my component mounts it should first read the cache and return a cached value instead of using RPC to get value from blockchain, right? Well if it should, then it doesn't work, because every time I switch page I can see that my local hardhat is being asked for values. This means it can drain out RPC query limit very fast. How should I use cacheTime? Maybe I should also use staleTime?

1 Answer 1

0

Both have almost similar but not same functionality, stalTime can serve your purpose but still it fetches the data on mount and dismount. You can have a look here to get more insights

https://wagmi.sh/react/hooks/useTransaction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.