Closed technophile-04 closed 5 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
ghofund-platform | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 16, 2024 5:17pm |
it finds all the logs from various contract addresses which matches the event
Lol. Now everything makes sense.
Thanks Shiv!
Description :
Actually there was a bug in
useEventHistory
, We were not doing properaddress
check if its undefined or not, and even if it was undefined we were making agetLogs
request.When you call
publicClient.getLogs
passing address asundefined
it finds all the logs from various contract addresses which matches the event. Hence we were getting random events from random contracts.Checkout this example: https://stackblitz.com/edit/wevm-viem-gpjn8l?file=index.ts
Note related to this PR / discussion: But while tinkering found that while making
eth_getLogs
request yourfromBlock
-toBlock
should be < 800 blocks others will error (at least public cloudfare node does it)