Closed bluelogflowx closed 1 year ago
Thanks for reporting. This issue is temporarily closed due to lack of information. Please provide a minimal reproducible example via https://new.viem.sh and reopen this issue.
@bluelogflowx Hi, experiencing the same issue on my side but with createContractEventFilter
:cry:
By any chance, did you happen to find a solution since you created this issue?
the same problem here :(
the same problem here :(
If someone ever stumbles on this issue like I did, I think I found the answer. It has nothing to do with the way wagmi/viem works, but rather with the RPC you're using.
Public/free providers can be very unreliable, especially when it comes to subscribing to events. This issue stopped happening when I switched to a paid RPC. Hope thath helps!
the same problem here :(
If someone ever stumbles on this issue like I did, I think I found the answer. It has nothing to do with the way wagmi/viem works, but rather with the RPC you're using.
Public/free providers can be very unreliable, especially when it comes to subscribing to events. This issue stopped happening when I switched to a paid RPC. Hope thath helps!
I have also been testing many solutions to the error; that's the idea that occurred to me to try as well. However, I couldn't find an RPC to conduct tests on the Fantom testnet (which I am using). Which paid RPC would you suggest I use?
https://stackblitz.com/~/edit/viem-getting-started-wm7jyz
InvalidInputRpcError: Missing or invalid parameters. Double check you have provided the correct parameters.
URL: https://rpc.testnet.fantom.network Request body: {"method":"eth_getFilterChanges","params":["0x638af033e72a3b9cdcbeff423aef8b92"]}
Details: filter not found Version: viem@2.7.2 at withRetry.delay.count.count (chunk-TSWZW7PH.js?v=1a248893:1690:19) at async attemptRetry (chunk-TSWZW7PH.js?v=1a248893:1654:22)
the same problem here :(
If someone ever stumbles on this issue like I did, I think I found the answer. It has nothing to do with the way wagmi/viem works, but rather with the RPC you're using. Public/free providers can be very unreliable, especially when it comes to subscribing to events. This issue stopped happening when I switched to a paid RPC. Hope thath helps!
I have also been testing many solutions to the error; that's the idea that occurred to me to try as well. However, I couldn't find an RPC to conduct tests on the Fantom testnet (which I am using). Which paid RPC would you suggest I use?
I didn't find many either! Also using Fantom Testnet, so that might be an issue with their public RPC ? Anyway, I've been using Ankr and it works well in this case :) (from what I understood, creating + storing custom filters is "expensive" for RPCs, so only paid RPCs/a couple of good public RPCs store filters for a sufficient amount of time before deleting them)
the same problem here :(
If someone ever stumbles on this issue like I did, I think I found the answer. It has nothing to do with the way wagmi/viem works, but rather with the RPC you're using. Public/free providers can be very unreliable, especially when it comes to subscribing to events. This issue stopped happening when I switched to a paid RPC. Hope thath helps!
I have also been testing many solutions to the error; that's the idea that occurred to me to try as well. However, I couldn't find an RPC to conduct tests on the Fantom testnet (which I am using). Which paid RPC would you suggest I use?
I didn't find many either! Also using Fantom Testnet, so that might be an issue with their public RPC ? Anyway, I've been using Ankr and it works well in this case :) (from what I understood, creating + storing custom filters is "expensive" for RPCs, so only paid RPCs/a couple of good public RPCs store filters for a sufficient amount of time before deleting them)
Thank you very much; I will try with Ankr then. I've also been thinking about creating an RPC provider locally just for testing because the events are occurring, but the useWatchContractEvent hook from Wagmi is not listening to them. I used the AI-powered search engine Phind and it suggested running these commands, but I can't find any documentation on the web. Here are the commands:
fantom --testnet
fantom attach http://localhost:8545
eth.syncing
the same problem here :(
If someone ever stumbles on this issue like I did, I think I found the answer. It has nothing to do with the way wagmi/viem works, but rather with the RPC you're using. Public/free providers can be very unreliable, especially when it comes to subscribing to events. This issue stopped happening when I switched to a paid RPC. Hope thath helps!
I have also been testing many solutions to the error; that's the idea that occurred to me to try as well. However, I couldn't find an RPC to conduct tests on the Fantom testnet (which I am using). Which paid RPC would you suggest I use?
I didn't find many either! Also using Fantom Testnet, so that might be an issue with their public RPC ? Anyway, I've been using Ankr and it works well in this case :) (from what I understood, creating + storing custom filters is "expensive" for RPCs, so only paid RPCs/a couple of good public RPCs store filters for a sufficient amount of time before deleting them)
Thank you very much; I will try with Ankr then. I've also been thinking about creating an RPC provider locally just for testing because the events are occurring, but the useWatchContractEvent hook from Wagmi is not listening to them. I used the AI-powered search engine Phind and it suggested running these commands, but I can't find any documentation on the web. Here are the commands:
fantom --testnet
fantom attach http://localhost:8545
eth.syncing
I guess you could use a local RPC but you'd eventually have to pick one for when you deploy to prod :( "the events are occurring, but the useWatchContractEvent hook from Wagmi is not listening to them" -> that's my point, the events are occurring, the wagmi hook is working fine, but it's actually the RPC you're using that doesn't allow wagmi to detect that event, since the RPC is "lazy" (because it's a public/free one).
I guess you could use a local RPC but you'd eventually have to pick one for when you deploy to prod :( "the events are occurring, but the useWatchContractEvent hook from Wagmi is not listening to them" -> that's my point, the events are occurring, the wagmi hook is working fine, but it's actually the RPC you're using that doesn't allow wagmi to detect that event, since the RPC is "lazy" (because it's a public/free one).
Ankr worked very well as an RPC provider, thank you very much. I had tried it the same day, and it worked perfectly. I forgot to respond to thank you
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.
Is there an existing issue for this?
Package Version
1.6.2
Current Behavior
const transaction = await writeContract(transactionConfig);
const unwatch = publicClient.watchContractEvent({ address: StakingContractV2.address(), abi: StakingContractV2.abi(), eventName: 'StakingStarted', //also 'StakingStopped' is not working too onError: e => console.log(e), onLogs: logs => console.log("logs: ",logs) })
watchContractEvent does not work properly.
Generally, onLogs is not working and there is an error called "filter not found":
**InvalidInputRpcError: Missing or invalid parameters. Double check you have provided the correct parameters.
URL: https://api.avax-test.network/ext/bc/C/rpc Request body: {"method":"eth_getFilterChanges","params":["0xdd2v4a915ffc124deddef12a95c14569"]}
Details: filter not found Version: viem@1.6.2 at delay.count.count (buildRequest.js:48:1) at async attemptRetry (withRetry.js:12:1)**
Expected Behavior
I expected no error and printing logs everytime.
Steps To Reproduce
No response
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
https://viem.sh/docs/contract/watchContractEvent.html
Anything else?
No response