We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
watchContractEvent
2.16.1
When listening events via watchContractEvent, console is filled with error: RPC Request failed: code: -32000, message: invalid block range params
Request body: "method":"eth_getLogs" ..."fromBlock":"0x2649c99" ... "toBlock":"0x2649c97"
As you can see fromBlock is greater than toBlock. I assume bug appears in these lines:
fromBlock
toBlock
viem/src/actions/public/watchContractEvent.ts
Lines 242 to 243 in f7afaa2
The case with invalid block range should be handled by watchContractEvent function, so that it won't make request with invalid block range.
Listen for BSC mainnet contract events via RPC node https://rpc.ankr.com/bsc And these arguments:
https://rpc.ankr.com/bsc
let unwatch = client.watchContractEvent({ abi: ..., address: ..., pollingInterval: 4000, eventName: ..., onError: err => { console.log("[Listener] error:", err); }, onLogs: logs => { } })
No response
The text was updated successfully, but these errors were encountered:
Hmm, must be some load balancing issue on the RPC Provider side. Will add a guard to fix.
Sorry, something went wrong.
f12dfdb
No branches or pull requests
Check existing issues
Viem Version
2.16.1
Current Behavior
When listening events via
watchContractEvent
, console is filled with error:RPC Request failed:
code: -32000, message: invalid block range params
Request body: "method":"eth_getLogs" ..."fromBlock":"0x2649c99" ... "toBlock":"0x2649c97"
As you can see
fromBlock
is greater thantoBlock
.I assume bug appears in these lines:
viem/src/actions/public/watchContractEvent.ts
Lines 242 to 243 in f7afaa2
Expected Behavior
The case with invalid block range should be handled by
watchContractEvent
function, so that it won't make request with invalid block range.Steps To Reproduce
Listen for BSC mainnet contract events via RPC node
https://rpc.ankr.com/bsc
And these arguments:
Link to Minimal Reproducible Example
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: