Skip to content

fix: money account withdraw should not be enabled in case there is no quote#29342

Merged
jpuri merged 105 commits into
mainfrom
withdraw_quote_fix
May 4, 2026
Merged

fix: money account withdraw should not be enabled in case there is no quote#29342
jpuri merged 105 commits into
mainfrom
withdraw_quote_fix

Conversation

@jpuri

@jpuri jpuri commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Description

It should not be possible to submit money account withdraw if there is no quote.

Changelog

CHANGELOG entry:

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1230

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

NA

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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
Moderate risk: changes blocking alert logic used to disable submission in post-quote withdrawal flows, so edge-case gating could become too strict or too lenient if required-token/max-amount signals are wrong.

Overview
Prevents money account withdraw from being enabled when no quote is available in post-quote scenarios where sourceAmounts can be empty (e.g., same-token/same-chain withdraws filtered out by calculatePostQuoteSourceAmounts).

useNoPayTokenQuotesAlert now also triggers the blocking No quotes alert for post-quote flows when there’s a positive required-token input (or isMaxAmount), even if sourceAmounts is empty, and the test suite adds coverage for these new edge cases.

Reviewed by Cursor Bugbot for commit b609cd1. Bugbot is set up for automated code reviews on this repo. Configure here.

Base automatically changed from money_acc_percent_btn_fix to main April 30, 2026 17:01
@jpuri jpuri enabled auto-merge May 1, 2026 04:57
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.95%. Comparing base (51b6bbd) to head (adb919c).
⚠️ Report is 31 commits behind head on main.

Files with missing lines Patch % Lines
...irmations/hooks/alerts/useNoPayTokenQuotesAlert.ts 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29342      +/-   ##
==========================================
- Coverage   82.15%   81.95%   -0.20%     
==========================================
  Files        5178     5186       +8     
  Lines      137450   138128     +678     
  Branches    31079    31317     +238     
==========================================
+ Hits       112924   113207     +283     
- Misses      16875    17230     +355     
- Partials     7651     7691      +40     

☔ 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.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations, SmokeMoney, SmokePerps, SmokePredictions, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:

The PR contains three changes:

  1. pay-with-row.tsx: Whitespace-only change (blank line added). No functional impact.

  2. useNoPayTokenQuotesAlert.ts: Logic fix adding a new shouldShowPostQuoteNoQuotesAlert condition. This handles an edge case in post-quote flows (e.g., money account withdraw MUSD → MUSD) where sourceAmounts is empty because same-token/same-chain entries are filtered out by calculatePostQuoteSourceAmounts. Without this fix, the alert wouldn't fire and the Withdraw button would incorrectly remain enabled. The fix also handles isMaxAmount flag for zero-amount required tokens.

  3. useNoPayTokenQuotesAlert.test.ts: Unit tests for the new logic.

Impact tracing:

  • useNoPayTokenQuotesAlert is consumed by useConfirmationAlerts.ts (general confirmation alert system → SmokeConfirmations)
  • PerpsOrderView.tsx directly uses this hook → SmokePerps (and per tag description, SmokePerps requires SmokeWalletPlatform + SmokeConfirmations)
  • usePredictBuyInfo.ts (PredictBuyWithAnyToken) uses this hook → SmokePredictions (and per tag description, SmokePredictions requires SmokeWalletPlatform + SmokeConfirmations)
  • The fix specifically targets money account withdraw flows → SmokeMoney (and per tag description, SmokeMoney requires SmokeConfirmations)

Dependent tags per descriptions:

  • SmokePerps → SmokeWalletPlatform + SmokeConfirmations
  • SmokePredictions → SmokeWalletPlatform + SmokeConfirmations
  • SmokeMoney → SmokeConfirmations

No performance impact expected from this alert logic change.

Performance Test Selection:
The changes are limited to alert logic in a hook (useNoPayTokenQuotesAlert) and a whitespace change in a component. These are conditional logic fixes that determine when to show a blocking alert - they have no impact on rendering performance, data loading, or app startup. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@jpuri jpuri added this pull request to the merge queue May 4, 2026
Merged via the queue into main with commit ce9091b May 4, 2026
99 of 101 checks passed
@jpuri jpuri deleted the withdraw_quote_fix branch May 4, 2026 13:24
@github-actions github-actions Bot locked and limited conversation to collaborators May 4, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants