Skip to content

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

Merged
dan437 merged 11 commits into
mainfrom
perps-withdraw-confirmation
Mar 30, 2026
Merged

feat(perps): add Perps Withdraw confirmation flow and post-quote config#28046
dan437 merged 11 commits into
mainfrom
perps-withdraw-confirmation

Conversation

@dan437

@dan437 dan437 commented Mar 27, 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
  • TPC bump: Bumps @metamask/transaction-pay-controller to ^19.0.0 which includes the HyperLiquid submission logic

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 configuration, and bumps @metamask/transaction-pay-controller to a new major version; regressions could affect withdrawal routing, fee display, or gasless/sponsored alerting.

Overview
Enables a dedicated confirmation + payment flow for perpsWithdraw transactions, including post-quote configuration that marks withdrawals as Hyperliquid-sourced and skips refundTo.

Updates confirmation UX/behavior to treat perpsWithdraw like other special flows (hide footer/alert banner by default, adjust back navigation), suppresses insufficient-gas alerts for gasless withdrawals, and adds a withdraw-specific transaction-fee tooltip string. Also extends pay metrics (mm_pay_use_case) and custom-amount percentage calculations to use Perps available balance.

Separately bumps CI iOS bundle-size threshold (53→54) and updates fixtures/snapshots for new controller state fields; upgrades @metamask/transaction-pay-controller to ^19.0.0 (with associated lockfile churn).

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

@dan437 dan437 requested a review from a team as a code owner March 27, 2026 14:25
@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.

@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Mar 27, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk size-M labels Mar 27, 2026
@socket-security

socket-security Bot commented Mar 27, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​assets-controller@​2.4.0 ⏵ 3.2.17010080 +197 +2100
Updatednpm/​@​metamask/​base-controller@​9.0.0 ⏵ 9.0.1100 +11007393 +6100
Updatednpm/​@​metamask/​address-book-controller@​7.1.0 ⏵ 7.1.11001007394 +2100
Updatednpm/​@​metamask/​preferences-controller@​23.0.0 ⏵ 23.1.010010075 +196 +2100
Updatednpm/​@​metamask/​approval-controller@​9.0.0 ⏵ 9.0.11001007693 +2100
Updatednpm/​@​metamask/​gas-fee-controller@​26.1.0 ⏵ 26.1.1991007693 +1100
Updatednpm/​@​metamask/​remote-feature-flag-controller@​4.1.0 ⏵ 4.2.09910076 +194 +1100
Updatednpm/​@​metamask/​multichain-network-controller@​3.0.5 ⏵ 3.0.6981007697100
Updatednpm/​@​metamask/​snaps-rpc-methods@​15.0.0 ⏵ 15.0.1981007694 -150
Updatednpm/​@​metamask/​keyring-controller@​25.1.0 ⏵ 25.1.198 +11007895100
Updatednpm/​@​metamask/​network-controller@​30.0.0 ⏵ 30.0.196 -410078 -2296 -4100
Updatednpm/​@​metamask/​ramps-controller@​12.0.1 ⏵ 12.1.09610078 +198 +1100
Updatednpm/​@​metamask/​bridge-controller@​69.1.1 ⏵ 69.2.396 +110079 +199 +1100
Updatednpm/​@​metamask/​permission-controller@​12.2.1 ⏵ 12.3.09910079 +194 +2100
Updatednpm/​@​metamask/​eth-json-rpc-middleware@​23.1.0 ⏵ 23.1.1971008091 -4100
Updatednpm/​@​metamask/​transaction-pay-controller@​17.1.0 ⏵ 19.0.09810080 +199 +1100
Updatednpm/​@​metamask/​profile-sync-controller@​28.0.0 ⏵ 28.0.2971008798 +2100
Updatednpm/​@​metamask/​storage-service@​1.0.0 ⏵ 1.0.110010010091 +2100
Updatednpm/​@​metamask/​json-rpc-engine@​10.2.3 ⏵ 10.2.499 +110010094 +3100

View full report

@socket-security

socket-security Bot commented Mar 27, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • npm/@metamask/snaps-controllers@19.0.0

View full report

matthewwalsh0
matthewwalsh0 previously approved these changes Mar 27, 2026
@dan437 dan437 force-pushed the perps-withdraw-confirmation branch from 610beed to bca8426 Compare March 27, 2026 14:47
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 27, 2026
Comment thread locales/languages/en.json
@dan437 dan437 added the skip-e2e skip E2E test jobs label Mar 27, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 27, 2026
@dan437 dan437 force-pushed the perps-withdraw-confirmation branch from bca8426 to e710e8b Compare March 30, 2026 08:42
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 30, 2026
@dan437 dan437 force-pushed the perps-withdraw-confirmation branch from e710e8b to df9be88 Compare March 30, 2026 09:50
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 30, 2026
@dan437

dan437 commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@SocketSecurity ignore npm/@metamask/snaps-controllers@19.0.0

@dan437 dan437 force-pushed the perps-withdraw-confirmation branch from df9be88 to 4bb2092 Compare March 30, 2026 10:21
@dan437 dan437 requested a review from a team as a code owner March 30, 2026 10:21
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 30, 2026
@dan437 dan437 requested a review from a team as a code owner March 30, 2026 10:52
@github-actions github-actions Bot removed the risk-high Extensive testing required · High bug introduction risk label Mar 30, 2026
dan437 added 11 commits March 30, 2026 13:47
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
@dan437 dan437 force-pushed the perps-withdraw-confirmation branch from d67fbe6 to f9ec71e Compare March 30, 2026 11:47
@dan437 dan437 requested a review from a team as a code owner March 30, 2026 11:47
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeWalletPlatform, SmokeCard, SmokePerps, SmokeRamps, SmokeMultiChainAPI, SmokePredictions, FlaskBuildTests
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/transaction-pay-controller. Running all tests.

Performance Test Selection:
Hard rule (controller-version-update): @MetaMask controller package version updated in package.json: @metamask/transaction-pay-controller. Running all tests.

View GitHub Actions results

@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.

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.

@sonarqubecloud

Copy link
Copy Markdown

Comment thread .github/workflows/ci.yml
@dan437 dan437 enabled auto-merge March 30, 2026 12:33

@mathieuartu mathieuartu 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.

Owned files LGTM

@dan437 dan437 added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 61e27d0 Mar 30, 2026
63 checks passed
@dan437 dan437 deleted the perps-withdraw-confirmation branch March 30, 2026 13:29
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2026
@metamaskbot metamaskbot added the release-7.73.0 Issue or pull request that will be included in release 7.73.0 label Mar 30, 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-high Extensive testing required · High bug introduction risk size-M skip-e2e skip E2E test jobs team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants