feat(transaction-pay-controller): add HyperLiquid withdrawal submission via Relay#8314
Merged
feat(transaction-pay-controller): add HyperLiquid withdrawal submission via Relay#8314
Conversation
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Outdated
Show resolved
Hide resolved
f632486 to
8419a95
Compare
matthewwalsh0
approved these changes
Mar 27, 2026
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Show resolved
Hide resolved
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Outdated
Show resolved
Hide resolved
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Show resolved
Hide resolved
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Show resolved
Hide resolved
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Show resolved
Hide resolved
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Outdated
Show resolved
Hide resolved
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Outdated
Show resolved
Hide resolved
matthewwalsh0
requested changes
Mar 27, 2026
5ecfe7b to
aac2a19
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
packages/transaction-pay-controller/src/strategy/relay/hyperliquid-withdraw.ts
Outdated
Show resolved
Hide resolved
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>
aac2a19 to
3240f3d
Compare
matthewwalsh0
approved these changes
Mar 27, 2026
|
|
||
| ### Added | ||
|
|
||
| - **BREAKING:** Add `KeyringControllerSignTypedMessageAction` to `AllowedActions` for HyperLiquid EIP-712 signing ([#8314](https://github.com/MetaMask/core/pull/8314)) |
Member
There was a problem hiding this comment.
Minor, this could go under the other new option.
7 tasks
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Mar 30, 2026
…ig (#28046) ## **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 - [feat(transaction-pay-controller): add HyperLiquid withdrawal submission via Relay](MetaMask/core#8314) ## **Changelog** CHANGELOG entry: Add Perps Withdraw confirmation flow ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1115 ## **Manual testing steps** ~~~gherkin 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** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!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). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f9ec71e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: dan437 <80175477+dan437@users.noreply.github.com>
7 tasks
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Apr 1, 2026
…ig (#28236) ## **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 - [feat(transaction-pay-controller): add HyperLiquid withdrawal submission via Relay](MetaMask/core#8314) ## **Changelog** CHANGELOG entry: Add Perps Withdraw confirmation flow ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1115 ## **Manual testing steps** ~~~gherkin 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** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!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. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8fdd9cb. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
The quote support for Perps Withdraw was added in #8285. This PR completes the feature by adding the submission flow — the 2-step gasless withdrawal from HyperLiquid via Relay.
When
isHyperliquidSourceis set on the transaction config,executeSingleQuotenow routes tosubmitHyperliquidWithdrawinstead ofsubmitTransactions. This function executes two EIP-712 signing steps:/authorizeendpoint, linking the HyperLiquid withdrawal to the Relay order.sendAssetaction and POSTs it to the HyperLiquid exchange API, instructing HL to transfer funds to the Relay solver.After both steps complete, the existing
waitForRelayCompletionpolling takes over to track the cross-chain fill on the destination chain.Key changes
hyperliquid-withdraw.ts— implementssubmitHyperliquidWithdrawwith the 2-step authorize + deposit flow, EIP-712 domain derivation, and signaturer/s/vparsing for the HyperLiquid exchange API format.relay-submit.ts— routes tosubmitHyperliquidWithdrawwhenisHyperliquidSourceis true; no changes towaitForRelayCompletionor existing submission logic.types.ts— addsKeyringControllerSignTypedMessageActiontoAllowedActions(required for silent EIP-712 signing via the keyring controller messenger).constants.ts— addsRELAY_AUTHORIZE_URLandHYPERLIQUID_EXCHANGE_URLendpoints.References
Checklist
Note
High Risk
Adds a new HyperLiquid withdrawal submission path that performs silent EIP-712 signing and posts signatures to external Relay/HyperLiquid endpoints, plus a breaking messenger permission expansion. Incorrect step parsing/signature construction or permission wiring could cause failed withdrawals or unintended signing behavior.
Overview
Adds a new HyperLiquid withdrawal submission flow for the Relay strategy: when
quote.request.isHyperliquidSourceis set,relay-submitskips on-chainTransactionControllersubmissions and instead runs a two-stepsubmitHyperliquidWithdrawflow (Relay/authorizeEIP-712 signature, then HyperLiquid exchangesendAssetEIP-712 signature +r/s/vPOST), before continuing with the existing Relay status polling.Introduces new endpoints (
RELAY_AUTHORIZE_URL,HYPERLIQUID_EXCHANGE_URL), adds comprehensive unit tests for the new withdraw module and the new routing branch, and expandsAllowedActionswithKeyringControllerSignTypedMessageAction(breaking) so clients must grantKeyringController:signTypedMessagewhen constructing the controller messenger.Written by Cursor Bugbot for commit 3240f3d. This will update automatically on new commits. Configure here.