Skip to content

fix: correct fiat no-quotes alert condition in useNoPayTokenQuotesAlert#30601

Merged
OGPoyraz merged 1 commit into
mainfrom
fix/fiat-no-quotes-alert
May 26, 2026
Merged

fix: correct fiat no-quotes alert condition in useNoPayTokenQuotesAlert#30601
OGPoyraz merged 1 commit into
mainfrom
fix/fiat-no-quotes-alert

Conversation

@OGPoyraz

@OGPoyraz OGPoyraz commented May 25, 2026

Copy link
Copy Markdown
Member

Description

The fiat no-quotes alert in useNoPayTokenQuotesAlert was not firing when a fiat payment method was selected with a valid amount but no ramps quote was available.

shouldShowFiatNoQuotesAlert required sourceAmounts?.length === 0, but in fiat payment flows sourceAmounts can be populated (tokens the user needs) while no quote exists to fill them. This prevented the alert from ever showing.

Replaced sourceAmounts?.length === 0 with !fiatPayment?.rampsQuote so the alert fires based on the actual ramps quote availability rather than the source amounts array length. Also added two test cases covering the new condition.

Changelog

CHANGELOG entry: Fixed fiat no-quotes alert not showing when paying with a card and no ramps quote is available

Related issues

Fixes:

Manual testing steps

Feature: Fiat no-quotes alert

  Scenario: Alert shows when fiat payment has no ramps quote
    Given user is on a confirmation screen with fiat payment selected
    And a valid fiat amount is entered
    And no ramps quote is available

    When quotes finish loading
    Then a danger alert is displayed indicating no quotes are available

  Scenario: Alert does not show when ramps quote exists
    Given user is on a confirmation screen with fiat payment selected
    And a valid fiat amount is entered
    And a ramps quote is present

    When quotes finish loading
    Then no danger alert is displayed

Screenshots/Recordings

Before

After

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

Low Risk
Small confirmation-alert condition change with unit tests; no auth, payments execution, or broad refactors.

Overview
Fixes the fiat "no quotes" blocking alert on transaction confirmation so it reflects whether a ramps quote exists, not whether sourceAmounts is empty.

shouldShowFiatNoQuotesAlert previously required sourceAmounts?.length === 0, which often failed in card/fiat flows because sourceAmounts can still list tokens the user must cover even when no ramps quote is available—so the danger alert never appeared. The condition now uses !fiatPayment?.rampsQuote (with quotes still empty and not loading). Tests cover no alert when rampsQuote is present and alert when sourceAmounts is non-empty but rampsQuote is missing.

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

@OGPoyraz OGPoyraz requested a review from a team as a code owner May 25, 2026 15:51
@metamaskbotv2 metamaskbotv2 Bot added the team-confirmations Push issues to confirmations team label May 25, 2026
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 25, 2026
@OGPoyraz OGPoyraz force-pushed the fix/fiat-no-quotes-alert branch from 537a660 to 40f7fdc Compare May 25, 2026 15:52
@OGPoyraz OGPoyraz added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels May 25, 2026
@metamaskbotv2 metamaskbotv2 Bot added INVALID-PR-TEMPLATE PR's body doesn't match template and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels May 25, 2026
Replace `sourceAmounts?.length === 0` with `!fiatPayment?.rampsQuote` so the
alert fires when a fiat payment method is selected with a valid amount but no
ramps quote is available, regardless of whether sourceAmounts is populated.
@github-actions

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 changes useNoPayTokenQuotesAlert.ts — a targeted bug fix in the fiat payment alert condition within the confirmation alert system. The old condition sourceAmounts?.length === 0 is replaced with !fiatPayment?.rampsQuote to correctly determine when to show the "no pay token quotes" alert for fiat flows.

Direct impact:

  1. SmokeConfirmations: The hook feeds into useConfirmationAlerts.ts, which is the central alert aggregator for the confirmation UI. Any change to alert logic can affect confirmation screens.
  2. SmokeMoney: The fix is specifically for fiat payment flows (rampsQuote is a ramps/card concept). The shouldShowFiatNoQuotesAlert condition now correctly suppresses the alert when a ramps quote is already present, preventing false-positive blocking alerts in card/ramps flows.
  3. SmokePerps: useNoPayTokenQuotesAlert is directly imported and used in PerpsOrderView.tsx (line 671). The perps order flow uses this alert to block orders when no quotes are available.
  4. SmokePredictions: useNoPayTokenQuotesAlert is directly imported in usePredictBuyInfo.ts (line 31). The prediction market buy flow uses this alert similarly.

Dependent tags (per tag descriptions):

  • SmokePerps → also requires SmokeWalletPlatform (Trending section) and SmokeConfirmations
  • SmokePredictions → also requires SmokeWalletPlatform (Trending section) and SmokeConfirmations
  • SmokeMoney → SmokeConfirmations already included

Risk level: Medium — The change is a small logic fix but touches a blocking alert condition that could prevent users from proceeding in fiat, perps, and predictions flows. The fix is well-tested with new unit tests, but E2E validation is warranted for the affected flows.

Performance Test Selection:
The change is a small boolean condition fix in a React hook's alert logic. It does not affect rendering performance, data loading, list rendering, animations, or any performance-sensitive code paths. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@OGPoyraz OGPoyraz added this pull request to the merge queue May 26, 2026
Merged via the queue into main with commit 79542f2 May 26, 2026
204 checks passed
@OGPoyraz OGPoyraz deleted the fix/fiat-no-quotes-alert branch May 26, 2026 06:09
@github-actions github-actions Bot locked and limited conversation to collaborators May 26, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.80.0 Issue or pull request that will be included in release 7.80.0 label May 26, 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.80.0 Issue or pull request that will be included in release 7.80.0 size-S team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants