Skip to content

fix(perps): route deposit flow to redesigned confirmations with perps header cp-7.69.0#27106

Merged
gambinish merged 5 commits into
mainfrom
fix/perps/deposit-routing
Mar 9, 2026
Merged

fix(perps): route deposit flow to redesigned confirmations with perps header cp-7.69.0#27106
gambinish merged 5 commits into
mainfrom
fix/perps/deposit-routing

Conversation

@michalconsensys
Copy link
Copy Markdown
Contributor

@michalconsensys michalconsensys commented Mar 6, 2026

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

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

Before

After

simulator_screenshot_1025DB15-7197-4622-964F-F1F05143DFC8

Pre-merge author checklist

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.

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.

Written by Cursor Bugbot for commit 48571b0. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

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.

@metamaskbot metamaskbot added the team-perps Perps team label Mar 6, 2026
@github-actions github-actions Bot added the size-S label Mar 6, 2026
@michalconsensys michalconsensys marked this pull request as ready for review March 6, 2026 08:03
@michalconsensys michalconsensys requested a review from a team as a code owner March 6, 2026 08:03
Comment thread app/components/UI/Perps/hooks/usePerpsBalanceTokenFilter.ts Outdated
@michalconsensys michalconsensys changed the title fix(perps): route deposit flow to redesigned confirmations with perps header fix(perps): route deposit flow to redesigned confirmations with perps header cp-7.69.0 Mar 6, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.28%. Comparing base (d67656d) to head (276592f).
⚠️ Report is 53 commits behind head on main.

Files with missing lines Patch % Lines
...nents/UI/Perps/hooks/usePerpsBalanceTokenFilter.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #27106       +/-   ##
===========================================
- Coverage   81.51%   51.28%   -30.24%     
===========================================
  Files        4627     4626        -1     
  Lines      121093   121269      +176     
  Branches    26453    26645      +192     
===========================================
- Hits        98706    62187    -36519     
- Misses      15480    53773    +38293     
+ Partials     6907     5309     -1598     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

aganglada
aganglada previously approved these changes Mar 6, 2026
{
showPerpsHeader: true,
},
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded showPerpsHeader bypasses shared config constant

Low Severity

The showPerpsHeader value is hardcoded to true, but every other perps navigation path (PerpsOrderRedirect.tsx, usePerpsNavigation.ts) uses CONFIRMATION_HEADER_CONFIG.ShowPerpsHeaderForDepositAndTrade from the shared perpsConfig constants. Hardcoding the value here means this code path won't respect future changes to that configuration constant, creating an inconsistency across perps deposit/order flows.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread app/components/UI/Perps/hooks/usePerpsBalanceTokenFilter.test.ts
@github-actions github-actions Bot added size-M and removed size-S labels Mar 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePreps
  • Risk Level: medium
  • AI Confidence: 80%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are limited to the Perps feature (usePerpsBalanceTokenFilter hook and its unit test). This hook directly impacts how balance tokens are filtered and displayed within the Perps UI. Since Perps functionality (including balance display and Add Funds flow) is covered by SmokePerps, we must run that suite.

Per the tag rules:

  • Selecting SmokePerps requires also selecting SmokeWalletPlatform because Perps is embedded within the Trending tab and shares wallet platform infrastructure.
  • Selecting SmokePerps also requires SmokeConfirmations because Add Funds flows involve on-chain transactions and confirmation screens.

No other areas (accounts, identity, network abstractions, snaps, ramps, card, swaps, predictions, multi-chain API) are affected by this hook change.

Risk is medium because although the change is scoped to a UI hook, it affects financial balance filtering logic in a trading feature, which could indirectly impact user flows (e.g., incorrect token availability for deposits).

Performance Test Selection:
The updated hook affects token filtering logic in the Perps balance view. While likely lightweight, it participates in Perps screen rendering and balance computation. Running @PerformancePreps ensures there is no regression in Perps market loading, balance display, or Add Funds performance.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

E2E Fixture Validation — Schema is up to date
9 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 9, 2026

@gambinish gambinish added this pull request to the merge queue Mar 9, 2026
Merged via the queue into main with commit 9975c8c Mar 9, 2026
99 checks passed
@gambinish gambinish deleted the fix/perps/deposit-routing branch March 9, 2026 19:56
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-M team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants