Skip to content
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

✨ Allows getBlock to find block by hash #98

Merged
merged 6 commits into from
Apr 24, 2022

Conversation

arimgibson
Copy link
Contributor

@arimgibson arimgibson commented Apr 24, 2022

Now allows calls like:

provider.getBlock('0x3e5cea9c2be7e0ab4b0aa04c24dafddc37571db2d2d345caf7f88b3366ece0cf');

Closes #92

  • Change getBlock to also accept blocks specified by hash
  • Added tests
  • Added inline documentation

@arimgibson arimgibson linked an issue Apr 24, 2022 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Apr 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
essential-eth ✅ Ready (Inspect) Visit Preview Apr 24, 2022 at 4:58AM (UTC)

@arimgibson arimgibson requested a review from dawsbot April 24, 2022 00:04
@@ -67,6 +67,15 @@ describe('provider.getBlock happy path', () => {
testBlockEquality(eeRandomBlock, web3RandomBlock);
// expect(eeRandomBlock).toStrictEqual(web3RandomBlock);
});
const blockHash =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great test case!

I have never heard of or used RSK by the way, it's just the slowest block times I could find, which makes our other tests case which relies on "latest" fail less often. In the future we can always prefer eth mainnet for static data like this which never changes. It's the most-reliable chain when we have no idea if these smaller chains will still exist in many years 🤷

@dawsbot dawsbot merged commit 8df45d9 into master Apr 24, 2022
@dawsbot dawsbot deleted the 92-allow-getblock-to-accept-a-hash branch April 24, 2022 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow getBlock() to accept a hash
2 participants