Skip to content
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

bug: wagmi v2 useScaffoldWatchContractEvent doesn't work as expected #838

Closed
1 task done
rin-st opened this issue May 3, 2024 · 2 comments
Closed
1 task done
Assignees

Comments

@rin-st
Copy link
Member

rin-st commented May 3, 2024

Is there an existing issue for this?

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 #700 (comment)

@ivanbaldo
Copy link

If I understood correctly, I think this is not a bug on Scaffold-ETH nor Wagmi nor Viem but a shortcoming of free public RPC providers which don't store event filters forever and sometimes not even at all.
So maybe this issue should be closed?
Or perhaps some documentation (which?) could be enhanced to warn users about this shortcoming?

@technophile-04
Copy link
Collaborator

Yup closing this and should be documented in scaffold-eth/se-2-docs#74, thanks all!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants