provider.on("block") should return the entire block information #1951
Replies: 3 comments 3 replies
-
The In v6, it may make sense to add another event to specify fetching the entire block header. For now, it should be safe to use the this._subscribe("newHeads", ["newHeads"], (result) => {
// Parse and format the block data into the same format as `getBlock()` would provide
const block = this.formatter.block(result);
// your code here...
}); I will not be removing or changing the signature of this call before v6, so it is safe to call this way. But it is best to use a tag not already used by ethers as the first parameter to Does that help? |
Beta Was this translation helpful? Give feedback.
-
Just to clarify, is there today a way to subscribe to new block headers? |
Beta Was this translation helpful? Give feedback.
-
Does the |
Beta Was this translation helpful? Give feedback.
-
When listening on
block
events, the callback only returns theblockNumber
but the websocket to geth returns all that data. How do we get that data from each websocket message instead of issuing another call to geth?meanwhile the ethers code does the following:
How do I get all the block data without an extra call to
eth.getBlock
which does a websocket call as well.Beta Was this translation helpful? Give feedback.
All reactions