@metamask-previews/perps-controller 16.0.0-preview-2f57247 → 16.0.0-preview-6fd51644c
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 -4
- package/dist/providers/HyperLiquidProvider.cjs +7 -26
- 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 +7 -26
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
### Fixed
|
|
11
|
-
|
|
12
|
-
- Revalidate HyperLiquid positions over HTTP before reporting a WebSocket cache miss during a TP/SL update ([#10101](https://github.com/MetaMask/core/pull/10101)).
|
|
13
|
-
|
|
14
10
|
## [16.0.0]
|
|
15
11
|
|
|
16
12
|
### Added
|
|
@@ -2188,7 +2188,7 @@ class HyperLiquidProvider {
|
|
|
2188
2188
|
// when available, otherwise query that DEX over HTTP. If neither source
|
|
2189
2189
|
// answers, fail closed: trusting the snapshot would recreate the stale
|
|
2190
2190
|
// side/size reduce-only rejection this method is meant to prevent.
|
|
2191
|
-
const currentPositions = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getPositionsForOperation).call(this, (0, hyperLiquidAdapter_js_1.parseAssetName)(symbol).dex ?? ''
|
|
2191
|
+
const currentPositions = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getPositionsForOperation).call(this, (0, hyperLiquidAdapter_js_1.parseAssetName)(symbol).dex ?? '');
|
|
2192
2192
|
const position = currentPositions.find((pos) => pos.symbol === symbol);
|
|
2193
2193
|
if (livePosition &&
|
|
2194
2194
|
position &&
|
|
@@ -10246,11 +10246,8 @@ async function _HyperLiquidProvider_getStandaloneValidatedDexs() {
|
|
|
10246
10246
|
*
|
|
10247
10247
|
* A symbol-specific caller can use its current-connection DEX slice directly.
|
|
10248
10248
|
* The current-epoch slice wins before any REST request because it is the
|
|
10249
|
-
* provider's live subscription source for that exact DEX.
|
|
10250
|
-
*
|
|
10251
|
-
* covers the post-fill window before the next WebSocket position update. If
|
|
10252
|
-
* the target DEX has not published, the caller uses REST instead of a stale
|
|
10253
|
-
* aggregate.
|
|
10249
|
+
* provider's live subscription source for that exact DEX. If the target DEX
|
|
10250
|
+
* has not published, the caller uses REST instead of a stale aggregate.
|
|
10254
10251
|
*
|
|
10255
10252
|
* A whole-list caller uses one shallow-copied WebSocket snapshot only when
|
|
10256
10253
|
* every configured DEX is current. Otherwise it falls back to REST. No path
|
|
@@ -10259,31 +10256,15 @@ async function _HyperLiquidProvider_getStandaloneValidatedDexs() {
|
|
|
10259
10256
|
*
|
|
10260
10257
|
* @param targetDex - DEX for a single-symbol lookup, or undefined for a full
|
|
10261
10258
|
* position list.
|
|
10262
|
-
* @param options - Optional lookup behavior for a symbol-specific operation.
|
|
10263
|
-
* @param options.revalidateMissingSymbol - Query the target DEX over REST when
|
|
10264
|
-
* its current WebSocket slice does not contain this symbol.
|
|
10265
10259
|
* @returns Positions from one provenance-safe cache/REST path.
|
|
10266
10260
|
*/
|
|
10267
|
-
async function _HyperLiquidProvider_getPositionsForOperation(targetDex
|
|
10261
|
+
async function _HyperLiquidProvider_getPositionsForOperation(targetDex) {
|
|
10268
10262
|
if (targetDex !== undefined) {
|
|
10269
10263
|
const targetPositions = __classPrivateFieldGet(this, _HyperLiquidProvider_subscriptionService, "f").getCachedPositionsForDex(targetDex);
|
|
10270
|
-
if (targetPositions
|
|
10271
|
-
|
|
10272
|
-
}
|
|
10273
|
-
else {
|
|
10274
|
-
const { revalidateMissingSymbol } = options;
|
|
10275
|
-
const shouldRevalidate = revalidateMissingSymbol !== undefined &&
|
|
10276
|
-
targetPositions.find((position) => position.symbol === revalidateMissingSymbol) === undefined;
|
|
10277
|
-
if (shouldRevalidate) {
|
|
10278
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('Target symbol missing from position cache: revalidating REST positions', {
|
|
10279
|
-
dex: targetDex || 'main',
|
|
10280
|
-
symbol: revalidateMissingSymbol,
|
|
10281
|
-
});
|
|
10282
|
-
}
|
|
10283
|
-
else {
|
|
10284
|
-
return [...targetPositions];
|
|
10285
|
-
}
|
|
10264
|
+
if (targetPositions !== null) {
|
|
10265
|
+
return [...targetPositions];
|
|
10286
10266
|
}
|
|
10267
|
+
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('Target DEX position cache unavailable: fetching REST positions', { dex: targetDex || 'main' });
|
|
10287
10268
|
const { answered, positions } = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_queryDexPositions).call(this, targetDex || null);
|
|
10288
10269
|
if (!answered) {
|
|
10289
10270
|
throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.PROVIDER_NOT_AVAILABLE);
|