You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(perps): sync perps controller may 21 2026 (final) (#8871)
## Explanation
Final source sync of the perps controller from mobile
(`app/controllers/perps/`) into `packages/perps-controller/src/`. After
this PR merges, mobile drops its in-repo controller copy and depends on
`@metamask/perps-controller` from this repo directly. The core package
becomes the source of truth.
Mobile changes carried over since the previous sync (mobile commit
`35953448`):
- `feat(perps)`: add slippage controls for market orders (mobile #30125)
- `feat(perps)`: track `vip_tier` / `vip_discount` properties on trading
events (mobile #30385)
- `feat(perps)`: in-app banner during an ongoing HyperLiquid outage
(mobile #30081)
- `fix`: prefer the selected EVM account when resolving the trading
account (mobile #30253)
- `fix(perps)`: suppress `User or API Wallet does not exist` Sentry
noise from unfunded wallets (mobile #29972)
- `fix(perps)`: approve the HyperLiquid builder fee when missing (mobile
#30095)
Validation:
- `scripts/perps/validate-core-sync.sh` driven from mobile (rsync,
ESLint --fix + suppress, oxfmt, build, lint, tests, changelog,
sync-state).
- `yarn build` at core root produces
`packages/perps-controller/dist/PerpsController.{mjs,cjs}` with the
`webpackIgnore: true` safeguard intact for the MYX entry that extension
consumers exclude via `package.json` `files`.
## References
- Mobile follow-up PR (controller removal): coming next on
`TAT-3187-perps-controller-removal`.
## 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
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes touch order pricing/slippage handling and HyperLiquid
trading-readiness flows (migration, builder-fee approval, referral),
which can affect order submission behavior and analytics; most changes
are additive with guards and fallbacks.
>
> **Overview**
> Adds a persisted, user-configurable **max slippage** preference
(`maxSlippageBps`) exposed via new controller actions
(`getMaxSlippage`/`setMaxSlippage`), shared bounds
(`MAX_SLIPPAGE_BOUNDS`), and order-price calculations updated to use bps
(with a temporary deprecated decimal `slippage` fallback).
>
> Improves account resolution by preferring
`AccountsController:getSelectedAccount` (and subscribing to
`AccountsController:selectedAccountChange`) so perps state/cache and
signing always follow the actively selected EVM account.
>
> Hardens HyperLiquid setup to reduce noise and unblock trading:
introduces a session cache/probe for whether a wallet is registered on
HyperLiquid and skips/refuses to Sentry-log the benign "User or API
Wallet does not exist" case; builder-fee approval is now retried after
prior failures; trading analytics gains `vip_tier`/`vip_discount`
properties (including flip-position tracking) plus new event constants
(slippage/outage/status).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
558a874. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: packages/perps-controller/CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
12
+
- Add slippage controls so users can configure per-order slippage tolerance for market trades ([#8871](https://github.com/MetaMask/core/pull/8871))
13
+
- Track `vip_tier` and `vip_discount` properties on perps trading events for fee analytics ([#8871](https://github.com/MetaMask/core/pull/8871))
14
+
- Surface an in-app banner during an ongoing HyperLiquid outage so users see degraded trading status ([#8871](https://github.com/MetaMask/core/pull/8871))
15
+
16
+
### Fixed
17
+
18
+
- Prefer the currently selected EVM account when resolving the trading account so account switching is honored across providers ([#8871](https://github.com/MetaMask/core/pull/8871))
19
+
- Suppress `User or API Wallet does not exist` Sentry noise from unfunded wallets that have not interacted with HyperLiquid ([#8871](https://github.com/MetaMask/core/pull/8871))
20
+
- Approve the HyperLiquid builder fee when missing so order submission succeeds after fresh wallet setup ([#8871](https://github.com/MetaMask/core/pull/8871))
0 commit comments