-
Notifications
You must be signed in to change notification settings - Fork 5k
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(ramps): introduces dynamic support for rampable networks #24041
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [7c4ba77]
Page Load Metrics (879 ± 575 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #24041 +/- ##
===========================================
+ Coverage 69.69% 69.72% +0.03%
===========================================
Files 1350 1353 +3
Lines 47865 47910 +45
Branches 13199 13210 +11
===========================================
+ Hits 33355 33402 +47
+ Misses 14510 14508 -2 ☔ View full report in Codecov by Sentry. |
Builds ready [7fe1f84]
Page Load Metrics (352 ± 384 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
…metamask-extension into ramps-buyable-networks
Builds ready [91521fc]
Page Load Metrics (491 ± 459 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
ui/ducks/ramps/ramps.test.ts
Outdated
}, | ||
}); | ||
// @ts-expect-error mocked API has mockReset method | ||
RampAPI.getNetworks.mockReset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request for change: Use jest.Mocked instead of suppressing TS error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Reviewed mainly the code relevant for the BTC project
Hey @georgeweiler, is the |
ba2eefa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Approving the privacy snapshot changes
Builds ready [7ee6250]
Page Load Metrics (158 ± 160 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Description
This PR introduces a new reducer for Ramps to store an array of "buyable" networks. A "buyable chain" is one that the native token has onramp support for. This BUYABLE_CHAINS_MAP list is currently hard-coded, and this PR fetches a dynamic network list from the Ramps API instead. The list of supported networks by the MetMask onramp team is dynamic and is based on provider support among other things.
There are several fallback protections in place. Buyable chains will default to the current hard-coded list before loading and will default to that same list if there are any errors. There is no need for loading or error states.
The ramps base API url has been added as a new environment variable, defaulted to production. example: METAMASK_RAMP_API_BASE_URL=https://on-ramp-content.metaswap.codefi.network
Here's screenshot to show the issue this PR will fix. Base network is supported as a buyable network. but because the hard-coded array of networks does not include base we do not enable the buy CTAs:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Video Description of the changes in the PR (5 min)
https://www.loom.com/share/973960816e7e497aae51ed1cdc3cebf5
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist