Skip to content

fix: hide big transaction fee on Perps withdraw when no quotes available cp-7.74.0#29313

Merged
dan437 merged 1 commit into
mainfrom
perps-withdraw-fee
Apr 24, 2026
Merged

fix: hide big transaction fee on Perps withdraw when no quotes available cp-7.74.0#29313
dan437 merged 1 commit into
mainfrom
perps-withdraw-fee

Conversation

@dan437

@dan437 dan437 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Description

When no viable quote existed for a Perps withdraw (e.g. $0.1 → ETH on Ethereum), the confirmation still showed a big transaction fee and an enabled Withdraw button, letting the user submit into a failing transaction.

useNoPayTokenQuotesAlert's isOptionalOnly check was matching the post-quote sourceAmount.targetTokenAddress (the destination token, e.g. native ETH 0x0…0) against a skipIfBalance required token on a different chain (Arbitrum native gas, also 0x0…0). That false match suppressed the NoPayTokenQuotes alert. isOptionalOnly is only meaningful for non-post-quote flows, so this PR bypasses it for post-quote. The existing CustomAmountInfo logic then hides the fee rows and shows the disabled "No quotes" button as designed.

Changelog

CHANGELOG entry: Fixed Perps withdraw showing a transaction fee and enabled button when no route was available; the rows now hide and the button shows "No quotes".

Related issues

Fixes: #29297

Manual testing steps

Feature: Perps withdraw handles missing quotes

  Scenario: no viable quote for the amount
    Given user is on the Perps withdraw confirmation
    When user enters "0.1" and selects "ETH on Ethereum"
    And user presses Done
    Then "Transaction fee" and "You'll receive" rows are not shown
    And the primary button shows "No quotes" and is disabled

  Scenario: viable quote exists (regression)
    Given user is on the Perps withdraw confirmation
    When user enters a viable amount and selects any receive token
    And user presses Done
    Then "Transaction fee" and "You'll receive" rows are shown
    And the primary button shows "Withdraw" and is enabled

Screenshots/Recordings

Before

image

After

$0.1
image

$0.5
image

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

Medium Risk
Changes blocking alert logic in transaction confirmations for post-quote flows, which can affect whether users can proceed with withdrawals; risk is moderated by targeted condition and added tests.

Overview
Fixes a false-negative in the NoPayTokenQuotes blocking alert for post-quote flows by bypassing the isOptionalOnly (skip-if-balance) suppression when useTransactionPayIsPostQuote is true, preventing cross-chain native-token address collisions (e.g., 0x0…0) from hiding the no-quotes state.

Adds/updates unit tests to cover the non-post-quote optional-token case and a regression scenario where a post-quote destination token address would previously suppress the alert.

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

Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
@dan437 dan437 requested a review from a team as a code owner April 24, 2026 09:35
@github-actions

Copy link
Copy Markdown
Contributor

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-confirmations Push issues to confirmations team label Apr 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are a targeted bug fix in useNoPayTokenQuotesAlert.ts that corrects a false-positive isOptionalOnly condition in post-quote flows (perps withdraw, predict, moneyAccount withdraw, musdConversion). The fix adds a useTransactionPayIsPostQuote check so that for post-quote flows, the skipIfBalance required token lookup is skipped — preventing a blocking "No quotes" alert from being incorrectly suppressed.

Direct impact:

  • useConfirmationAlerts.ts uses this hook → SmokeConfirmations
  • usePredictBuyInfo.ts (Predict feature) uses this hook directly → SmokePredictions
  • Perps withdraw flows are explicitly mentioned in the bug description → SmokePerps

Dependent tags per tag descriptions:

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

No performance impact: This is a pure logic fix in a React hook with no rendering, data loading, or state management performance implications.

Performance Test Selection:
The change is a pure logic bug fix in a React hook (adding a boolean guard condition). It has no impact on rendering performance, data loading, state management, or any other performance-sensitive area. No performance tests are warranted.

View GitHub Actions results

@dan437 dan437 enabled auto-merge April 24, 2026 09:45
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
12 value mismatches detected (expected — fixture represents an existing user).
View details

@dan437 dan437 added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit 0769701 Apr 24, 2026
125 checks passed
@dan437 dan437 deleted the perps-withdraw-fee branch April 24, 2026 10:23
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.76.0 Issue or pull request that will be included in release 7.76.0 label Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Perps withdraw to ETH on Ethereum show huge fee and fail

2 participants