Skip to content

Commit

Permalink
fix: resolves #2470
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Jul 4, 2024
1 parent 7f1af93 commit f12dfdb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/afraid-dots-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Fixed `watchContractEvent` querying for events against an invalid block range.
2 changes: 1 addition & 1 deletion src/actions/public/watchContractEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export function watchContractEvent<
// If the block number has changed, we will need to fetch the logs.
// If the block number doesn't exist, we are yet to reach the first poll interval,
// so do not emit any logs.
if (previousBlockNumber && previousBlockNumber !== blockNumber) {
if (previousBlockNumber && previousBlockNumber < blockNumber) {
logs = await getAction(
client,
getContractEvents,
Expand Down

0 comments on commit f12dfdb

Please sign in to comment.