fix: skip insufficient balance alert when fiat payment method is selected#30444
Conversation
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Why SmokeConfirmations: The Why SmokeMoney: The change specifically targets fiat payment flows (checking Risk is low because:
Performance Test Selection: |
|



Description
Fixes an issue where the
insufficient_balanceblocking alert fires during MoneyAccountDeposit confirmation when a fiat payment method (e.g., Apple Pay, debit card) is selected in the PayWith section.Related Issue
https://consensyssoftware.atlassian.net/browse/CONF-1410
Root Cause
The
useInsufficientBalanceAlerthook checksisUsingPay(fromuseTransactionPayHasSourceAmount) to skip the alert when the user is paying with crypto via bridge/swap. However, when a fiat payment method is selected, there are no crypto source amounts — fiat goes through a completely different path (useFiatConfirm→startHeadlessBuy). SoisUsingPayremainsfalse, and the hook proceeds to check the native token balance, which is expected to be low for fiat-only users. This causes the blocking alert to fire incorrectly.The
IGNORE_TYPESarray only includes withdraw types (moneyAccountWithdraw,perpsWithdraw,predictWithdraw), somoneyAccountDepositis not excluded either.Changes
isFiatPaymentSelectedguard to the early-return inuseInsufficientBalanceAlert, reading fromuseTransactionPayFiatPayment().selectedPaymentMethodId. When a fiat payment method is active, the native balance check is irrelevant and the alert is skipped.console.logstatement.Manual testing steps
insufficient_balancealert does not appearinsufficient_balancealert does appear correctlyScreenshots/Recordings
N/A - logic-only change
Pre-merge author checklist
Note
Low Risk
Low risk: adds a narrow guard to suppress a blocking alert only when a fiat payment method is selected, with a targeted unit test covering the new behavior.
Overview
Prevents the
insufficient_balanceblocking alert from showing during confirmations when a fiat PayWith method is selected by adding an early-return guard inuseInsufficientBalanceAlertbased onuseTransactionPayFiatPayment().selectedPaymentMethodId.Updates tests to mock
useTransactionPayFiatPaymentand adds coverage asserting the hook returns[]when a fiat payment method is active.Reviewed by Cursor Bugbot for commit 6d26e03. Bugbot is set up for automated code reviews on this repo. Configure here.