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

feat: add AlchemyProvider class #205

Merged
merged 9 commits into from
Apr 22, 2023

Conversation

jtfirek
Copy link
Collaborator

@jtfirek jtfirek commented Apr 6, 2023

Closes #186?

@dawsbot
Copy link
Owner

dawsbot commented Apr 6, 2023

WOW YES.

I think it needs an integration test and then it's ready @jtfirek 🙏

Would you be able to include a jest test which pulls in the Etherscan API key for a mainnet account from process.env?

@jtfirek
Copy link
Collaborator Author

jtfirek commented Apr 6, 2023

Yea I can work on that now @dawsbot !

@dawsbot
Copy link
Owner

dawsbot commented Apr 6, 2023

Something very basic which fetches the current block is plenty to test!

@jtfirek
Copy link
Collaborator Author

jtfirek commented Apr 6, 2023

Wouldn't we need an alchemy api key over an etherscan api key to initialize an alchemy provider instance @dawsbot ?

Also I don't see any api keys in the .env, just an RPC_ORIGIN url.

@jtfirek
Copy link
Collaborator Author

jtfirek commented Apr 21, 2023

I added an alchemy key and a simple test that checks the current gas price!
Screen Shot 2023-04-21 at 6 37 26 PM

@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06 🎉

Comparison is base (f673a1c) 90.67% compared to head (83642fd) 90.74%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #205      +/-   ##
==========================================
+ Coverage   90.67%   90.74%   +0.06%     
==========================================
  Files          40       41       +1     
  Lines        1019     1026       +7     
  Branches      289      290       +1     
==========================================
+ Hits          924      931       +7     
  Misses         85       85              
  Partials       10       10              
Impacted Files Coverage Δ
src/index.ts 100.00% <100.00%> (ø)
src/providers/AlchemyProvider.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

.env Outdated
@@ -1,2 +1,3 @@
RPC_ORIGIN=https://free-eth-node.com
# RPC_ORIGIN=http://localhost:3000
ALCHEMY_API_KEY=kwIkw24q335k05WBuFXBmT3W-P5luv4g
Copy link
Owner

Choose a reason for hiding this comment

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

Yikes, this will be botted and spent a ton of $ on immediately @jtfirek

This needs to live in a place that is gitignored, so it never sees the eyes of the public internet. Go cancel this API key immediately. I'll take care of adding it properly to an ignored part of the codebase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for bringing this to my attention @dawsbot! I canceled the API key and will make my own env with the using the .env.example you created!

@@ -0,0 +1,37 @@
import { BaseProvider } from './BaseProvider';

export class AlchemyProvider extends BaseProvider {
Copy link
Owner

Choose a reason for hiding this comment

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

I think we can do this entire thing in just 5 lines by extending JsonRpcProvider instead.

Copy link
Owner

Choose a reason for hiding this comment

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

Yea this was overengineering @jtfirek. This does the same:

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Noted @dawsbot! that's much more simplified

@dawsbot dawsbot merged commit e535cb5 into dawsbot:master Apr 22, 2023
@ZxSix666
Copy link

Co

@jtfirek jtfirek deleted the jacob-create-alchemy-provider branch April 28, 2023 17:26
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.

Create alchemy provider
4 participants