Skip to content

chore(perps): adopt @metamask/perps-controller 19.0.0 (HyperLiquid SDK 0.33.3) - #37025

Merged
abretonc7s merged 3 commits into
mainfrom
TAT-4044-chore-perps-controller-next-preview-0210
Sep 30, 2026
Merged

abretonc7s merged 3 commits into
mainfrom
TAT-4044-chore-perps-controller-next-preview-0210

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adopts @metamask/perps-controller 19.0.0 and @nktkas/hyperliquid ^0.33.3.

19.0.0 (core Release 1303.0.0) carries HyperLiquid SDK 0.33.3 (MetaMask/core#10591: retired dexAbstraction migration removed, every HyperLiquid order status mapped explicitly, unified-account migration lock fix) plus #10464, #10414, #10559, #10588 and #10589.

Mobile adaptations for the breaking changes:

  • liquidation.liquidatedUser is optional in the local transactionHistory type, matching the controller (HyperLiquid omits it on some liquidation fills). PerpsFillTag already guarded it at runtime; two tests cover fills without it.
  • The perps integration-test harness mocks HyperLiquidWalletService with the method names chore: Create app launch times pipeline #10559 renamed (isMainAccountSignerReady, requiresSignatureConfirmation); without it 7 integration tests fail against 19.0.0.

This supersedes #36966, which backports #10559 onto 18.0.1 through a Yarn patch.

The release was first validated on device through the preview build 18.0.1-preview-2848be6, then re-validated on 19.0.0 itself (evidence below).

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-4044
Refs: MetaMask/core#10591, #36966

Manual testing steps

Recipe evidence: pass

  • Full evidence package: pr-package/evidence.md
  • Quality report: pr-package/recipe-quality.json
  • Recipe run: pr-package/runs/artifacts-recipe-run/
Feature: Perps on perps-controller 19.0.0

  Scenario: trade, manage TP/SL and read history on HyperLiquid testnet
    Given a funded HyperLiquid testnet account on Unified Account
    When the user opens BTC, places a market long, sets TP/SL, edits the TP, rests and cancels a limit order, and closes the position
    Then prices load live, TP/SL and the edit reach the venue, and Activity > Perps > Orders shows Filled/Canceled with no Queued rows

  Scenario: withdraw readiness
    Given the same account
    When the user opens Withdraw and enters $5
    Then the unified available balance, fee, time and amount received are shown and Withdraw is enabled

Validated on the iOS simulator with an automated recipe on 19.0.0 (98/98 nodes pass); see screenshots below.

Screenshots/Recordings

Recipe visual evidence
Screenshots are grouped for quick reviewer comparison.
AC1: BTC detail with live price and change
ui.screenshot screenshot
AC3: position with TP/SL set (toast + auto-close)
ui.screenshot screenshot
AC4: Perps order history, Filled/Canceled, no Queued
ui.screenshot screenshot
AC5: withdraw ready with unified balance and fees
ui.screenshot screenshot

Before

N/A: dependency upgrade with no intended UI change; the same screens on main use 18.0.1.

After

Recipe evidence below (iOS simulator, HyperLiquid testnet, perps-controller 19.0.0, 98/98 nodes).

Recipe evidence

Recipe visual evidence
Use concise captions; edit into a clearer before/after table when that helps review.
AC1: BTC detail with live price and change

pr-package/images/01-ui-screenshot-screenshot.png
AC3: position with TP/SL set (toast + auto-close)

pr-package/images/02-ui-screenshot-screenshot.png
AC4: Perps order history, Filled/Canceled, no Queued

pr-package/images/03-ui-screenshot-screenshot.png
AC5: withdraw ready with unified balance and fees

pr-package/images/04-ui-screenshot-screenshot.png

Recipe artifact package

Task path: /Users/deeeed/dev/metamask/metamask-mobile-4/temp/tasks/recipe-cook/20260930T021012Z-perps-controller-next-preview
PR package: /Users/deeeed/dev/metamask/metamask-mobile-4/temp/tasks/recipe-cook/20260930T021012Z-perps-controller-next-preview/pr-package

  • Full evidence: pr-package/evidence.md
  • Quality report: pr-package/recipe-quality.json
  • Image files: pr-package/images/
  • Checklist: pr-package/checklist.md
  • Recipe run: pr-package/runs/artifacts-recipe-run/

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.

- Consume @metamask-previews/perps-controller 18.0.1-preview-2848be6 (core #10591) through previewBuilds
- Bump @nktkas/hyperliquid to ^0.33.3
- Make liquidation.liquidatedUser optional to match the controller
- Use the #10559 wallet-service method names in the perps integration harness
@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.

@metamask-ci metamask-ci Bot added the team-perps Perps team label Sep 30, 2026
@metamask-ci

metamask-ci Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@socket-security

socket-security Bot commented Sep 30, 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/​@​nktkas/​hyperliquid@​0.33.1 ⏵ 0.33.3100 +110010095 +1100
Updatednpm/​@​metamask/​perps-controller@​18.0.1 ⏵ 19.0.099 +1100100 +7100 +1100

View full report

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: ALL

Selected Performance tags: @PerformancePreps

AI Confidence: 100

E2E reasoning

Expand to read

The PR makes the following changes:

  1. @metamask/perps-controller major version bump (^18.0.1 → ^19.0.0): This is the primary risk driver. A major version bump to a controller package can introduce breaking API changes, as evidenced by the integration harness update that renames isKeyringUnlocked → isMainAccountSignerReady and isSelectedHardwareWallet → requiresSignatureConfirmation. The hard rule seed mandates ALL tags for controller version updates.

  2. liquidatedUser made optional in PerpsTransaction interface: Bug fix for HyperLiquid API behavior where this field is sometimes omitted. This is a type-level change that affects how liquidation fills are processed and displayed.

  3. New unit tests added: Tests for the optional liquidatedUser case in both PerpsFillTag and transactionTransforms — these are additive and don't change existing behavior.

  4. Integration harness updated: Mock method names updated to match the new perps-controller v19 API (isMainAccountSignerReady, requiresSignatureConfirmation).

  5. @nktkas/hyperliquid patch bump (^0.33.1 → ^0.33.3): Minor patch update to the HyperLiquid client library, likely related to the liquidatedUser optional field fix.

Directly impacted flows: SmokePerps (perps trading, Add Funds, balance verification), SmokeWalletPlatform (Trending tab where Perps is embedded), SmokeConfirmations (Add Funds deposits are on-chain transactions).

Why ALL: The hard rule seed mandates ALL due to the controller package version update. The major version bump to perps-controller (v18→v19) with API renames in the integration harness confirms this is a meaningful breaking change that warrants broad test coverage to ensure no regressions in adjacent flows. While the blast radius appears focused on Perps, the controller update could have indirect effects on wallet state management.

Performance reasoning

Expand to read

The @metamask/perps-controller major version bump (v18→v19) changes the HyperLiquidWalletService API (isKeyringUnlocked→isMainAccountSignerReady, isSelectedHardwareWallet→requiresSignatureConfirmation). These are core service methods used in the perps flow including market loading, position management, and the Add Funds flow. The @PerformancePreps tag covers perps market loading, position management, add funds flow, and order execution — all of which could be affected by the controller API changes. The liquidatedUser optional field change could also affect transaction history rendering performance in the perps activity list.

View run

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.49%. Comparing base (51bfc79) to head (c8dbdee).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #37025      +/-   ##
==========================================
- Coverage   86.49%   86.49%   -0.01%     
==========================================
  Files        7338     7340       +2     
  Lines      208093   208113      +20     
  Branches    51575    51574       -1     
==========================================
+ Hits       179993   180009      +16     
- Misses      16761    16762       +1     
- Partials    11339    11342       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 30, 2026
…k#10591)

## Explanation

Bumps `@nktkas/hyperliquid` from `^0.33.1` to `^0.33.3` in
`@metamask/perps-controller`
([v0.33.2](https://github.com/nktkas/hyperliquid/releases/tag/v0.33.2),
[v0.33.3](https://github.com/nktkas/hyperliquid/releases/tag/v0.33.3)).

- **Yarn patch dropped.** The patch (MetaMask#9471) stripped `/// <amd-module
name="file:///home/runner/...">` directives from the SDK's `.d.ts`
files. `0.33.3` no longer ships them, so the patch and its root
`resolutions` entry are gone. The built `dist` has no `file:///`
references.
- **`dexAbstraction` migration removed.** `0.33.2` dropped
`dexAbstraction` from `userAbstraction` / `userSetAbstraction` to match
the API: HyperLiquid retired the mode (the live `userAbstraction`
endpoint now returns `"default"` for the SDK's former `dexAbstraction`
fixture users). The `userSetAbstraction` main-wallet migration and its
"don't re-prompt after a rejection" cache were dead, so they are
removed. `default` / `disabled` accounts still migrate through
`agentSetAbstraction`, and deferral with `allowUserSigning: false` is
unchanged. An unexpected `dexAbstraction` response now takes the
existing unknown-mode bail.
- **New order types.** `FrontendOrder.orderType` adds `Twap Slice`,
`Vault Close` and `Spot Dust Conversion`. They are mapped explicitly to
`'market'` in historical orders, which is what the fallback already
returned.
- **Type-only breaks:** `OrderFill.liquidation.liquidatedUser` is now
optional (HyperLiquid omits it on some liquidation fills), and the
re-exported `FrontendOrder.orderType` union gains the three values
above. Mobile (`PerpsFillTag`) and Extension (`perps-fill-tag`) already
guard `liquidatedUser` at runtime; their local `transactionHistory`
types declare it as `string` and may need `?` when adopting this
release.
- **Historical order statuses.** Every `OrderProcessingStatus` from the
SDK now maps explicitly (exhaustive `satisfies` map): the specific
`*Rejected` statuses report `rejected` and `outcomeSettledCanceled` /
`internalCancel` report `canceled`, where they previously fell through
to `queued`.
- **Unified-account migration lock.** Waiters re-check the in-flight
lock after each wait (same pattern as the referral lock), so an attempt
that ends without caching a result (e.g. deferred at init for a hardware
wallet) no longer lets every waiter run `agentSetAbstraction`
concurrently.

## References

- Fixes
[TAT-4044](https://consensyssoftware.atlassian.net/browse/TAT-4044)
- Mobile validation (draft, preview build `18.0.1-preview-2848be6`,
device recipe evidence):
MetaMask/metamask-mobile#37025
- Upstream schema change: nktkas/hyperliquid#167

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them


[TAT-4044]:
https://consensyssoftware.atlassian.net/browse/TAT-4044?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Replace the preview build with the released 19.0.0.
@abretonc7s abretonc7s changed the title chore(perps): validate next perps-controller (HyperLiquid SDK 0.33.3) via preview build chore(perps): adopt @metamask/perps-controller 19.0.0 (HyperLiquid SDK 0.33.3) Sep 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

❌ 1 test failed · 2 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

❌ Failed Tests (1)

🔬 App profiling vs main is included under each failed scenario that has a prior baseline.

@mm-perps-engineering-team

Perps open position and close it

Platform Device Reason Recording
Android Google Pixel 8 Pro (v14.0) no_performance_metrics 📹 Watch

🔬 App profiling check · Current run 36692716471 · Baseline (last green on main) run 33753179927 @ e869913

Summary: ⚠️ 3 metrics over +10%: Slow frames (+14.35 (+128.2%)), Issues (+1 (+50%)), App size (+59.08 (+17%))

ℹ️ API calls unavailable: Network logs API error: Bad Request

Full metric table (+10% variance rules)

Disclaimer — allowed variance: a +10% margin over the baseline is permitted.

  • If Current <= Baseline + 10%, treated as acceptable noise.
  • If Current > Baseline + 10%, Current and variance % are highlighted with ⚠️.
Metric Baseline Current Δ
CPU avg 9.62% 7.55% -2.07 (-21.5%)
CPU max 25.7% 23.83% -1.87 (-7.3%)
Memory avg 857.09 MB 809.72 MB -47.37 (-5.5%)
Memory max 1065.02 MB 1035.83 MB -29.19 (-2.7%)
Slow frames 11.19% 25.54% +14.35 (+128.2%) ⚠️
Frozen frames 0% 0% 0 (0%)
ANRs 0 0 0 (0%)
Issues 2 3 +1 (+50%) ⚠️
Critical issues 2 2 0 (0%)
App size 346.62 MB 405.7 MB +59.08 (+17%) ⚠️
✅ Passed Tests (1)
Test Platform Device Duration Team Recording
Perps add funds Android Google Pixel 8 Pro (v14.0) 6.59s @mm-perps-engineering-team 📹 Watch

Branch: TAT-4044-chore-perps-controller-next-preview-0210 · Build: E2E · Commit: b5597bc · View full run

@abretonc7s
abretonc7s marked this pull request as ready for review September 30, 2026 09:36
@abretonc7s
abretonc7s requested a review from a team as a code owner September 30, 2026 09:36
@github-actions github-actions Bot added the risk:high AI analysis: high risk label Sep 30, 2026
@abretonc7s
abretonc7s added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit a334564 Sep 30, 2026
120 of 122 checks passed
@abretonc7s
abretonc7s deleted the TAT-4044-chore-perps-controller-next-preview-0210 branch September 30, 2026 14:31
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 30, 2026
@metamask-ci metamask-ci Bot added the release-8.15.0 Issue or pull request that will be included in release 8.15.0 label Sep 30, 2026

This branch was successfully deployed

1 active deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.15.0 Issue or pull request that will be included in release 8.15.0 risk:high AI analysis: high risk size-S team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants