Commit 9975c8c
authored
fix(perps): route deposit flow to redesigned confirmations with perps header cp-7.69.0 (MetaMask#27106)
## **Description**
The perps deposit flow was using `navigateToConfirmation({ stack:
Routes.PERPS.ROOT })`, which did not correctly route users to the
redesigned confirmations screen after initiating a deposit. Users could
end up on the wrong confirmation stack or without the perps-specific
header.
This change updates the flow so that when the user taps the Perps
balance token to deposit:
1. The current approval/confirmation is dismissed via `handleReject()`
from `useApprovalRequest`.
2. `depositWithConfirmation()` runs to start the deposit flow.
3. On success, navigation goes to `REDESIGNED_CONFIRMATIONS` with
`showPerpsHeader: true` instead of the previous PERPS.ROOT stack.
Dependencies on `useConfirmNavigation` are removed in favor of
`useNavigation` and `useApprovalRequest` so the deposit action and
post-deposit navigation are explicit and aligned with the redesigned
confirmations screen.
## **Changelog**
CHANGELOG entry: Fixed perps deposit flow so it routes to the redesigned
confirmations screen with the perps header after a successful deposit.
## **Related issues**
Fixes:
https://consensys.slack.com/archives/C092T3GPHQD/p1772719051867319
## **Manual testing steps**
```gherkin
Feature: Perps deposit from pay-with / token list
Scenario: user initiates perps deposit from token selector
Given user is on a confirmation screen with "Perps balance" in the token list (e.g. perps deposit and order)
When user taps "Perps balance" to deposit
Then the current confirmation is dismissed, deposit flow runs, and on success the user is taken to the redesigned confirmations screen with the perps header visible
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<img width="1206" height="2622"
alt="simulator_screenshot_1025DB15-7197-4622-964F-F1F05143DFC8"
src="https://github.com/user-attachments/assets/5e3dde3e-e91b-4966-945e-8a1b910933e0"
/>
<!-- [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]
> **Medium Risk**
> Changes the perps deposit tap-handler to dismiss the current approval
and navigate to a different confirmation route, so regressions could
strand users on the wrong screen or break the deposit flow sequencing.
>
> **Overview**
> Fixes the **Perps “Add funds”** action from the synthetic “Perps
balance” token so it no longer uses
`useConfirmNavigation`/`Routes.PERPS.ROOT`.
>
> The handler now calls `useApprovalRequest().onReject()` to dismiss the
current approval, runs `depositWithConfirmation()`, and then navigates
via React Navigation to
`Routes.FULL_SCREEN_CONFIRMATIONS.REDESIGNED_CONFIRMATIONS` with
`showPerpsHeader: true`. Tests were updated to mock the new hooks
(`useNavigation`, `useApprovalRequest`) and assert the new call
order/route using `waitFor`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
48571b0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent c9e0ded commit 9975c8c
2 files changed
Lines changed: 75 additions & 45 deletions
File tree
- app/components/UI/Perps/hooks
Lines changed: 55 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | | - | |
26 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| |||
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
67 | 78 | | |
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
71 | | - | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
80 | | - | |
| 92 | + | |
81 | 93 | | |
82 | 94 | | |
83 | | - | |
| 95 | + | |
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
| |||
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
95 | 110 | | |
96 | 111 | | |
97 | 112 | | |
| |||
200 | 215 | | |
201 | 216 | | |
202 | 217 | | |
203 | | - | |
204 | | - | |
205 | | - | |
| 218 | + | |
| 219 | + | |
206 | 220 | | |
207 | 221 | | |
208 | 222 | | |
| |||
222 | 236 | | |
223 | 237 | | |
224 | 238 | | |
225 | | - | |
| 239 | + | |
226 | 240 | | |
227 | | - | |
228 | | - | |
| 241 | + | |
229 | 242 | | |
230 | 243 | | |
231 | 244 | | |
| |||
255 | 268 | | |
256 | 269 | | |
257 | 270 | | |
258 | | - | |
| 271 | + | |
259 | 272 | | |
260 | | - | |
261 | | - | |
| 273 | + | |
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
| |||
280 | 292 | | |
281 | 293 | | |
282 | 294 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
291 | 304 | | |
292 | 305 | | |
293 | 306 | | |
| |||
314 | 327 | | |
315 | 328 | | |
316 | 329 | | |
317 | | - | |
| 330 | + | |
318 | 331 | | |
319 | 332 | | |
320 | 333 | | |
| |||
336 | 349 | | |
337 | 350 | | |
338 | 351 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
345 | 363 | | |
346 | 364 | | |
347 | 365 | | |
| |||
Lines changed: 20 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | | - | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
50 | | - | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
59 | | - | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
63 | 75 | | |
64 | | - | |
65 | 76 | | |
66 | 77 | | |
67 | | - | |
68 | | - | |
| 78 | + | |
69 | 79 | | |
| 80 | + | |
| 81 | + | |
70 | 82 | | |
71 | 83 | | |
72 | 84 | | |
| |||
0 commit comments