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

7203 - Alchemy rpc provider #7296

Open
wants to merge 16 commits into
base: 4.x
Choose a base branch
from
Open

Conversation

MRLab12
Copy link

@MRLab12 MRLab12 commented Oct 2, 2024

Description

I have opened this Draft PR to make sure I did the correct changes and get some feedback since this is my first contribution here.

This PR adds an Alchemy provider in web3-rpc-providers. I matched the design of the Quicknode provider.

For testing, I wasn't sure if a test for this provider should actually try to make a request. Should we consider mocking? I want to learn more about how testing is done in web3.js.

Fixes #7203

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run lint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:coverage and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have linked Issue(s) with this PR in "Linked Issues" menu.

@MRLab12 MRLab12 marked this pull request as ready for review October 16, 2024 12:59
@MRLab12 MRLab12 force-pushed the alchemy-rpc-provider branch 2 times, most recently from 5103d29 to b17f49d Compare October 22, 2024 00:04
@MRLab12 MRLab12 force-pushed the alchemy-rpc-provider branch from 7aefd55 to 2982118 Compare October 23, 2024 13:11
@MRLab12 MRLab12 force-pushed the alchemy-rpc-provider branch from 97135dc to 2982118 Compare October 30, 2024 01:27
MRLab12 and others added 3 commits October 29, 2024 21:35
# Conflicts:
#	packages/web3-rpc-providers/src/types.ts
#	packages/web3/test/integration/web3RPCProviders.test.ts
Copy link
Contributor

@Muhammad-Altabba Muhammad-Altabba left a comment

Choose a reason for hiding this comment

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

Many thanks @MRLab12 for your contribution,
It seems great now. I think, once other team members approve, we can merge this MR.

@MRLab12
Copy link
Author

MRLab12 commented Nov 12, 2024

I'm trying to run integration tests locally but having issues. Looking at the test errors here, most likely a missing Alchemy key is the issue. Can someone point me to how this should be set up?

@jdevcs
Copy link
Contributor

jdevcs commented Nov 25, 2024

I'm trying to run integration tests locally but having issues. Looking at the test errors here, most likely a missing Alchemy key is the issue. Can someone point me to how this should be set up?

For your local testing I'll suggest to use your personal key, and for web3.js one of our team member will add web3.js specific alchemy key.

@MRLab12
Copy link
Author

MRLab12 commented Nov 25, 2024

I'm trying to run integration tests locally but having issues. Looking at the test errors here, most likely a missing Alchemy key is the issue. Can someone point me to how this should be set up?

For your local testing I'll suggest to use your personal key, and for web3.js one of our team member will add web3.js specific alchemy key.

Hey! Yup, I used my personal key to manually test the functionality using a script. For the tests I added, I thought these tests were going to be ignored for now. Since it looks like they are being used, we will most likely need to set up the key for the tests to work.

I'm going to try to get the tests I added to run locally, but when I last tried using WEB3_SYSTEM_TEST_BACKEND=geth WEB3_SYSTEM_TEST_PROVIDER=ws://127.0.0.1:8545 yarn test:integration, tests seem to work but it also generates some errors. Maybe someone can help me out with running newly added tests locally without running all the test suites.

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.54%. Comparing base (926044b) to head (d688b9f).

Additional details and impacted files
@@           Coverage Diff           @@
##              4.x    #7296   +/-   ##
=======================================
  Coverage   94.54%   94.54%           
=======================================
  Files         218      218           
  Lines        8637     8637           
  Branches     2364     2364           
=======================================
  Hits         8166     8166           
  Misses        471      471           
Flag Coverage Δ
UnitTests 94.54% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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.

Add RPC provider: alchemy
4 participants