Skip to content

feat(perps): add Perps Withdraw confirmation flow and post-quote config#28236

Merged
dan437 merged 1 commit into
mainfrom
perps-withdraw-confirmation-2
Apr 1, 2026
Merged

feat(perps): add Perps Withdraw confirmation flow and post-quote config#28236
dan437 merged 1 commit into
mainfrom
perps-withdraw-confirmation-2

Conversation

@dan437

@dan437 dan437 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Description

Wires up the confirmation UI and post-quote logic so that perpsWithdraw transactions go through the correct gasless HyperLiquid withdrawal flow via Relay.

This is the second of two PRs for Perps Withdraw (follows the first one which added activity/display support).

Changes

  • Post-quote config (useTransactionPayPostQuote): Sets isHyperliquidSource = true for perps withdrawals, skips refundTo (funds go HyperCore → Relay directly, no Safe proxy involved)
  • Custom amount (useTransactionCustomAmount): Sources available balance from PerpsController.state.accountState.availableBalance for perps withdrawals
  • Insufficient balance alert (useInsufficientBalanceAlert): Suppresses the "not enough ETH for gas" alert for perpsWithdraw since the withdrawal is gasless
  • Confirmation UI: Adds perpsWithdraw to TRANSACTION_TYPES_DISABLE_ALERT_BANNER, HIDE_FOOTER_BY_DEFAULT_TYPES, and GO_BACK_TYPES
  • Bridge fee row: Shows withdraw-specific tooltip text and "Provider fee" label for perpsWithdraw
  • Metrics (useTransactionPayMetrics): Includes perpsWithdraw in pay metrics tracking

Core dependency

Changelog

CHANGELOG entry: Add Perps Withdraw confirmation flow

Related issues

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

Manual testing steps

Feature: Perps Withdraw confirmation flow

  Scenario: user withdraws from HyperLiquid Perps to any token
    Given the user has a funded HyperLiquid Perps account
    And the user navigates to the Perps Withdraw page via Developer Options

    When user enters a withdrawal amount
    And selects a destination token (e.g. BNB)
    Then the transaction fee is shown with a tooltip
    And no "Insufficient funds" alert is displayed
    And the available Perps balance is shown correctly

    When user confirms the withdrawal
    Then the withdrawal completes successfully
    And the transaction appears in the Activity list as "Perps withdraw"

Screenshots/Recordings

Before

N/A

After

N/A

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
Adds new perpsWithdraw handling across confirmation UI and Transaction Pay post-quote configuration; mistakes could misroute withdrawals or misconfigure bridge/refund behavior. Changes are scoped to the confirmations/pay flow and include tests and copy updates.

Overview
Enables the confirmations flow to properly support Perps withdrawals (TransactionType.perpsWithdraw) across UI behavior, fee display, and Transaction Pay configuration.

Perps withdrawals are now treated as gasless/Hyperliquid-sourced in useTransactionPayPostQuote (sets isPostQuote and isHyperliquidSource, and skips refundTo), suppress the insufficient native-balance alert, and use PerpsController.state.accountState.availableBalance for custom-amount percentage calculations.

Confirmation presentation is adjusted for perpsWithdraw (hide alert banner/footer by default and include it in go-back handling), and the transaction-fee tooltip/copy is extended with a new perps_withdraw localized message; related unit tests were updated/added.

Written by Cursor Bugbot for commit 8fdd9cb. This will update automatically on new commits. Configure here.

@dan437 dan437 requested a review from a team as a code owner April 1, 2026 09:02
@github-actions

github-actions Bot commented Apr 1, 2026

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.

@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Apr 1, 2026
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 1, 2026
@dan437 dan437 force-pushed the perps-withdraw-confirmation-2 branch from eb26b02 to b19772a Compare April 1, 2026 09:40
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 1, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread locales/languages/en.json
OGPoyraz
OGPoyraz previously approved these changes Apr 1, 2026
@dan437 dan437 dismissed stale reviews from OGPoyraz and pedronfigueiredo via 8fdd9cb April 1, 2026 11:11
@dan437 dan437 force-pushed the perps-withdraw-confirmation-2 branch from b19772a to 8fdd9cb Compare April 1, 2026 11:11
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 1, 2026
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeConfirmations, 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 adds support for TransactionType.perpsWithdraw across the confirmation flow:

  1. confirm-component.tsx: perpsWithdraw added to TRANSACTION_TYPES_DISABLE_ALERT_BANNER - disables alert banner for perps withdraw confirmations
  2. footer.tsx: perpsWithdraw added to HIDE_FOOTER_BY_DEFAULT_TYPES - hides the default footer for perps withdraw
  3. bridge-fee-row.tsx: New tooltip message for perpsWithdraw fee row, plus cosmetic refactor of fee calculation
  4. useInsufficientBalanceAlert.ts: perpsWithdraw added to IGNORE_TYPES - suppresses insufficient balance alerts for perps withdrawals
  5. useTransactionPayPostQuote.ts: Sets isHyperliquidSource=true and skips refundTo for perps withdrawals (funds go HyperCore → Relay directly)
  6. useTransactionConfirm.ts: perpsWithdraw added to GO_BACK_TYPES - navigates back after confirmation
  7. useTransactionCustomAmount.ts: Reads available balance from PerpsController.state.accountState.availableBalance for perps withdraw
  8. locales/en.json: New tooltip string for perps withdraw fee

Tag selection rationale:

  • SmokePerps: Directly tests perps functionality including the Add Funds/withdraw flow on Arbitrum One. The perps withdraw confirmation flow is the core of these changes.
  • SmokeConfirmations: The confirmation component, footer, alert system, and fee row are all modified. While changes are targeted to perpsWithdraw type, the shared confirmation infrastructure is touched and should be validated.
  • SmokeWalletPlatform: Per tag description, Perps is a section inside the Trending tab. Changes to Perps views affect Trending/SmokeWalletPlatform.

Dependent tags per descriptions:

  • SmokePerps description says: "also select SmokeWalletPlatform (Trending section) and SmokeConfirmations (Add Funds deposits are on-chain transactions)" - both already included.

Not selected:

  • SmokeTrade: While Perps entry is via TradeWalletActions, the changes are specifically in the confirmation flow for perpsWithdraw, not the trade entry points themselves.
  • Other tags: No impact on accounts, identity, network, ramps, multichain API, predictions, or snaps.

Performance Test Selection:
The changes are focused on adding perpsWithdraw transaction type support to the confirmation flow. These are logic/UI changes for a specific transaction type (adding it to various type-check lists, setting config flags, reading balance from PerpsController). There are no changes to rendering performance, list components, data loading patterns, app startup, or other performance-sensitive areas. No performance tests are warranted.

View GitHub Actions results

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

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

@sonarqubecloud

sonarqubecloud Bot commented Apr 1, 2026

Copy link
Copy Markdown

@dan437 dan437 enabled auto-merge April 1, 2026 12:34
@dan437 dan437 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into main with commit 930cfc8 Apr 1, 2026
400 of 421 checks passed
@dan437 dan437 deleted the perps-withdraw-confirmation-2 branch April 1, 2026 13:48
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 1, 2026
@weitingsun weitingsun added release-7.73.0 Issue or pull request that will be included in release 7.73.0 and removed release-101.2.0 labels Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants