Commit e926bf7
feat: unified swaps (#16433)
<!--
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**
<!--
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?
-->
This PR handles Unified Swaps routing, network, and token selection.
It's hidden behind an env var and a feature flag, so there is no risk of
accidentally exposing this feature before it's ready.
## **Related issues**
Resolves: https://consensyssoftware.atlassian.net/browse/MMS-2341
## **Manual testing steps**
Setup
1. Add `export MM_UNIFIED_SWAPS_ENABLED="true"` to `.js.env`
2. Terminal: `source .js.env`
3. Start the app up
Swaps
5. Go to Swaps (notice there's no Bridge button anymore)
6. Request a quote for a source and dest token with the same chain
Bridge
5. Go to Swaps (notice there's no Bridge button anymore)
6. Request a quote for a source and dest token with a different chain
Feature flags
1. Add `export MM_UNIFIED_SWAPS_ENABLED="false"` to `.js.env`
2. Terminal: `source .js.env`
3. Start the app up
4. You should see 2 buttons for Swap and Bridge
5. Swap btn should take you to Legacy Swaps
6. Bridge btn should take you to Bridge
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
Bridge
https://github.com/user-attachments/assets/eb597e89-8e98-4413-a006-f17a5428e1c2
Swap
https://github.com/user-attachments/assets/1c7dd607-7653-4359-bd5a-53d528ba5b5c
## **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.
---------
Co-authored-by: Bryan Fullam <bryan.fullam@consensys.net>
Co-authored-by: Davide Brocchetto <davide.brocchetto@consensys.net>
Co-authored-by: OGPoyraz <omergoktugpoyraz@gmail.com>1 parent 986898d commit e926bf7
File tree
44 files changed
+1021
-679
lines changed- app
- components
- UI
- Bridge
- Views/BridgeView
- components
- BridgeDestNetworkSelector
- BridgeDestTokenSelector
- __snapshots__
- BridgeSourceTokenSelector
- __snapshots__
- TokenInputArea
- TransactionDetails
- hooks
- useInitialDestToken
- useInitialSourceToken
- Views
- Asset
- WalletActions
- core/Engine
- e2e
- pages
- Bridge
- swaps
- wallet
- selectors/Bridge
- specs
- assets/multichain
- quarantine
- swaps
- helpers
- locales/languages
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
44 files changed
+1021
-679
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
Lines changed: 17 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | 289 | | |
293 | 290 | | |
294 | 291 | | |
| |||
901 | 898 | | |
902 | 899 | | |
903 | 900 | | |
904 | | - | |
| 901 | + | |
905 | 902 | | |
906 | 903 | | |
907 | 904 | | |
| |||
916 | 913 | | |
917 | 914 | | |
918 | 915 | | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
923 | 920 | | |
924 | 921 | | |
925 | 922 | | |
| |||
994 | 991 | | |
995 | 992 | | |
996 | 993 | | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
1001 | 998 | | |
1002 | 999 | | |
1003 | 1000 | | |
| |||
1072 | 1069 | | |
1073 | 1070 | | |
1074 | 1071 | | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
1079 | 1076 | | |
1080 | 1077 | | |
1081 | 1078 | | |
| |||
1144 | 1141 | | |
1145 | 1142 | | |
1146 | 1143 | | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1151 | 1148 | | |
1152 | 1149 | | |
1153 | 1150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
66 | | - | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
| |||
106 | 104 | | |
107 | 105 | | |
108 | 106 | | |
| 107 | + | |
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
| |||
220 | 219 | | |
221 | 220 | | |
222 | 221 | | |
223 | | - | |
224 | | - | |
| 222 | + | |
| 223 | + | |
225 | 224 | | |
226 | 225 | | |
227 | 226 | | |
| |||
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
234 | | - | |
| 233 | + | |
235 | 234 | | |
236 | 235 | | |
237 | 236 | | |
| |||
251 | 250 | | |
252 | 251 | | |
253 | 252 | | |
254 | | - | |
| 253 | + | |
255 | 254 | | |
256 | 255 | | |
257 | 256 | | |
| |||
326 | 325 | | |
327 | 326 | | |
328 | 327 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | 328 | | |
333 | 329 | | |
334 | 330 | | |
335 | 331 | | |
336 | 332 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 333 | | |
341 | 334 | | |
342 | 335 | | |
343 | 336 | | |
344 | 337 | | |
345 | 338 | | |
346 | | - | |
| 339 | + | |
347 | 340 | | |
348 | 341 | | |
349 | 342 | | |
| |||
Lines changed: 12 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
68 | | - | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
101 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
106 | 114 | | |
107 | | - | |
| 115 | + | |
108 | 116 | | |
109 | 117 | | |
110 | 118 | | |
| |||
Lines changed: 5 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
| |||
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
| 31 | + | |
36 | 32 | | |
37 | 33 | | |
38 | 34 | | |
| |||
248 | 244 | | |
249 | 245 | | |
250 | 246 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 247 | + | |
256 | 248 | | |
257 | 249 | | |
258 | 250 | | |
| |||
265 | 257 | | |
266 | 258 | | |
267 | 259 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
| 260 | + | |
273 | 261 | | |
274 | 262 | | |
275 | 263 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
866 | 866 | | |
867 | 867 | | |
868 | 868 | | |
869 | | - | |
| 869 | + | |
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
| |||
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | | - | |
| 1161 | + | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
| |||
1450 | 1450 | | |
1451 | 1451 | | |
1452 | 1452 | | |
1453 | | - | |
| 1453 | + | |
1454 | 1454 | | |
1455 | 1455 | | |
1456 | 1456 | | |
| |||
0 commit comments