@metamask-previews/perps-controller 10.0.0-preview-a42e8d0d2 → 10.0.0-preview-d2f661012
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.
- package/CHANGELOG.md +15 -0
- package/dist/providers/HyperLiquidProvider.cjs +219 -30
- package/dist/providers/HyperLiquidProvider.cjs.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.cts.map +1 -1
- package/dist/providers/HyperLiquidProvider.d.mts.map +1 -1
- package/dist/providers/HyperLiquidProvider.mjs +220 -31
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.cjs +23 -0
- package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.cts +21 -0
- package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.mts +21 -0
- package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.mjs +23 -0
- package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +18 -2
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +18 -2
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/orderCalculations.cjs +126 -21
- package/dist/utils/orderCalculations.cjs.map +1 -1
- package/dist/utils/orderCalculations.d.cts +24 -0
- package/dist/utils/orderCalculations.d.cts.map +1 -1
- package/dist/utils/orderCalculations.d.mts +24 -0
- package/dist/utils/orderCalculations.d.mts.map +1 -1
- package/dist/utils/orderCalculations.mjs +124 -20
- package/dist/utils/orderCalculations.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -604,6 +604,29 @@ class HyperLiquidSubscriptionService {
|
|
|
604
604
|
isPositionsCacheInitialized() {
|
|
605
605
|
return __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_positionsCacheInitialized, "f");
|
|
606
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* Get the cached positions for one DEX, or null when that DEX has published
|
|
609
|
+
* none this session.
|
|
610
|
+
*
|
|
611
|
+
* A DEX only enters this map once its `clearinghouseState` subscription has
|
|
612
|
+
* published, so `null` means the absence of a symbol proves nothing about
|
|
613
|
+
* whether a position exists there.
|
|
614
|
+
*
|
|
615
|
+
* Prefer this over `getCachedPositions()` when a decision depends on whether a
|
|
616
|
+
* specific symbol is absent. The aggregate is only rebuilt once *every*
|
|
617
|
+
* expected DEX has published (`#aggregateAndNotifySubscribers`), so after a
|
|
618
|
+
* reconnect — which resets `#initializedDexs` without clearing these caches —
|
|
619
|
+
* the aggregate can sit frozen at its pre-reconnect contents while this map
|
|
620
|
+
* keeps receiving per-DEX updates. Deciding "covered" from this map and then
|
|
621
|
+
* reading the symbol from the aggregate would mix a fresh answer with stale
|
|
622
|
+
* data.
|
|
623
|
+
*
|
|
624
|
+
* @param dexName - DEX identifier, or '' for the main DEX.
|
|
625
|
+
* @returns That DEX's cached positions, or null if it has not published.
|
|
626
|
+
*/
|
|
627
|
+
getCachedPositionsForDex(dexName) {
|
|
628
|
+
return __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_dexPositionsCache, "f").get(dexName) ?? null;
|
|
629
|
+
}
|
|
607
630
|
/**
|
|
608
631
|
* Get cached positions from WebSocket subscription
|
|
609
632
|
*
|