scaffold-eth-2
scaffold-eth-2 copied to clipboard
bug: wagmi v2 useScaffoldWatchContractEvent doesn't work as expected
Is there an existing issue for this?
- [X] I have looked through the existing issues
Which method was used to setup Scaffold-ETH 2 ?
git clone, npx create-eth@latest
Current Behavior
When using useScaffoldWatchContractEvent
with a watched hook or useScaffoldEventHistory
, onLogs
doesn't fire or fire sometimes. Tried to make it work, but no luck in hardhat
and foundry
, on sepolia
it works from time to time. But onError
from useScaffoldWatchContractEvent
fires often.
Also tried to make an app without <ScaffoldApp>
wrapper to minimize rerenders and logic that can cause the bug, used pure wagmi
hook useWatchContractEvent
and watched useBalance
on hardhat
. Result - onLogs
fires sometimes, but not in 100% of cases. So looks like it's on wagmi
side. Raised an issue .
Probably I'm missing something, so if you know what's wrong please let me know
Expected Behavior
onLogs
fires in 100% cases
Steps To Reproduce
Example of app without scaffold hooks (based on sre challenge 3). You'll need to start second app on localhost:3001 and send eth to your account from localhost:3000
Example 2 with our hooks. Challenge 3 with wagmi v2 (working on this)
Anything else?
see also last part of Shiv's message https://github.com/scaffold-eth/scaffold-eth-2/pull/700#issuecomment-2048117489