Commit 97f945e
authored
refactor: Remove all external references to legacy Swaps routes (MetaMask#23108)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
The main goal of this PR is to remove all references to `Routes.SWAPS`
from the codebase (apart from the legacy Swaps View directory which will
be handled in a different PR).
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: null
## **Related issues**
Fixes:
https://consensyssoftware.atlassian.net/jira/software/c/projects/SWAPS/boards/1566?quickFilter=1772&selectedIssue=SWAPS-3472
## **Manual testing steps**
```gherkin
Ensure that users can navigate to swaps when they click the swap button next to a token in Browser view (see attached recording)
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
https://github.com/user-attachments/assets/df2961dc-a1f3-4da1-b135-52fdb69cd83e
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [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.
## **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]
> Replaces all external uses of legacy Swaps routes with Bridge
navigation and updates related handlers, constants, and tests.
>
> - **Navigation**:
> - Removed `Swaps` screens and imports from
`app/components/Nav/Main/MainNavigator.js`.
> - Added `BridgeView` import and ensured Bridge stacks
(`Routes.BRIDGE.ROOT`, `Routes.BRIDGE.MODALS.ROOT`) are the sole trade
route entries.
> - **Transactions UI**:
> - In `SmartTransactionStatus.tsx`, `createNewSwap` now navigates to
`Routes.BRIDGE.ROOT` instead of `Routes.SWAPS`.
> - **Deeplinks & SDK**:
> - `SwapHandler` now navigates to `Routes.BRIDGE.ROOT` →
`Routes.BRIDGE.BRIDGE_VIEW` with params `{ sourceToken, destToken,
sourceAmount, chainId }`.
> - `handleCustomRpcCalls` routes `target: 'swap'` to
`Routes.BRIDGE.ROOT`.
> - **Routes/Constants**:
> - Removed `Routes.SWAPS` and `Routes.SWAPS_AMOUNT_VIEW`; retained/used
Bridge route keys.
> - **Tests/Snapshots**:
> - Updated `SmartTransactionStatus.test.tsx` to expect Bridge
navigation.
> - Updated `SwapHandler.test.ts` to expect Bridge navigation and param
key changes.
> - Snapshot `MainNavigator.test.tsx.snap` updated to remove `Swaps`
screen.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
7eea25c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent f93f627 commit 97f945e
8 files changed
Lines changed: 19 additions & 49 deletions
File tree
- app
- components
- Views/transactions/SmartTransactionStatus
- core
- DeeplinkManager/handlers/v2
- __tests__
- SDKConnect/handlers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
| |||
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
| 134 | + | |
136 | 135 | | |
137 | 136 | | |
138 | 137 | | |
| |||
339 | 338 | | |
340 | 339 | | |
341 | 340 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | 341 | | |
353 | 342 | | |
354 | 343 | | |
| |||
874 | 863 | | |
875 | 864 | | |
876 | 865 | | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | 866 | | |
893 | 867 | | |
894 | 868 | | |
| |||
1099 | 1073 | | |
1100 | 1074 | | |
1101 | 1075 | | |
1102 | | - | |
1103 | 1076 | | |
1104 | 1077 | | |
1105 | 1078 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | 166 | | |
171 | 167 | | |
172 | 168 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
| 499 | + | |
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
239 | 237 | | |
240 | 238 | | |
241 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
Lines changed: 11 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 | | |
46 | | - | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
0 commit comments