Commit af58537
authored
chore(ramp): adopt core-owned Headless Buy default redirect URL (MetaMask#34207)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.
-->
## **Description**
<!-- mms-check: type=text required=true -->
Adopts the TRAM-3757 core change from MetaMask/core#9752 so Headless Buy
and UB2 share one finish-line (fake-callback) URL derivation.
- Bumps `@metamask/ramps-controller` to the stable published `^19.0.0`
release.
- Removes the client `getDefaultRedirectUrl` injection from
`ramps-controller-init.ts`. Core now supplies the widened-path default
through `RampsService:getDefaultRedirectCallbackUrl`.
- Spreads `RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS` in the controller
messenger so the new action cannot be forgotten on future upgrades.
- Rewrites `getRampCallbackBaseUrl()` as
`getDefaultRedirectCallbackUrl(getRampsEnvironment())`, deleting the
duplicated host table. BuildQuote, Continue rewrite, Checkout completion
matching, and the controller default now all use the same environment
source (`RAMPS_ENVIRONMENT`, then `METAMASK_ENVIRONMENT`).
## **Changelog**
<!-- mms-check: type=changelog required=true blocking=true -->
CHANGELOG entry: null
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Fixes: TRAM-3757
Refs: MetaMask/core#9752
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
N/A - unit-covered wiring and package bump only. Covered by unit tests
for `getRampCallbackBaseUrl` (parity with
`getDefaultRedirectCallbackUrl(getRampsEnvironment())`, including
`RAMPS_ENVIRONMENT` override), `ramps-controller-init`, and messenger
construction.
## **Screenshots/Recordings**
<!-- mms-check: type=screenshot required=true -->
N/A - no user-visible UI change; wiring/package bump only.
### **Before**
N/A
### **After**
N/A, simply proving that UB2 still works.
https://github.com/user-attachments/assets/61bf61fb-765c-4fe1-923c-3ce03d4e5d1e
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [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](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes ramp buy/checkout redirect URL resolution for headless and UB2
flows; behavior should match prior mapping but depends on core v19 and
messenger delegation being correct.
>
> **Overview**
> Bumps **`@metamask/ramps-controller`** to **^19.0.0** (TRAM-3757 /
core#9752) so the widened Headless Buy quote path gets its default
redirect from core instead of the mobile client.
>
> **`getRampCallbackBaseUrl()`** no longer maintains a local host switch
on `METAMASK_ENVIRONMENT`; it delegates to
**`getDefaultRedirectCallbackUrl(getRampsEnvironment())`**, aligning UB2
BuildQuote, checkout completion, and Continue rewrite with the same env
source (`RAMPS_ENVIRONMENT`, then `METAMASK_ENVIRONMENT`).
**`ramps-controller-init`** drops the **`getDefaultRedirectUrl`**
injection into **`RampsController`**.
>
> The ramps controller messenger now spreads
**`RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS`** instead of a
hand-maintained action list, so
**`RampsService:getDefaultRedirectCallbackUrl`** stays delegated on
upgrades. Tests assert parity with core and **`RAMPS_ENVIRONMENT`**
override behavior.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
721b70e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 2c3f5da commit af58537
6 files changed
Lines changed: 74 additions & 103 deletions
File tree
- app
- components/UI/Ramp/utils
- core/Engine
- controllers/ramps-controller
- messengers/ramps-controller-messenger
Lines changed: 42 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
15 | 24 | | |
16 | 25 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
26 | 48 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 49 | + | |
| 50 | + | |
44 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | | - | |
| 57 | + | |
48 | 58 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | | - | |
4 | | - | |
5 | 7 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | 13 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 14 | + | |
30 | 15 | | |
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
51 | 45 | | |
52 | 46 | | |
53 | 47 | | |
| |||
Lines changed: 4 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
79 | 49 | | |
80 | 50 | | |
81 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9957 | 9957 | | |
9958 | 9958 | | |
9959 | 9959 | | |
9960 | | - | |
| 9960 | + | |
9961 | 9961 | | |
9962 | 9962 | | |
9963 | 9963 | | |
| |||
9970 | 9970 | | |
9971 | 9971 | | |
9972 | 9972 | | |
| 9973 | + | |
| 9974 | + | |
| 9975 | + | |
| 9976 | + | |
| 9977 | + | |
| 9978 | + | |
| 9979 | + | |
| 9980 | + | |
| 9981 | + | |
| 9982 | + | |
| 9983 | + | |
| 9984 | + | |
| 9985 | + | |
9973 | 9986 | | |
9974 | 9987 | | |
9975 | 9988 | | |
| |||
36165 | 36178 | | |
36166 | 36179 | | |
36167 | 36180 | | |
36168 | | - | |
| 36181 | + | |
36169 | 36182 | | |
36170 | 36183 | | |
36171 | 36184 | | |
| |||
0 commit comments