Skip to content

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Nov 17, 2025

Description

Reject any existing unapproved Perps and Predict deposit transactions when navigating to the confirmation, and using the custom loader.

Also remove the back button in the Perps deposit confirmation while loading.

Changelog

CHANGELOG entry: null

Related issues

Fixes: #22715

Manual testing steps

Screenshots/Recordings

Before

After

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

Reject unapproved transactions when navigating to confirmation with CustomAmount loader and adjust Perps confirmation header (show header, no back); add supporting tests/mocks.

  • Confirmations:
    • Reject unapproved transactions via ApprovalController.reject when navigating with loader: CustomAmount, then proceed to navigate once cleared.
    • Read pending txs from Redux (selectTransactions); manage deferred navigation with local state/effect; add logs.
    • Default loader to CustomAmount when stack === Routes.PERPS.ROOT; honor headerShown === false to use NO_HEADER route.
  • UI (Perps):
    • routes/index.tsx: For FULL_SCREEN_CONFIRMATIONS.REDESIGNED_CONFIRMATIONS, set headerShown: true and headerLeft: () => null (no back button).
  • Tests:
    • Add useConfirmNavigation tests covering stack/no-header and rejection of pending txs.
    • Update PredictTabView.test.tsx to mock useConfirmNavigation.

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

@matthewwalsh0 matthewwalsh0 added the team-confirmations Push issues to confirmations team label Nov 17, 2025
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review November 17, 2025 23:18
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners November 17, 2025 23:18
@matthewwalsh0 matthewwalsh0 force-pushed the feat/reject-old-deposit-transactions branch from 3090cba to 1c0ef84 Compare November 19, 2025 14:58
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmationsRedesigned, SmokePerps, SmokePredictions
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

Analysis Summary

Changed Files:

  1. app/components/Views/confirmations/hooks/useConfirmNavigation.ts - Core confirmation navigation logic with significant behavioral changes
  2. app/components/Views/confirmations/hooks/useConfirmNavigation.test.ts - Test updates for the above
  3. app/components/UI/Perps/routes/index.tsx - Perps routing configuration change for confirmation screen
  4. app/components/UI/Predict/views/PredictTabView/PredictTabView.test.tsx - Test mock update

Key Changes:

1. useConfirmNavigation Hook (Main Change):

  • Added logic to automatically reject pending transactions when navigating to confirmation screen with ConfirmationLoader.CustomAmount
  • Introduced state management for pending navigation and transaction rejection
  • Uses TransactionController to track unapproved transactions
  • Calls ApprovalController.reject() to reject pending transactions before navigation
  • Added logging for debugging

2. Perps Routes:

  • Added headerLeft: () => null and headerShown: true to the confirmation screen in Perps stack
  • This changes the header behavior for confirmations within the Perps flow

3. Test Updates:

  • Mock added for useConfirmNavigation in PredictTabView tests
  • New test case added to verify pending transaction rejection logic

Impact Assessment:

Features Affected:

  1. Confirmations (SmokeConfirmationsRedesigned): Core confirmation flow logic is modified - the hook now handles pending transaction cleanup
  2. Perps (SmokePerps):
    • Uses CustomAmount loader extensively for deposit/withdrawal flows
    • Header configuration changed for confirmation screens
    • Multiple components use useConfirmNavigation (PerpsMarketBalanceActions, PerpsMarketDetailsView)
  3. Predictions (SmokePredictions):
    • Uses CustomAmount loader for deposit/withdraw operations
    • Multiple hooks depend on useConfirmNavigation (usePredictDeposit, usePredictWithdraw, usePredictClaim)

Risk Factors:

  • Changes core confirmation navigation behavior that affects multiple features
  • Introduces automatic transaction rejection which is a critical operation
  • Uses Engine.context.ApprovalController (critical controller interaction)
  • Changes navigation header behavior in Perps
  • Medium risk because while not a critical file per guidelines, it affects critical transaction flows

Why These Tags:

  • SmokeConfirmationsRedesigned: Direct changes to confirmation navigation and behavior
  • SmokePerps: Heavy user of the modified hook and has route configuration changes
  • SmokePredictions: Uses the same CustomAmount loader pattern that triggers the new rejection logic

Confidence Justification:

85% confidence because:

  • Changes are clear and well-understood through investigation
  • Impact scope is identifiable through importers analysis (11 files use this hook)
  • The main features affected (Perps, Predictions, Confirmations) are clearly identifiable
  • However, there could be edge cases in transaction state management that require testing

View GitHub Actions results

@sonarqubecloud
Copy link

@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit 7b75d21 Nov 20, 2025
74 of 75 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/reject-old-deposit-transactions branch November 20, 2025 09:25
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2025
@metamaskbot metamaskbot added the release-7.61.0 Issue or pull request that will be included in release 7.61.0 label Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.61.0 Issue or pull request that will be included in release 7.61.0 size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: If you open different confirmations shortly after one another, the wrong one is shown

5 participants