fix(money): skip insufficient-funds alert on Max money account deposit cp-8.5.0 - #33836
Conversation
A Max money account deposit derives its amount from a balance snapshot while the insufficient-funds alert compares against a live balance. Fiat rounding between the two could push the amount marginally above the live balance and falsely show "Insufficient funds", even though the submitted token amount is clamped to the actual raw balance. Track the Max deposit selection via ConfirmationContext (isMaxDeposit) and have useInsufficientPayTokenBalanceAlert skip the input check for a Max money account deposit.
|
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. |
A Max money account deposit derives its amount from a balance snapshot while the insufficient-funds alert compares against a live balance. Fiat rounding between the two could push the amount marginally above the live balance and falsely show "Insufficient funds", even though the submitted token amount is clamped to the actual raw balance. Track the Max deposit selection via ConfirmationContext (isMaxDeposit) and have useInsufficientPayTokenBalanceAlert skip the input check for a Max money account deposit.
…tps://github.com/MetaMask/metamask-mobile into fix/money-account-max-deposit-insufficient-funds
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag Selection:
Not selected:
Performance tests: No performance-sensitive code paths are changed. The changes are purely logic/state management for alert suppression in a specific deposit scenario. Performance Test Selection: |
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #33836 +/- ##
========================================
Coverage 84.76% 84.77%
========================================
Files 6244 6245 +1
Lines 168009 168125 +116
Branches 41120 41145 +25
========================================
+ Hits 142420 142528 +108
- Misses 15848 15855 +7
- Partials 9741 9742 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|



Description
A Max money account deposit derives its amount from a balance snapshot while the insufficient-funds alert compares against a live balance. Fiat rounding between the two could push the amount marginally above the live balance and falsely show "Insufficient funds", even though the submitted token amount is clamped to the actual raw balance.
Track the Max deposit selection via ConfirmationContext (isMaxDeposit) and have useInsufficientPayTokenBalanceAlert skip the input check for a Max money account deposit.
Changelog
CHANGELOG entry:
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1730
Manual testing steps
NA
Screenshots/Recordings
NA
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Localized confirmation/money-deposit UX fix with tests; no auth, payment submission, or broad alert logic changes beyond the max-deposit exception.
Overview
Fixes a false Insufficient funds blocking alert when users choose Max on a money account deposit. The Max amount comes from a balance snapshot, but the alert compares fiat against a live balance, so tiny rounding gaps could block confirm even though the on-chain amount is clamped to the real balance.
ConfirmationContext now exposes
isMaxDeposit/setIsMaxDeposit.useTransactionCustomAmountsets the flag when 100% is chosen for a money account deposit and clears it on manual edits or pay-token changes.useInsufficientPayTokenBalanceAlertskips the input-balance check only formoneyAccountDepositwhenisMaxDepositis true; other flows are unchanged.Tests cover context state, alert behavior for max vs non-max deposits, and updated confirmation mocks.
Reviewed by Cursor Bugbot for commit ac519e2. Bugbot is set up for automated code reviews on this repo. Configure here.