metamask-extension
metamask-extension copied to clipboard
feat(ramps): introduces dynamic support for rampable networks
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
- Go to this page...
Screenshots/Recordings
Video Description of the changes in the PR (5 min) https://www.loom.com/share/973960816e7e497aae51ed1cdc3cebf5
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using JSDoc format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
Pre-merge reviewer checklist
- [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
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]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (879 ± 575 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 86 | 159 | 115 | 25 | 12 |
domContentLoaded | 12 | 76 | 29 | 18 | 9 | ||
load | 72 | 3106 | 879 | 1198 | 575 | ||
domInteractive | 12 | 76 | 29 | 18 | 9 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 5.45 KiB (0.09%)
- common: -1014 Bytes (-0.02%)
Codecov Report
Attention: Patch coverage is 98.33333%
with 1 line
in your changes missing coverage. Please review.
Project coverage is 69.72%. Comparing base (
d403213
) to head (7ee6250
).
Files | Patch % | Lines |
---|---|---|
...ages/confirmations/send/gas-display/gas-display.js | 0.00% | 1 Missing :warning: |
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
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [7fe1f84]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (352 ± 384 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 64 | 185 | 107 | 35 | 17 |
domContentLoaded | 9 | 67 | 26 | 18 | 9 | ||
load | 48 | 3032 | 352 | 799 | 384 | ||
domInteractive | 9 | 67 | 26 | 18 | 9 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 5.45 KiB (0.09%)
- common: -1014 Bytes (-0.02%)
Builds ready [91521fc]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (491 ± 459 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 67 | 362 | 134 | 86 | 41 |
domContentLoaded | 10 | 72 | 31 | 20 | 9 | ||
load | 54 | 3055 | 491 | 955 | 459 | ||
domInteractive | 10 | 72 | 31 | 20 | 9 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 5.62 KiB (0.09%)
- common: -1014 Bytes (-0.02%)
LGTM for QA, I tested with Base and other networks ✅
Builds ready [48fe591]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1298 ± 712 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 71 | 256 | 126 | 42 | 20 |
domContentLoaded | 10 | 91 | 28 | 22 | 11 | ||
load | 57 | 3896 | 1298 | 1482 | 712 | ||
domInteractive | 9 | 91 | 28 | 22 | 11 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.33 KiB (0.10%)
- common: -1021 Bytes (-0.02%)
Builds ready [debd520]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1075 ± 647 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 61 | 245 | 122 | 38 | 18 |
domContentLoaded | 10 | 88 | 29 | 18 | 8 | ||
load | 49 | 3375 | 1075 | 1347 | 647 | ||
domInteractive | 10 | 87 | 29 | 18 | 8 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1021 Bytes (-0.02%)
Builds ready [75f0806]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (199 ± 294 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 55 | 99 | 74 | 11 | 5 |
domContentLoaded | 8 | 13 | 9 | 1 | 1 | ||
load | 44 | 2866 | 199 | 612 | 294 | ||
domInteractive | 8 | 13 | 9 | 1 | 1 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
Builds ready [142d6ad]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1192 ± 660 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 67 | 182 | 99 | 29 | 14 |
domContentLoaded | 10 | 76 | 18 | 18 | 9 | ||
load | 53 | 3033 | 1192 | 1374 | 660 | ||
domInteractive | 9 | 76 | 18 | 18 | 9 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
hey @georgeweiler , i was asked to take a look at this PR. This LGTM and i agree with your take on the selectors, maybe it would be great if someone from the extension team can confirm the full selector inclusion approach as i am not familiar with this
Builds ready [b2f55c3]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (640 ± 472 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 63 | 136 | 94 | 26 | 12 |
domContentLoaded | 9 | 69 | 19 | 18 | 9 | ||
load | 51 | 2592 | 640 | 984 | 472 | ||
domInteractive | 9 | 69 | 19 | 18 | 9 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
I’m okay with the approach of requiring all selectors and mocking only some of them, but there must be a reason why originally this was not done this way, if no one from extension team raises a concern, then we can just merge.
@georgeweiler @pedronfigueiredo @nikoferro I am okay with the use of "requireActual" as done in this PR. We do already use it in some other places. The reasons for not using it would be to have greater control, and visibility into that control, of the state and related dependencies. If we mock only what we need, and everything that we need, it becomes clear that the component unit test is only testing the component. But I don't think it is a strict requirement to do that.
Maybe we should establish clearer and stricter guidelines, but as we don't have them, I think what is in this PR is fine.
With that said, I don't think the usage of requireActual in question in this PR is necessary. Here is a PR I created against this branch that shows the unit tests passing without the instances of requireActual https://github.com/MetaMask/metamask-extension/pull/24589
I would say, at least, that you can remove the instances in the routes component test, which seems to be unnecessary
Builds ready [53606d7]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (829 ± 501 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 62 | 166 | 92 | 25 | 12 |
domContentLoaded | 9 | 64 | 16 | 14 | 7 | ||
load | 51 | 2538 | 829 | 1043 | 501 | ||
domInteractive | 9 | 64 | 16 | 14 | 7 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
Failing test-deps-audit
job addressed in #24664.
Builds ready [4cb8b13]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (165 ± 217 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 65 | 105 | 74 | 8 | 4 |
domContentLoaded | 9 | 39 | 11 | 6 | 3 | ||
load | 53 | 2139 | 165 | 453 | 217 | ||
domInteractive | 9 | 39 | 11 | 6 | 3 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
Builds ready [a9cfbf2]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (399 ± 366 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 62 | 176 | 96 | 28 | 14 |
domContentLoaded | 10 | 65 | 24 | 21 | 10 | ||
load | 51 | 2287 | 399 | 763 | 366 | ||
domInteractive | 10 | 65 | 24 | 21 | 10 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
Hey @MetaMask/confirmations-system-team, your review is the last one missing to merge this PR please 🙏
Builds ready [d75e639]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (180 ± 221 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 59 | 244 | 91 | 41 | 20 |
domContentLoaded | 9 | 150 | 19 | 31 | 15 | ||
load | 47 | 2184 | 180 | 461 | 221 | ||
domInteractive | 9 | 150 | 19 | 31 | 15 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.58 KiB (0.10%)
- common: -1007 Bytes (-0.02%)
Hey @georgeweiler, is the test-e2e-chrome-mmi
passing for you locally? I have ran the CI 7 times and all failed on the same suite
Builds ready [7ee6250]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (158 ± 160 ms)
Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
---|---|---|---|---|---|---|---|
Chrome | Home | firstPaint | 74 | 254 | 111 | 39 | 19 |
domContentLoaded | 10 | 180 | 38 | 37 | 18 | ||
load | 41 | 1602 | 158 | 334 | 160 | ||
domInteractive | 10 | 180 | 38 | 37 | 18 |
Bundle size diffs [🚀 Bundle size reduced!]
- background: 0 Bytes (0.00%)
- ui: 6.66 KiB (0.10%)
- common: -1021 Bytes (-0.02%)