-
Notifications
You must be signed in to change notification settings - Fork 116
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
Feat: Multiple Block Ranges #1384
base: v0.9
Are you sure you want to change the base?
Conversation
import { buildLogFactory } from "./factory.js"; | ||
|
||
type BlockRange = [number | "latest", number | "realtime" | "latest"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments here about what each of these values mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in the last commit
const rawBlockRanges: [number, number | "realtime"][] = | ||
blocks === undefined || blocks.length === 0 | ||
? [[0, "realtime"]] | ||
: blocks.every((b) => Array.isArray(b)) | ||
? blocks.map(([fromBlock, toBlock]) => [ | ||
fromBlock === "latest" ? latest : fromBlock, | ||
toBlock === "latest" ? latest : toBlock, | ||
]) | ||
: [ | ||
[ | ||
blocks[0] === "latest" ? latest : blocks[0], | ||
blocks[1] === "latest" ? latest : blocks[1], | ||
], | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there is a type error in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it
const latest: Hex = await network.transport({ chain }).request({ | ||
method: "eth_blockNumber", | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this request happen even if there are no tags used in blocks
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it
Relates to #1377. Handles multiple block ranges by pointing each resolved block range to its separate source.