-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
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
Events returned by WebSocketProvider inconsistent with getLogs #795
Comments
Both should be returning a decimal. You are right, the subscribed events in the WebSocketProvider is skipping the regular wrapping for block, but logs are still wrapped properly. I’ll fix it shortly. And double check everything else is being normalized correctly. :) |
Actually... I can't reproduce this and the place I thought might be left unguarded seems to wrap the call correctly. Can you include a snippet of code? Also, what backend are you using? These seem to all work: provider.getBlockNumber().then((b) => {
console.log("getBlockNumber", b);
});
provider.on("block", (b) => {
console.log("event", b);
console.log("per event", provider.blockNumber);
}); |
No wait... I didn't misread, please pass along a code snippet. :) |
I can confirm that the block numbers are returned correctly for your code snippets above. The issue I'm encountering is when listening for events:
|
Found the problem. I'll publish after the CI completes. :) |
This should be fixed in 5.0.0-beta.183. Try it out and let me know. :) |
It's working! Thank you. |
Hi @ricmoo ,
When I receive an event via Websockets, the
event.blockNumber
appears in hex (but otherwise seems to work fine).However, when I do
provider.getLogs()
(using normal Infura provider), thelog.blockNumber
is in decimal format.My assumption has been that a log (using normal provider) and a Websocket event are the same type of object. Is that correct? Should both be returning decimal
blockNumber
?Thanks!
The text was updated successfully, but these errors were encountered: