@metamask-previews/perps-controller 9.0.0-preview-e12e4a38f → 9.0.0-preview-0b8cac1b5
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 +0 -11
- package/dist/providers/HyperLiquidProvider.cjs +2 -1
- 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 +2 -1
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
- package/dist/services/HyperLiquidClientService.cjs +8 -5
- package/dist/services/HyperLiquidClientService.cjs.map +1 -1
- package/dist/services/HyperLiquidClientService.d.cts.map +1 -1
- package/dist/services/HyperLiquidClientService.d.mts.map +1 -1
- package/dist/services/HyperLiquidClientService.mjs +7 -4
- package/dist/services/HyperLiquidClientService.mjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.cjs +33 -101
- package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.mjs +33 -101
- package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +0 -7
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +0 -7
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/hyperLiquidAdapter.cjs +2 -1
- package/dist/utils/hyperLiquidAdapter.cjs.map +1 -1
- package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -1
- package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -1
- package/dist/utils/hyperLiquidAdapter.mjs +2 -1
- package/dist/utils/hyperLiquidAdapter.mjs.map +1 -1
- package/dist/utils/standaloneInfoClient.cjs +1 -1
- package/dist/utils/standaloneInfoClient.cjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperLiquidSubscriptionService.d.cts","sourceRoot":"","sources":["../../src/services/HyperLiquidSubscriptionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EASV,gBAAgB,EAKjB,4BAA4B;AAS7B,OAAO,KAAK,EAEV,QAAQ,EACR,SAAS,EACT,KAAK,EAEL,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EAGxB,yBAAyB,EAE1B,2BAAiB;AAClB,OAAO,KAAK,EAEV,0BAA0B,EAE3B,uCAAmC;AAmBpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;GAGG;AACH,qBAAa,8BAA8B;;
|
|
1
|
+
{"version":3,"file":"HyperLiquidSubscriptionService.d.cts","sourceRoot":"","sources":["../../src/services/HyperLiquidSubscriptionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EASV,gBAAgB,EAKjB,4BAA4B;AAS7B,OAAO,KAAK,EAEV,QAAQ,EACR,SAAS,EACT,KAAK,EAEL,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EAGxB,yBAAyB,EAE1B,2BAAiB;AAClB,OAAO,KAAK,EAEV,0BAA0B,EAE3B,uCAAmC;AAmBpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;GAGG;AACH,qBAAa,8BAA8B;;gBA+PvC,aAAa,EAAE,wBAAwB,EACvC,aAAa,EAAE,wBAAwB,EACvC,oBAAoB,EAAE,yBAAyB,EAC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BAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EAGxB,yBAAyB,EAE1B,2BAAiB;AAClB,OAAO,KAAK,EAEV,0BAA0B,EAE3B,uCAAmC;AAmBpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;GAGG;AACH,qBAAa,8BAA8B;;
|
|
1
|
+
{"version":3,"file":"HyperLiquidSubscriptionService.d.mts","sourceRoot":"","sources":["../../src/services/HyperLiquidSubscriptionService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EASV,gBAAgB,EAKjB,4BAA4B;AAS7B,OAAO,KAAK,EAEV,QAAQ,EACR,SAAS,EACT,KAAK,EAEL,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EAGxB,yBAAyB,EAE1B,2BAAiB;AAClB,OAAO,KAAK,EAEV,0BAA0B,EAE3B,uCAAmC;AAmBpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAC3E,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;GAGG;AACH,qBAAa,8BAA8B;;gBA+PvC,aAAa,EAAE,wBAAwB,EACvC,aAAa,EAAE,wBAAwB,EACvC,oBAAoB,EAAE,yBAAyB,EAC/C,WAAW,CAAC,EAAE,OAAO,EACrB,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAC3B,mBAAmB,CAAC,EAAE,MAAM;IA+K9B;;;;;;;;OAQG;IACI,eAAe,CACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;QACJ,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,UAAU,EAAE,MAAM,CAAC;YACnB,WAAW,EAAE,MAAM,CA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IACI,eAAe,IAAI,KAAK,EAAE,GAAG,IAAI;IAIxC;;;;;OAKG;IACI,2BAA2B,IAAI,KAAK,EAAE,GAAG,IAAI;IAOpD;;;;;;OAMG;IACI,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIlD,sBAAsB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAS1E;;;;;OAKG;IACI,cAAc,IAAI,SAAS,EAAE,GAAG,IAAI;IAI3C;;;;;;;;OAQG;IACI,0BAA0B,IAAI,SAAS,EAAE,GAAG,IAAI;IA40BvD;;;;;;;OAOG;IACI,oBAAoB,CAAC,MAAM,EAAE,wBAAwB,GAAG,MAAM,IAAI;IAmNzE;;;;;;OAMG;IACU,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsMlD;;OAEG;IACI,QAAQ,IAAI,IAAI;CAiMxB"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _HyperLiquidSubscriptionService_instances,
|
|
12
|
+
var _HyperLiquidSubscriptionService_instances, _HyperLiquidSubscriptionService_clientService, _HyperLiquidSubscriptionService_walletService, _HyperLiquidSubscriptionService_hip3Enabled, _HyperLiquidSubscriptionService_enabledDexs, _HyperLiquidSubscriptionService_allowlistMarkets, _HyperLiquidSubscriptionService_blocklistMarkets, _HyperLiquidSubscriptionService_priceDeviationLimit, _HyperLiquidSubscriptionService_discoveredDexNames, _HyperLiquidSubscriptionService_dexDiscoveryPromise, _HyperLiquidSubscriptionService_dexDiscoveryResolver, _HyperLiquidSubscriptionService_expectedDexs, _HyperLiquidSubscriptionService_initializedDexs, _HyperLiquidSubscriptionService_priceSubscribers, _HyperLiquidSubscriptionService_positionSubscribers, _HyperLiquidSubscriptionService_orderFillSubscribers, _HyperLiquidSubscriptionService_orderSubscribers, _HyperLiquidSubscriptionService_accountSubscribers, _HyperLiquidSubscriptionService_marketDataSubscribers, _HyperLiquidSubscriptionService_orderBookSubscribers, _HyperLiquidSubscriptionService_globalAllMidsSubscription, _HyperLiquidSubscriptionService_globalAllMidsPromise, _HyperLiquidSubscriptionService_globalActiveAssetSubscriptions, _HyperLiquidSubscriptionService_pendingActiveAssetPromises, _HyperLiquidSubscriptionService_globalBboSubscriptions, _HyperLiquidSubscriptionService_pendingBboPromises, _HyperLiquidSubscriptionService_orderFillSubscriptions, _HyperLiquidSubscriptionService_spotStateSubscriptions, _HyperLiquidSubscriptionService_spotStateSubscriptionPromises, _HyperLiquidSubscriptionService_spotStateSubscriptionGeneration, _HyperLiquidSubscriptionService_symbolSubscriberCounts, _HyperLiquidSubscriptionService_dexSubscriberCounts, _HyperLiquidSubscriptionService_webData3Subscriptions, _HyperLiquidSubscriptionService_webData3SubscriptionPromise, _HyperLiquidSubscriptionService_positionSubscriberCount, _HyperLiquidSubscriptionService_orderSubscriberCount, _HyperLiquidSubscriptionService_accountSubscriberCount, _HyperLiquidSubscriptionService_oiCapSubscriberCount, _HyperLiquidSubscriptionService_dexPositionsCache, _HyperLiquidSubscriptionService_dexOrdersCache, _HyperLiquidSubscriptionService_dexAccountCache, _HyperLiquidSubscriptionService_cachedSpotState, _HyperLiquidSubscriptionService_abstractionModeByUser, _HyperLiquidSubscriptionService_abstractionModeLastWsRefreshAtByUser, _HyperLiquidSubscriptionService_abstractionModeInflightByUser, _HyperLiquidSubscriptionService_cachedSpotStateUserAddress, _HyperLiquidSubscriptionService_spotStatePromise, _HyperLiquidSubscriptionService_spotStatePromiseUserAddress, _HyperLiquidSubscriptionService_spotStateGeneration, _HyperLiquidSubscriptionService_cachedPositions, _HyperLiquidSubscriptionService_cachedOrders, _HyperLiquidSubscriptionService_cachedAccount, _HyperLiquidSubscriptionService_ordersCacheInitialized, _HyperLiquidSubscriptionService_positionsCacheInitialized, _HyperLiquidSubscriptionService_oiCapSubscribers, _HyperLiquidSubscriptionService_cachedOICaps, _HyperLiquidSubscriptionService_cachedOICapsHash, _HyperLiquidSubscriptionService_oiCapsCacheInitialized, _HyperLiquidSubscriptionService_cachedPriceData, _HyperLiquidSubscriptionService_allMidsSnapshots, _HyperLiquidSubscriptionService_cachedFills, _HyperLiquidSubscriptionService_fillsCacheInitialized, _HyperLiquidSubscriptionService_assetCtxsSubscriptions, _HyperLiquidSubscriptionService_dexAssetCtxsCache, _HyperLiquidSubscriptionService_assetCtxsSubscriptionPromises, _HyperLiquidSubscriptionService_dexAllMidsSubscriptions, _HyperLiquidSubscriptionService_dexAllMidsSubscriptionPromises, _HyperLiquidSubscriptionService_clearinghouseStateSubscriptions, _HyperLiquidSubscriptionService_openOrdersSubscriptions, _HyperLiquidSubscriptionService_pendingClearinghouseSubscriptions, _HyperLiquidSubscriptionService_pendingOpenOrdersSubscriptions, _HyperLiquidSubscriptionService_dexMetaCache, _HyperLiquidSubscriptionService_orderBookCache, _HyperLiquidSubscriptionService_marketDataCache, _HyperLiquidSubscriptionService_isClearing, _HyperLiquidSubscriptionService_restoreRetryTimeouts, _HyperLiquidSubscriptionService_deps, _HyperLiquidSubscriptionService_logErrorUnlessClearing, _HyperLiquidSubscriptionService_isTransientSdkError, _HyperLiquidSubscriptionService_scheduleRestoreRetry, _HyperLiquidSubscriptionService_getErrorContext, _HyperLiquidSubscriptionService_isDexEnabled, _HyperLiquidSubscriptionService_waitForDexDiscovery, _HyperLiquidSubscriptionService_hashPositions, _HyperLiquidSubscriptionService_hashOrders, _HyperLiquidSubscriptionService_hashAccountState, _HyperLiquidSubscriptionService_cachedPositionsHash, _HyperLiquidSubscriptionService_cachedOrdersHash, _HyperLiquidSubscriptionService_cachedAccountHash, _HyperLiquidSubscriptionService_extractTPSLFromOrders, _HyperLiquidSubscriptionService_mergeTPSLIntoPositions, _HyperLiquidSubscriptionService_aggregateAccountStates, _HyperLiquidSubscriptionService_getAbstractionModeForUser, _HyperLiquidSubscriptionService_getSpotBalanceOptions, _HyperLiquidSubscriptionService_refreshAbstractionModeThrottled, _HyperLiquidSubscriptionService_ensureSpotState, _HyperLiquidSubscriptionService_refreshSpotState, _HyperLiquidSubscriptionService_ensureSpotStateSubscription, _HyperLiquidSubscriptionService_ensureSharedWebData3Subscription, _HyperLiquidSubscriptionService_createUserDataSubscription, _HyperLiquidSubscriptionService_ensureClearinghouseStateSubscription, _HyperLiquidSubscriptionService_createClearinghouseSubscription, _HyperLiquidSubscriptionService_ensureOpenOrdersSubscription, _HyperLiquidSubscriptionService_createOpenOrdersSubscription, _HyperLiquidSubscriptionService_aggregateAndNotifySubscribers, _HyperLiquidSubscriptionService_cleanupSharedWebData3ISubscription, _HyperLiquidSubscriptionService_ensureOrderFillISubscription, _HyperLiquidSubscriptionService_createSubscription, _HyperLiquidSubscriptionService_createPriceUpdate, _HyperLiquidSubscriptionService_ensureGlobalAllMidsSubscription, _HyperLiquidSubscriptionService_ensureActiveAssetSubscription, _HyperLiquidSubscriptionService_cleanupActiveAssetSubscription, _HyperLiquidSubscriptionService_ensureAssetCtxsSubscription, _HyperLiquidSubscriptionService_ensureDexAllMidsSubscription, _HyperLiquidSubscriptionService_createDexAllMidsSubscription, _HyperLiquidSubscriptionService_createAssetCtxsSubscription, _HyperLiquidSubscriptionService_cleanupAssetCtxsSubscription, _HyperLiquidSubscriptionService_ensureBboSubscription, _HyperLiquidSubscriptionService_cleanupBboSubscription, _HyperLiquidSubscriptionService_processOrderBookData, _HyperLiquidSubscriptionService_notifyAllPriceSubscribers;
|
|
13
13
|
import { hasProperty } from "@metamask/utils";
|
|
14
14
|
import { HYPERLIQUID_CONFIG } from "../constants/hyperLiquidConfig.mjs";
|
|
15
15
|
import { TP_SL_CONFIG, PERPS_CONSTANTS, ABSTRACTION_MODE_REFRESH_THROTTLE_MS } from "../constants/perpsConfig.mjs";
|
|
@@ -372,24 +372,11 @@ export class HyperLiquidSubscriptionService {
|
|
|
372
372
|
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_ensureBboSubscription).call(this, symbol);
|
|
373
373
|
}
|
|
374
374
|
});
|
|
375
|
-
// Send cached data immediately if available
|
|
376
|
-
// price for focused subscribers and falling back to the allMids baseline
|
|
377
|
-
// for list subscribers.
|
|
375
|
+
// Send cached data immediately if available
|
|
378
376
|
symbols.forEach((symbol) => {
|
|
379
377
|
const cachedPrice = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_cachedPriceData, "f")?.get(symbol);
|
|
380
378
|
if (cachedPrice) {
|
|
381
|
-
|
|
382
|
-
? __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_projectPriceUpdate).call(this, symbol, cachedPrice)
|
|
383
|
-
: cachedPrice;
|
|
384
|
-
callback([projected]);
|
|
385
|
-
}
|
|
386
|
-
else if (includeMarketData) {
|
|
387
|
-
// No allMids baseline yet; if a fresh fast-stream price is cached,
|
|
388
|
-
// send it immediately so focused screens are not blank on first render.
|
|
389
|
-
const fastPrice = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_getFreshActiveAssetCtxPrice).call(this, symbol);
|
|
390
|
-
if (fastPrice !== undefined) {
|
|
391
|
-
callback([__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_createPriceUpdate).call(this, symbol, fastPrice)]);
|
|
392
|
-
}
|
|
379
|
+
callback([cachedPrice]);
|
|
393
380
|
}
|
|
394
381
|
});
|
|
395
382
|
// Return cleanup function
|
|
@@ -662,7 +649,7 @@ export class HyperLiquidSubscriptionService {
|
|
|
662
649
|
* @returns Cleanup function to unsubscribe
|
|
663
650
|
*/
|
|
664
651
|
subscribeToOrderBook(params) {
|
|
665
|
-
const { symbol, levels = 10, nSigFigs = 5, mantissa,
|
|
652
|
+
const { symbol, levels = 10, nSigFigs = 5, mantissa, callback, onError, } = params;
|
|
666
653
|
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_clientService, "f")
|
|
667
654
|
.ensureSubscriptionClient(__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_walletService, "f").createWalletAdapter())
|
|
668
655
|
.catch(() => {
|
|
@@ -680,7 +667,7 @@ export class HyperLiquidSubscriptionService {
|
|
|
680
667
|
let subscription;
|
|
681
668
|
let cancelled = false;
|
|
682
669
|
subscriptionClient
|
|
683
|
-
.l2Book({ coin: symbol, nSigFigs, mantissa
|
|
670
|
+
.l2Book({ coin: symbol, nSigFigs, mantissa }, (data) => {
|
|
684
671
|
if (cancelled || data?.coin !== symbol || !data?.levels) {
|
|
685
672
|
return;
|
|
686
673
|
}
|
|
@@ -1013,7 +1000,7 @@ export class HyperLiquidSubscriptionService {
|
|
|
1013
1000
|
});
|
|
1014
1001
|
}
|
|
1015
1002
|
}
|
|
1016
|
-
|
|
1003
|
+
_HyperLiquidSubscriptionService_clientService = new WeakMap(), _HyperLiquidSubscriptionService_walletService = new WeakMap(), _HyperLiquidSubscriptionService_hip3Enabled = new WeakMap(), _HyperLiquidSubscriptionService_enabledDexs = new WeakMap(), _HyperLiquidSubscriptionService_allowlistMarkets = new WeakMap(), _HyperLiquidSubscriptionService_blocklistMarkets = new WeakMap(), _HyperLiquidSubscriptionService_priceDeviationLimit = new WeakMap(), _HyperLiquidSubscriptionService_discoveredDexNames = new WeakMap(), _HyperLiquidSubscriptionService_dexDiscoveryPromise = new WeakMap(), _HyperLiquidSubscriptionService_dexDiscoveryResolver = new WeakMap(), _HyperLiquidSubscriptionService_expectedDexs = new WeakMap(), _HyperLiquidSubscriptionService_initializedDexs = new WeakMap(), _HyperLiquidSubscriptionService_priceSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_positionSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_orderFillSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_orderSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_accountSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_marketDataSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_orderBookSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_globalAllMidsSubscription = new WeakMap(), _HyperLiquidSubscriptionService_globalAllMidsPromise = new WeakMap(), _HyperLiquidSubscriptionService_globalActiveAssetSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_pendingActiveAssetPromises = new WeakMap(), _HyperLiquidSubscriptionService_globalBboSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_pendingBboPromises = new WeakMap(), _HyperLiquidSubscriptionService_orderFillSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_spotStateSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_spotStateSubscriptionPromises = new WeakMap(), _HyperLiquidSubscriptionService_spotStateSubscriptionGeneration = new WeakMap(), _HyperLiquidSubscriptionService_symbolSubscriberCounts = new WeakMap(), _HyperLiquidSubscriptionService_dexSubscriberCounts = new WeakMap(), _HyperLiquidSubscriptionService_webData3Subscriptions = new WeakMap(), _HyperLiquidSubscriptionService_webData3SubscriptionPromise = new WeakMap(), _HyperLiquidSubscriptionService_positionSubscriberCount = new WeakMap(), _HyperLiquidSubscriptionService_orderSubscriberCount = new WeakMap(), _HyperLiquidSubscriptionService_accountSubscriberCount = new WeakMap(), _HyperLiquidSubscriptionService_oiCapSubscriberCount = new WeakMap(), _HyperLiquidSubscriptionService_dexPositionsCache = new WeakMap(), _HyperLiquidSubscriptionService_dexOrdersCache = new WeakMap(), _HyperLiquidSubscriptionService_dexAccountCache = new WeakMap(), _HyperLiquidSubscriptionService_cachedSpotState = new WeakMap(), _HyperLiquidSubscriptionService_abstractionModeByUser = new WeakMap(), _HyperLiquidSubscriptionService_abstractionModeLastWsRefreshAtByUser = new WeakMap(), _HyperLiquidSubscriptionService_abstractionModeInflightByUser = new WeakMap(), _HyperLiquidSubscriptionService_cachedSpotStateUserAddress = new WeakMap(), _HyperLiquidSubscriptionService_spotStatePromise = new WeakMap(), _HyperLiquidSubscriptionService_spotStatePromiseUserAddress = new WeakMap(), _HyperLiquidSubscriptionService_spotStateGeneration = new WeakMap(), _HyperLiquidSubscriptionService_cachedPositions = new WeakMap(), _HyperLiquidSubscriptionService_cachedOrders = new WeakMap(), _HyperLiquidSubscriptionService_cachedAccount = new WeakMap(), _HyperLiquidSubscriptionService_ordersCacheInitialized = new WeakMap(), _HyperLiquidSubscriptionService_positionsCacheInitialized = new WeakMap(), _HyperLiquidSubscriptionService_oiCapSubscribers = new WeakMap(), _HyperLiquidSubscriptionService_cachedOICaps = new WeakMap(), _HyperLiquidSubscriptionService_cachedOICapsHash = new WeakMap(), _HyperLiquidSubscriptionService_oiCapsCacheInitialized = new WeakMap(), _HyperLiquidSubscriptionService_cachedPriceData = new WeakMap(), _HyperLiquidSubscriptionService_allMidsSnapshots = new WeakMap(), _HyperLiquidSubscriptionService_cachedFills = new WeakMap(), _HyperLiquidSubscriptionService_fillsCacheInitialized = new WeakMap(), _HyperLiquidSubscriptionService_assetCtxsSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_dexAssetCtxsCache = new WeakMap(), _HyperLiquidSubscriptionService_assetCtxsSubscriptionPromises = new WeakMap(), _HyperLiquidSubscriptionService_dexAllMidsSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_dexAllMidsSubscriptionPromises = new WeakMap(), _HyperLiquidSubscriptionService_clearinghouseStateSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_openOrdersSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_pendingClearinghouseSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_pendingOpenOrdersSubscriptions = new WeakMap(), _HyperLiquidSubscriptionService_dexMetaCache = new WeakMap(), _HyperLiquidSubscriptionService_orderBookCache = new WeakMap(), _HyperLiquidSubscriptionService_marketDataCache = new WeakMap(), _HyperLiquidSubscriptionService_isClearing = new WeakMap(), _HyperLiquidSubscriptionService_restoreRetryTimeouts = new WeakMap(), _HyperLiquidSubscriptionService_deps = new WeakMap(), _HyperLiquidSubscriptionService_cachedPositionsHash = new WeakMap(), _HyperLiquidSubscriptionService_cachedOrdersHash = new WeakMap(), _HyperLiquidSubscriptionService_cachedAccountHash = new WeakMap(), _HyperLiquidSubscriptionService_instances = new WeakSet(), _HyperLiquidSubscriptionService_logErrorUnlessClearing = function _HyperLiquidSubscriptionService_logErrorUnlessClearing(error, context) {
|
|
1017
1004
|
if (__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_isClearing, "f")) {
|
|
1018
1005
|
return;
|
|
1019
1006
|
}
|
|
@@ -2210,7 +2197,7 @@ async function _HyperLiquidSubscriptionService_ensureOrderFillISubscription(acco
|
|
|
2210
2197
|
(__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_marketDataSubscribers, "f").get(symbol)?.size ?? 0) > 0;
|
|
2211
2198
|
const priceUpdate = {
|
|
2212
2199
|
symbol,
|
|
2213
|
-
price,
|
|
2200
|
+
price, // This is the mid price from allMids
|
|
2214
2201
|
timestamp: Date.now(),
|
|
2215
2202
|
percentChange24h,
|
|
2216
2203
|
// Add mark price from activeAssetCtx
|
|
@@ -2239,27 +2226,6 @@ async function _HyperLiquidSubscriptionService_ensureOrderFillISubscription(acco
|
|
|
2239
2226
|
}),
|
|
2240
2227
|
};
|
|
2241
2228
|
return priceUpdate;
|
|
2242
|
-
}, _HyperLiquidSubscriptionService_getFreshActiveAssetCtxPrice = function _HyperLiquidSubscriptionService_getFreshActiveAssetCtxPrice(symbol) {
|
|
2243
|
-
const marketData = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_marketDataCache, "f").get(symbol);
|
|
2244
|
-
if (marketData?.activeAssetCtxPrice === undefined ||
|
|
2245
|
-
marketData.priceLastUpdated === undefined) {
|
|
2246
|
-
return undefined;
|
|
2247
|
-
}
|
|
2248
|
-
if (Date.now() - marketData.priceLastUpdated >
|
|
2249
|
-
__classPrivateFieldGet(_a, _a, "f", _HyperLiquidSubscriptionService_activeAssetCtxPriceTtlMs)) {
|
|
2250
|
-
return undefined;
|
|
2251
|
-
}
|
|
2252
|
-
return marketData.activeAssetCtxPrice.toString();
|
|
2253
|
-
}, _HyperLiquidSubscriptionService_projectPriceUpdate = function _HyperLiquidSubscriptionService_projectPriceUpdate(symbol, base) {
|
|
2254
|
-
const fastPrice = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_getFreshActiveAssetCtxPrice).call(this, symbol);
|
|
2255
|
-
if (fastPrice === undefined) {
|
|
2256
|
-
return base;
|
|
2257
|
-
}
|
|
2258
|
-
return {
|
|
2259
|
-
...base,
|
|
2260
|
-
price: fastPrice,
|
|
2261
|
-
timestamp: Date.now(),
|
|
2262
|
-
};
|
|
2263
2229
|
}, _HyperLiquidSubscriptionService_ensureGlobalAllMidsSubscription = function _HyperLiquidSubscriptionService_ensureGlobalAllMidsSubscription() {
|
|
2264
2230
|
// Check both the subscription AND the promise to prevent race conditions
|
|
2265
2231
|
if (__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_globalAllMidsSubscription, "f") ?? __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_globalAllMidsPromise, "f")) {
|
|
@@ -2360,7 +2326,6 @@ async function _HyperLiquidSubscriptionService_ensureOrderFillISubscription(acco
|
|
|
2360
2326
|
const { ctx } = data;
|
|
2361
2327
|
// Cache market data for consolidation with price updates
|
|
2362
2328
|
const ctxPrice = ctx.midPx ?? ctx.markPx;
|
|
2363
|
-
const now = Date.now();
|
|
2364
2329
|
const openInterestUSD = isPerpsContext(data) && ctxPrice
|
|
2365
2330
|
? calculateOpenInterestUSD(data.ctx.openInterest, ctxPrice)
|
|
2366
2331
|
: NaN;
|
|
@@ -2382,31 +2347,17 @@ async function _HyperLiquidSubscriptionService_ensureOrderFillISubscription(acco
|
|
|
2382
2347
|
oraclePrice: isPerpsContext(data)
|
|
2383
2348
|
? parseFloat(data.ctx.oraclePx.toString())
|
|
2384
2349
|
: undefined,
|
|
2385
|
-
lastUpdated: now,
|
|
2386
|
-
// Store fast-stream price for per-subscriber projection in
|
|
2387
|
-
// #notifyAllPriceSubscribers. Used only for focused subscribers.
|
|
2388
|
-
activeAssetCtxPrice: ctxPrice
|
|
2389
|
-
? parseFloat(ctxPrice.toString())
|
|
2390
|
-
: undefined,
|
|
2391
|
-
priceLastUpdated: ctxPrice ? now : undefined,
|
|
2350
|
+
lastUpdated: Date.now(),
|
|
2392
2351
|
};
|
|
2393
2352
|
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_marketDataCache, "f").set(symbol, marketData);
|
|
2394
|
-
//
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
if (priceCache && existingBaseline) {
|
|
2402
|
-
priceCache.set(symbol, __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_createPriceUpdate).call(this, symbol, existingBaseline.price));
|
|
2353
|
+
// Update cached price data with new 24h change if we have current price
|
|
2354
|
+
const currentCachedPrice = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_cachedPriceData, "f")?.get(symbol);
|
|
2355
|
+
if (currentCachedPrice) {
|
|
2356
|
+
const updatedPrice = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_createPriceUpdate).call(this, symbol, currentCachedPrice.price);
|
|
2357
|
+
__classPrivateFieldSet(this, _HyperLiquidSubscriptionService_cachedPriceData, __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_cachedPriceData, "f") ?? new Map(), "f");
|
|
2358
|
+
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_cachedPriceData, "f").set(symbol, updatedPrice);
|
|
2359
|
+
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_notifyAllPriceSubscribers).call(this);
|
|
2403
2360
|
}
|
|
2404
|
-
// Notify subscribers. #notifyAllPriceSubscribers projects the
|
|
2405
|
-
// fast-stream price (now stored in #marketDataCache) for focused
|
|
2406
|
-
// (includeMarketData: true) subscribers, while list subscribers
|
|
2407
|
-
// continue to receive only the allMids baseline from #cachedPriceData.
|
|
2408
|
-
// List subscribers are skipped until an allMids tick has arrived.
|
|
2409
|
-
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_instances, "m", _HyperLiquidSubscriptionService_notifyAllPriceSubscribers).call(this);
|
|
2410
2361
|
}
|
|
2411
2362
|
})
|
|
2412
2363
|
.then((sub) => {
|
|
@@ -2620,15 +2571,6 @@ async function _HyperLiquidSubscriptionService_createAssetCtxsSubscription(dex)
|
|
|
2620
2571
|
// This is a perps context
|
|
2621
2572
|
const ctxPrice = ctx.midPx ?? ctx.markPx;
|
|
2622
2573
|
const openInterestUSD = calculateOpenInterestUSD(ctx.openInterest, ctxPrice);
|
|
2623
|
-
// Preserve the fast-stream price fields set by the per-symbol
|
|
2624
|
-
// activeAssetCtx handler. assetCtxs is a per-DEX batch that does not
|
|
2625
|
-
// carry the fast-stream price concept, so rebuilding the entry from
|
|
2626
|
-
// scratch would clobber activeAssetCtxPrice/priceLastUpdated and make
|
|
2627
|
-
// #getFreshActiveAssetCtxPrice return stale, dropping focused
|
|
2628
|
-
// subscribers back to the slower allMids baseline. priceLastUpdated
|
|
2629
|
-
// is carried forward (not reset) so the staleness gate keeps
|
|
2630
|
-
// reflecting the last activeAssetCtx tick.
|
|
2631
|
-
const existingMarketData = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_marketDataCache, "f").get(asset.name);
|
|
2632
2574
|
const marketData = {
|
|
2633
2575
|
prevDayPx: ctx.prevDayPx
|
|
2634
2576
|
? parseFloat(ctx.prevDayPx.toString())
|
|
@@ -2642,8 +2584,6 @@ async function _HyperLiquidSubscriptionService_createAssetCtxsSubscription(dex)
|
|
|
2642
2584
|
: undefined,
|
|
2643
2585
|
oraclePrice: parseFloat(ctx.oraclePx.toString()),
|
|
2644
2586
|
lastUpdated: Date.now(),
|
|
2645
|
-
activeAssetCtxPrice: existingMarketData?.activeAssetCtxPrice,
|
|
2646
|
-
priceLastUpdated: existingMarketData?.priceLastUpdated,
|
|
2647
2587
|
};
|
|
2648
2588
|
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_marketDataCache, "f").set(asset.name, marketData);
|
|
2649
2589
|
// HIP-3: Extract price from assetCtx and update cached prices
|
|
@@ -2863,30 +2803,26 @@ async function _HyperLiquidSubscriptionService_createAssetCtxsSubscription(dex)
|
|
|
2863
2803
|
maxTotal,
|
|
2864
2804
|
};
|
|
2865
2805
|
}, _HyperLiquidSubscriptionService_notifyAllPriceSubscribers = function _HyperLiquidSubscriptionService_notifyAllPriceSubscribers() {
|
|
2806
|
+
// If no price data exists yet, don't notify
|
|
2807
|
+
if (!__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_cachedPriceData, "f")) {
|
|
2808
|
+
return;
|
|
2809
|
+
}
|
|
2810
|
+
const priceData = __classPrivateFieldGet(this, _HyperLiquidSubscriptionService_cachedPriceData, "f");
|
|
2811
|
+
// Group updates by subscriber to batch notifications
|
|
2866
2812
|
const subscriberUpdates = new Map();
|
|
2867
2813
|
__classPrivateFieldGet(this, _HyperLiquidSubscriptionService_priceSubscribers, "f").forEach((subscriberSet, symbol) => {
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
}
|
|
2881
|
-
else if (allMidsBase !== undefined) {
|
|
2882
|
-
priceUpdate = allMidsBase;
|
|
2883
|
-
}
|
|
2884
|
-
if (priceUpdate !== undefined) {
|
|
2885
|
-
const updates = subscriberUpdates.get(callback) ?? [];
|
|
2886
|
-
updates.push(priceUpdate);
|
|
2887
|
-
subscriberUpdates.set(callback, updates);
|
|
2888
|
-
}
|
|
2889
|
-
});
|
|
2814
|
+
const priceUpdate = priceData.get(symbol);
|
|
2815
|
+
if (priceUpdate) {
|
|
2816
|
+
subscriberSet.forEach((callback) => {
|
|
2817
|
+
if (!subscriberUpdates.has(callback)) {
|
|
2818
|
+
subscriberUpdates.set(callback, []);
|
|
2819
|
+
}
|
|
2820
|
+
const updates = subscriberUpdates.get(callback);
|
|
2821
|
+
if (updates) {
|
|
2822
|
+
updates.push(priceUpdate);
|
|
2823
|
+
}
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2890
2826
|
});
|
|
2891
2827
|
// Send batched updates to each subscriber
|
|
2892
2828
|
subscriberUpdates.forEach((updates, callback) => {
|
|
@@ -2895,8 +2831,4 @@ async function _HyperLiquidSubscriptionService_createAssetCtxsSubscription(dex)
|
|
|
2895
2831
|
}
|
|
2896
2832
|
});
|
|
2897
2833
|
};
|
|
2898
|
-
// Stale threshold for the fast-stream price preference. If the last
|
|
2899
|
-
// activeAssetCtx price update is older than this, the allMids baseline is
|
|
2900
|
-
// used for focused subscribers.
|
|
2901
|
-
_HyperLiquidSubscriptionService_activeAssetCtxPriceTtlMs = { value: 10000 };
|
|
2902
2834
|
//# sourceMappingURL=HyperLiquidSubscriptionService.mjs.map
|