You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to listen to events using useWatchContractEvent and it's working fine. At the same time I need to watch balance of some address. I'm using technique from v1 to v2 migration guide to watch balance. But when I'm adding it useWatchContractEvent doesn't work locally (hardhat, foundry) and works from time to time on sepolia (not every event). At the same time onError of useWatchContractEvent triggers often. Example from pinned app
InvalidInputRpcError: Missing or invalid parameters.
Double check you have provided the correct parameters.
URL: https://rpc.sepolia.org
Request body: {"method":"eth_getFilterChanges","params":["0xe113405727fb7f30c30ea40767b77639"]}
Details: filter not found
Version: viem@2.9.31
at withRetry.delay.count.count (chunk-ADKPSZLC.js?v=ae0a275b:1698:19)
at async attemptRetry (chunk-ADKPSZLC.js?v=ae0a275b:1662:22)
Error from hardhat network:
TypeError: Cannot read properties of null (reading '0')
at getFilterChanges (getFilterChanges.js:100:20)
at async unwatch.emitOnBegin (watchContractEvent.js:110:32)
at async poll (poll.js:23:13)
filter are stateful, they don't work on public rpc providers that load balance between several nodes. i think the method needs to be updated to use eth_getLogs polling instead and maintain the filter state locally. i think there is already a fallback looking at viem documentation.
filter are stateful, they don't work on public rpc providers that load balance between several nodes. i think the method needs to be updated to use eth_getLogs polling instead and maintain the filter state locally. i think there is already a fallback looking at viem documentation.
Could you elaborate on this?
useWatchContractEvent doesn't seem to fire when we are expecting it to.
You're saying it has something to do with the filtering?
Glad to provide dev work once we can identify the problem!
Describe the bug
I need to listen to events using
useWatchContractEvent
and it's working fine. At the same time I need to watch balance of some address. I'm using technique from v1 to v2 migration guide to watch balance. But when I'm adding ituseWatchContractEvent
doesn't work locally (hardhat
,foundry
) and works from time to time onsepolia
(not every event). At the same timeonError
ofuseWatchContractEvent
triggers often. Example from pinned appError from
hardhat
network:Link to Minimal Reproducible Example
https://stackblitz.com/edit/new-wagmi-cauhct?file=src%2FApp.tsx
Steps To Reproduce
use
useWatchContractEvent
and at the same time other watched valueWagmi Version
^2.5.12 (also tried last version)
Viem Version
^2.8.16 (also tried last version)
TypeScript Version
No response
Check existing issues
Anything else?
No response
The text was updated successfully, but these errors were encountered: