getBlock does not return the requested block if a number instead of {blockNumber} is passed #1622
Unanswered
hananbeer
asked this question in
Idea / Feature Request
Replies: 1 comment
-
Thanks for the issue! If you are using TypeScript, you will receive an error at build time. It is highly recommended use Viem with TypeScript. Main reason why the API is designed this way (named parameters) is because it reduces ambiguity between a block number vs. block tag vs. block hash, which makes things easier to document and reason about. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there an existing issue for this?
Package Version
latest
Current Behavior
I know the intended behavior is to pass an object to the getBlock() function, eg. getBlock({blockNumber})
but if I call getBlock(0x1234) I don't get block 0x1234. I also don't get an error. I get the latest block.
this is highly misleading. it is better to accept block numbers / hashes directly, or just throw an error.
Expected Behavior
No response
Steps To Reproduce
No response
Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)
No response
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions