Hoist blockTag into client
#4142
Unanswered
shazow
asked this question in
Idea / Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There's already
experimental_blockTagwhich supports string block tags, but would be great if we could make this officially supported (non-experimental) and allow numeric blocks too.Rationale: It's more common/ergonomic to always query within the context of a specific block. It's annoying to pass that same block in everywhere, so fixing that block as a client configuration is a nice abstraction.
Specifically, @andrewhong5297 was using whatsabi to analyze a recent hack against a specific block, and it was quite annoying to instrument whatsabi to plumb the blockNumber. I added a
WithBlockNumber(provider, blockTag)helper which wraps the provider (essentially faking the hoisting), will be included in the next release (shazow/whatsabi#198).The other option was to use something like tevm to provide a forked client against some block number and pass that as a provider instead.
In either case, it feels like it makes sense to be able to hoist/fix the block number within the context of a client/provider. :)
Beta Was this translation helpful? Give feedback.
All reactions