@metamask-previews/perps-controller 9.0.0-preview-43e6d6596 → 9.0.0-preview-d7951629b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/providers/HyperLiquidProvider.cjs +1 -2
  3. package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
  4. package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
  5. package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
  6. package/dist/providers/HyperLiquidProvider.mjs +1 -2
  7. package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
  8. package/dist/services/HyperLiquidClientService.cjs +5 -8
  9. package/dist/services/HyperLiquidClientService.cjs.map +1 -1
  10. package/dist/services/HyperLiquidClientService.d.cts.map +1 -1
  11. package/dist/services/HyperLiquidClientService.d.mts.map +1 -1
  12. package/dist/services/HyperLiquidClientService.mjs +4 -7
  13. package/dist/services/HyperLiquidClientService.mjs.map +1 -1
  14. package/dist/services/HyperLiquidSubscriptionService.cjs +101 -33
  15. package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -1
  16. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -1
  17. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -1
  18. package/dist/services/HyperLiquidSubscriptionService.mjs +101 -33
  19. package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -1
  20. package/dist/types/index.cjs.map +1 -1
  21. package/dist/types/index.d.cts +7 -0
  22. package/dist/types/index.d.cts.map +1 -1
  23. package/dist/types/index.d.mts +7 -0
  24. package/dist/types/index.d.mts.map +1 -1
  25. package/dist/types/index.mjs.map +1 -1
  26. package/dist/utils/hyperLiquidAdapter.cjs +1 -2
  27. package/dist/utils/hyperLiquidAdapter.cjs.map +1 -1
  28. package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -1
  29. package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -1
  30. package/dist/utils/hyperLiquidAdapter.mjs +1 -2
  31. package/dist/utils/hyperLiquidAdapter.mjs.map +1 -1
  32. package/dist/utils/standaloneInfoClient.cjs +1 -1
  33. package/dist/utils/standaloneInfoClient.cjs.map +1 -1
  34. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -13,6 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
  - New `PERPS_EVENT_PROPERTY` keys: `CHART_LIBRARY`, `ASSET_TYPE`
14
14
  - New `PERPS_EVENT_VALUE.CHART_LIBRARY` group: `lightweight`, `advanced`
15
15
  - New `PERPS_EVENT_VALUE.ASSET_TYPE` group: `spot`, `perp`
16
+ - Add `fast?: boolean` to `SubscribeOrderBookParams` ([#9160](https://github.com/MetaMask/core/pull/9160)): when set to `true`, the order book subscription uses Hyperliquid's fast l2Book mode (5 levels @ ~0.5 s cadence) instead of the default (20 levels @ ~2 s)
17
+ - No change to `#processOrderBookData` or cumulative-total math; callers opting into `fast: true` receive up to 5 levels per side instead of 20.
18
+
19
+ ### Changed
20
+
21
+ - On `subscribeToPrices` calls with `includeMarketData: true` (focused detail/ticket screens), the `price` field in each `PriceUpdate` is now driven by the per-symbol `activeAssetCtx` WebSocket stream (`midPx`, falling back to `markPx`) rather than the main-DEX `allMids` snapshot, which Hyperliquid throttles to a ~5 s push cadence ([#9160](https://github.com/MetaMask/core/pull/9160))
22
+ - Price source selection is **per-subscriber**: focused (`includeMarketData: true`) callbacks receive the fast-stream price; list/overview (`includeMarketData: false`) callbacks always receive the raw `allMids` baseline, even when both subscriber types share the same symbol.
23
+ - The fast-stream price is preferred only while it is fresh (within a 10 s staleness window); `allMids` takes back over automatically once the `activeAssetCtx` stream goes quiet.
24
+ - A startup guard prevents any `'0'` price from being emitted: if `activeAssetCtx` fires before `allMids` with no `midPx`/`markPx`, no notification is sent until a usable price arrives from either source.
25
+ - No new WebSocket subscriptions are created; `activeAssetCtx` was already established for `includeMarketData: true` subscriptions.
26
+ - Bump `@nktkas/hyperliquid` from `^0.32.2` to `^0.33.1` ([#9160](https://github.com/MetaMask/core/pull/9160)): adds support for the `fast` field on `l2Book` subscriptions
16
27
 
17
28
  ## [9.0.0]
18
29
 
@@ -1433,8 +1433,7 @@ class HyperLiquidProvider {
1433
1433
  parentOid: parentOrder.oid,
1434
1434
  childrenCount: parentOrder.children.length,
1435
1435
  });
1436
- parentOrder.children.forEach((childOrderUnknown) => {
1437
- const childOrder = childOrderUnknown;
1436
+ parentOrder.children.forEach((childOrder) => {
1438
1437
  if (childOrder.isTrigger && childOrder.reduceOnly) {
1439
1438
  if (childOrder.orderType === 'Take Profit Market' ||
1440
1439
  childOrder.orderType === 'Take Profit Limit') {