@metamask-previews/perps-controller 9.2.1-preview-9feca08d3 → 9.2.1-preview-9c0a7053d
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 +21 -0
- package/dist/constants/hyperLiquidConfig.cjs +2 -18
- package/dist/constants/hyperLiquidConfig.cjs.map +1 -1
- package/dist/constants/hyperLiquidConfig.d.cts +0 -16
- package/dist/constants/hyperLiquidConfig.d.cts.map +1 -1
- package/dist/constants/hyperLiquidConfig.d.mts +0 -16
- package/dist/constants/hyperLiquidConfig.d.mts.map +1 -1
- package/dist/constants/hyperLiquidConfig.mjs +0 -16
- package/dist/constants/hyperLiquidConfig.mjs.map +1 -1
- package/dist/index.cjs +4 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/perpsErrorCodes.cjs +2 -0
- package/dist/perpsErrorCodes.cjs.map +1 -1
- package/dist/perpsErrorCodes.d.cts +1 -0
- package/dist/perpsErrorCodes.d.cts.map +1 -1
- package/dist/perpsErrorCodes.d.mts +1 -0
- package/dist/perpsErrorCodes.d.mts.map +1 -1
- package/dist/perpsErrorCodes.mjs +2 -0
- package/dist/perpsErrorCodes.mjs.map +1 -1
- package/dist/providers/HyperLiquidProvider.cjs +39 -290
- 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 +40 -291
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -1
- package/dist/services/HyperLiquidSubscriptionService.cjs +115 -14
- 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 +115 -14
- package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperLiquidProvider.d.cts","sourceRoot":"","sources":["../../src/providers/HyperLiquidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,wBAAwB;AAE7D,OAAO,KAAK,EACV,cAAc,EAEf,4BAA4B;AAG7B,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAiC;
|
|
1
|
+
{"version":3,"file":"HyperLiquidProvider.d.cts","sourceRoot":"","sources":["../../src/providers/HyperLiquidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,wBAAwB;AAE7D,OAAO,KAAK,EACV,cAAc,EAEf,4BAA4B;AAG7B,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAiC;AAgC7D,OAAO,EAEL,wBAAwB,EACzB,iDAA6C;AAQ9C,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,EAC5B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,s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C,MAAM,EAAE,CAAC;IAyBrE,sBAAsB,CAAC,OAAO,EAAE;QACpC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,YAAY,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvB;;;;;OAKG;IACH,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;CA6W9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HyperLiquidProvider.d.mts","sourceRoot":"","sources":["../../src/providers/HyperLiquidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,wBAAwB;AAE7D,OAAO,KAAK,EACV,cAAc,EAEf,4BAA4B;AAG7B,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAiC;
|
|
1
|
+
{"version":3,"file":"HyperLiquidProvider.d.mts","sourceRoot":"","sources":["../../src/providers/HyperLiquidProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,wBAAwB;AAE7D,OAAO,KAAK,EACV,cAAc,EAEf,4BAA4B;AAG7B,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAiC;AAgC7D,OAAO,EAEL,wBAAwB,EACzB,iDAA6C;AAQ9C,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,OAAO,EACP,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,EAC5B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EACh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MAAM,KACxB,IAAI,GACR,MAAM,IAAI;IAIb;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAyBrE,sBAAsB,CAAC,OAAO,EAAE;QACpC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,YAAY,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvB;;;;;OAKG;IACH,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;CA6W9C"}
|
|
@@ -9,11 +9,11 @@ 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 _HyperLiquidProvider_instances, _HyperLiquidProvider_deps, _HyperLiquidProvider_clientService, _HyperLiquidProvider_walletService, _HyperLiquidProvider_subscriptionService, _HyperLiquidProvider_symbolToAssetId, _HyperLiquidProvider_userFeeCache, _HyperLiquidProvider_maxLeverageCache, _HyperLiquidProvider_cachedMetaByDex, _HyperLiquidProvider_cachedMarketDataWithPrices, _HyperLiquidProvider_cachedSpotMeta, _HyperLiquidProvider_dexDiscoveryCache, _HyperLiquidProvider_referralCheckCache, _HyperLiquidProvider_builderFeeCheckCache, _HyperLiquidProvider_ensureReadyPromise, _HyperLiquidProvider_pendingBuilderFeeApprovals, _HyperLiquidProvider_compiledAllowlistPatterns, _HyperLiquidProvider_compiledBlocklistPatterns, _HyperLiquidProvider_userFeeDiscountBips, _HyperLiquidProvider_hip3Enabled, _HyperLiquidProvider_allowlistMarkets, _HyperLiquidProvider_blocklistMarkets, _HyperLiquidProvider_useUnifiedAccount, _HyperLiquidProvider_dexDiscoveryComplete, _HyperLiquidProvider_unifiedAccountSetupNeedsRetry, _HyperLiquidProvider_pendingValidatedDexsPromise, _HyperLiquidProvider_cachedUsdcTokenId, _HyperLiquidProvider_errorMappings, _HyperLiquidProvider_clientsInitialized, _HyperLiquidProvider_initializationPromise, _HyperLiquidProvider_messenger, _HyperLiquidProvider_builderAddressTestnet, _HyperLiquidProvider_builderAddressMainnet, _HyperLiquidProvider_priceDeviationLimit, _HyperLiquidProvider_compilePatternsSafely, _HyperLiquidProvider_ensureClientsInitialized, _HyperLiquidProvider_isWalletOnHyperliquid, _HyperLiquidProvider_ensureUnifiedAccountEnabled, _HyperLiquidProvider_ensureReady, _HyperLiquidProvider_tradingSetupPromise, _HyperLiquidProvider_tradingSetupComplete, _HyperLiquidProvider_ensureReadyForTrading, _HyperLiquidProvider_getOrFetchPrice, _HyperLiquidProvider_filterFills, _HyperLiquidProvider_getAllAvailableDexs, _HyperLiquidProvider_getValidatedDexs, _HyperLiquidProvider_fetchValidatedDexsInternal, _HyperLiquidProvider_getCachedMeta, _HyperLiquidProvider_backfillAssetMapForDex, _HyperLiquidProvider_getAssetIdWithRepair, _HyperLiquidProvider_getCachedSpotMeta, _HyperLiquidProvider_getCachedPerpDexs, _HyperLiquidProvider_calculateHip3FeeMultiplier, _HyperLiquidProvider_getCacheKey, _HyperLiquidProvider_fetchMarketsForDex, _HyperLiquidProvider_getUsdcTokenId,
|
|
12
|
+
var _HyperLiquidProvider_instances, _HyperLiquidProvider_deps, _HyperLiquidProvider_clientService, _HyperLiquidProvider_walletService, _HyperLiquidProvider_subscriptionService, _HyperLiquidProvider_symbolToAssetId, _HyperLiquidProvider_userFeeCache, _HyperLiquidProvider_maxLeverageCache, _HyperLiquidProvider_cachedMetaByDex, _HyperLiquidProvider_cachedMarketDataWithPrices, _HyperLiquidProvider_cachedSpotMeta, _HyperLiquidProvider_dexDiscoveryCache, _HyperLiquidProvider_referralCheckCache, _HyperLiquidProvider_builderFeeCheckCache, _HyperLiquidProvider_ensureReadyPromise, _HyperLiquidProvider_pendingBuilderFeeApprovals, _HyperLiquidProvider_compiledAllowlistPatterns, _HyperLiquidProvider_compiledBlocklistPatterns, _HyperLiquidProvider_userFeeDiscountBips, _HyperLiquidProvider_hip3Enabled, _HyperLiquidProvider_allowlistMarkets, _HyperLiquidProvider_blocklistMarkets, _HyperLiquidProvider_useUnifiedAccount, _HyperLiquidProvider_dexDiscoveryComplete, _HyperLiquidProvider_unifiedAccountSetupNeedsRetry, _HyperLiquidProvider_pendingValidatedDexsPromise, _HyperLiquidProvider_cachedUsdcTokenId, _HyperLiquidProvider_errorMappings, _HyperLiquidProvider_clientsInitialized, _HyperLiquidProvider_initializationPromise, _HyperLiquidProvider_messenger, _HyperLiquidProvider_builderAddressTestnet, _HyperLiquidProvider_builderAddressMainnet, _HyperLiquidProvider_priceDeviationLimit, _HyperLiquidProvider_compilePatternsSafely, _HyperLiquidProvider_ensureClientsInitialized, _HyperLiquidProvider_isWalletOnHyperliquid, _HyperLiquidProvider_ensureUnifiedAccountEnabled, _HyperLiquidProvider_ensureReady, _HyperLiquidProvider_tradingSetupPromise, _HyperLiquidProvider_tradingSetupComplete, _HyperLiquidProvider_ensureReadyForTrading, _HyperLiquidProvider_getOrFetchPrice, _HyperLiquidProvider_filterFills, _HyperLiquidProvider_getAllAvailableDexs, _HyperLiquidProvider_getValidatedDexs, _HyperLiquidProvider_fetchValidatedDexsInternal, _HyperLiquidProvider_getCachedMeta, _HyperLiquidProvider_backfillAssetMapForDex, _HyperLiquidProvider_getAssetIdWithRepair, _HyperLiquidProvider_getCachedSpotMeta, _HyperLiquidProvider_getCachedPerpDexs, _HyperLiquidProvider_calculateHip3FeeMultiplier, _HyperLiquidProvider_getCacheKey, _HyperLiquidProvider_fetchMarketsForDex, _HyperLiquidProvider_getUsdcTokenId, _HyperLiquidProvider_isUsdcCollateralDex, _HyperLiquidProvider_buildAssetMapping, _HyperLiquidProvider_queryUserDataAcrossDexs, _HyperLiquidProvider_mapError, _HyperLiquidProvider_getErrorContext, _HyperLiquidProvider_checkBuilderFeeApproval, _HyperLiquidProvider_ensureBuilderFeeApproval, _HyperLiquidProvider_checkBuilderFeeStatus, _HyperLiquidProvider_getBalanceForDex, _HyperLiquidProvider_findSourceDexWithBalance, _HyperLiquidProvider_autoTransferForHip3Order, _HyperLiquidProvider_autoTransferBackAfterClose, _HyperLiquidProvider_calculateHip3RequiredMargin, _HyperLiquidProvider_handleHip3PostOrderRebalance, _HyperLiquidProvider_handleHip3OrderRollback, _HyperLiquidProvider_validateOrderBeforePlacement, _HyperLiquidProvider_getAssetInfo, _HyperLiquidProvider_prepareAssetForTrading, _HyperLiquidProvider_handleHip3PreOrder, _HyperLiquidProvider_submitOrderWithRollback, _HyperLiquidProvider_handleOrderError, _HyperLiquidProvider_getStandaloneValidatedDexs, _HyperLiquidProvider_getAllMids, _HyperLiquidProvider_fetchSingleDexFresh, _HyperLiquidProvider_mergeDexResultsInto, _HyperLiquidProvider_cacheFreshMarketDataSnapshot, _HyperLiquidProvider_getStaleMarketDataSnapshot, _HyperLiquidProvider_isFeeCacheValid, _HyperLiquidProvider_getBuilderAddress, _HyperLiquidProvider_getReferralCode, _HyperLiquidProvider_ensureReferralSet, _HyperLiquidProvider_isReferralCodeReady, _HyperLiquidProvider_checkReferralSet, _HyperLiquidProvider_setReferralCode;
|
|
13
13
|
import { hasProperty } from "@metamask/utils";
|
|
14
14
|
import { v4 as uuidv4 } from "uuid";
|
|
15
15
|
import { PERPS_EVENT_PROPERTY, PERPS_EVENT_VALUE } from "../constants/eventNames.mjs";
|
|
16
|
-
import { BASIS_POINTS_DIVISOR, BUILDER_FEE_CONFIG, FEE_RATES, getBridgeInfo, getChainId, HIP3_ASSET_MARKET_TYPES, HIP3_FEE_CONFIG, HIP3_MARGIN_CONFIG, HYPERLIQUID_ASSET_NAMES, HYPERLIQUID_CONFIG, HYPERLIQUID_WITHDRAWAL_MINUTES, REFERRAL_CONFIG,
|
|
16
|
+
import { BASIS_POINTS_DIVISOR, BUILDER_FEE_CONFIG, FEE_RATES, getBridgeInfo, getChainId, HIP3_ASSET_MARKET_TYPES, HIP3_FEE_CONFIG, HIP3_MARGIN_CONFIG, HYPERLIQUID_ASSET_NAMES, HYPERLIQUID_CONFIG, HYPERLIQUID_WITHDRAWAL_MINUTES, REFERRAL_CONFIG, TRADING_DEFAULTS, USDC_DECIMALS, USDC_SYMBOL } from "../constants/hyperLiquidConfig.mjs";
|
|
17
17
|
import { ORDER_SLIPPAGE_CONFIG, PERFORMANCE_CONFIG, PERPS_CONSTANTS, TP_SL_CONFIG, WITHDRAWAL_CONSTANTS } from "../constants/perpsConfig.mjs";
|
|
18
18
|
import { PERPS_TRANSACTIONS_HISTORY_CONSTANTS } from "../constants/transactionsHistoryConfig.mjs";
|
|
19
19
|
import { PERPS_ERROR_CODES } from "../perpsErrorCodes.mjs";
|
|
@@ -74,7 +74,7 @@ export class HyperLiquidProvider {
|
|
|
74
74
|
_HyperLiquidProvider_cachedMetaByDex.set(this, new Map());
|
|
75
75
|
// Last known-good market list for stale fallback when every enabled DEX fails in one fetch window.
|
|
76
76
|
_HyperLiquidProvider_cachedMarketDataWithPrices.set(this, null);
|
|
77
|
-
// Session cache for spot metadata (contains
|
|
77
|
+
// Session cache for spot metadata (contains token info for HIP-3 collateral checks)
|
|
78
78
|
// Pre-fetched in ensureReadyForTrading() to avoid API failures during order placement
|
|
79
79
|
_HyperLiquidProvider_cachedSpotMeta.set(this, null);
|
|
80
80
|
// Unified DEX discovery cache — single source of truth for all perpDexs() derivatives.
|
|
@@ -4233,7 +4233,7 @@ async function _HyperLiquidProvider_ensureReady() {
|
|
|
4233
4233
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('[ensureReadyForTrading] Starting trading setup (may require signatures)');
|
|
4234
4234
|
__classPrivateFieldSet(this, _HyperLiquidProvider_tradingSetupPromise, (async () => {
|
|
4235
4235
|
// Pre-fetch spotMeta for HIP-3 operations (non-blocking if it fails)
|
|
4236
|
-
// This ensures token info (USDC
|
|
4236
|
+
// This ensures token info (e.g. USDC token index) is available during order placement
|
|
4237
4237
|
if (__classPrivateFieldGet(this, _HyperLiquidProvider_hip3Enabled, "f")) {
|
|
4238
4238
|
try {
|
|
4239
4239
|
await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getCachedSpotMeta).call(this);
|
|
@@ -4573,7 +4573,7 @@ async function _HyperLiquidProvider_getAssetIdWithRepair(params) {
|
|
|
4573
4573
|
}, _HyperLiquidProvider_getCachedSpotMeta =
|
|
4574
4574
|
/**
|
|
4575
4575
|
* Fetch spot metadata with session-based caching
|
|
4576
|
-
* Contains token info (USDC
|
|
4576
|
+
* Contains token info (e.g. USDC token index) needed for HIP-3 collateral checks
|
|
4577
4577
|
* Pre-fetched in ensureReadyForTrading() to ensure availability during order placement
|
|
4578
4578
|
*
|
|
4579
4579
|
* @returns SpotMetaResponse with tokens and universe data
|
|
@@ -4710,6 +4710,14 @@ async function _HyperLiquidProvider_fetchMarketsForDex(params) {
|
|
|
4710
4710
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log(`HyperLiquidProvider: Invalid universe data for DEX ${dex ?? 'main'}`);
|
|
4711
4711
|
return [];
|
|
4712
4712
|
}
|
|
4713
|
+
// TAT-3304: Following the USDH sunset, only USDC-collateral HIP-3 DEXs
|
|
4714
|
+
// are supported for trading. Gate non-USDC-collateral DEXs out of market
|
|
4715
|
+
// discovery entirely (regardless of skipFilters) so their markets can
|
|
4716
|
+
// never be surfaced to trade, even via an allowlist entry naming the DEX.
|
|
4717
|
+
if (dex !== null && !(await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_isUsdcCollateralDex).call(this, dex))) {
|
|
4718
|
+
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Filtering out non-USDC-collateral HIP-3 DEX from market discovery', { dex });
|
|
4719
|
+
return [];
|
|
4720
|
+
}
|
|
4713
4721
|
// Transform to MarketInfo format
|
|
4714
4722
|
const markets = meta.universe.map((asset) => adaptMarketFromSDK(asset));
|
|
4715
4723
|
// Apply HIP-3 filtering on-demand (cheap array operation)
|
|
@@ -4746,288 +4754,36 @@ async function _HyperLiquidProvider_getUsdcTokenId() {
|
|
|
4746
4754
|
tokenId: __classPrivateFieldGet(this, _HyperLiquidProvider_cachedUsdcTokenId, "f"),
|
|
4747
4755
|
});
|
|
4748
4756
|
return __classPrivateFieldGet(this, _HyperLiquidProvider_cachedUsdcTokenId, "f");
|
|
4749
|
-
},
|
|
4757
|
+
}, _HyperLiquidProvider_isUsdcCollateralDex =
|
|
4750
4758
|
/**
|
|
4751
|
-
* Check if a HIP-3 DEX uses
|
|
4752
|
-
*
|
|
4759
|
+
* Check if a HIP-3 DEX uses USDC as its collateral token
|
|
4760
|
+
*
|
|
4761
|
+
* TAT-3304: Following the USDH sunset, only USDC-collateral DEXs are
|
|
4762
|
+
* supported for trading. This gate filters non-USDC-collateral DEXs
|
|
4763
|
+
* (e.g. the now-sunset USDH) out of market discovery and blocks order
|
|
4764
|
+
* placement, replacing the previous USDH-specific auto-swap path.
|
|
4765
|
+
*
|
|
4766
|
+
* Fails open (treated as USDC) when the collateral token index can't be
|
|
4767
|
+
* resolved against spot metadata, so an unexpected/incomplete metadata
|
|
4768
|
+
* shape doesn't spuriously block an otherwise-valid market — only a DEX
|
|
4769
|
+
* whose collateral token positively resolves to something other than
|
|
4770
|
+
* USDC is gated.
|
|
4753
4771
|
*
|
|
4754
4772
|
* @param dexName - The DEX identifier (empty string for main DEX).
|
|
4755
4773
|
* @returns A promise that resolves to the boolean result.
|
|
4756
4774
|
*/
|
|
4757
|
-
async function
|
|
4775
|
+
async function _HyperLiquidProvider_isUsdcCollateralDex(dexName) {
|
|
4758
4776
|
const meta = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getCachedMeta).call(this, { dexName });
|
|
4759
4777
|
const spotMeta = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getCachedSpotMeta).call(this);
|
|
4760
4778
|
const collateralToken = spotMeta.tokens.find((tok) => tok.index === meta.collateralToken);
|
|
4761
|
-
const
|
|
4779
|
+
const isUsdc = !collateralToken || collateralToken.name === USDC_SYMBOL;
|
|
4762
4780
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Checked DEX collateral type', {
|
|
4763
4781
|
dexName,
|
|
4764
4782
|
collateralTokenIndex: meta.collateralToken,
|
|
4765
4783
|
collateralTokenName: collateralToken?.name,
|
|
4766
|
-
|
|
4767
|
-
});
|
|
4768
|
-
return isUsdh;
|
|
4769
|
-
}, _HyperLiquidProvider_getSpotUsdhBalance =
|
|
4770
|
-
/**
|
|
4771
|
-
* Get user's USDH balance in spot wallet
|
|
4772
|
-
*
|
|
4773
|
-
* @returns A promise that resolves to the numeric result.
|
|
4774
|
-
*/
|
|
4775
|
-
async function _HyperLiquidProvider_getSpotUsdhBalance() {
|
|
4776
|
-
const infoClient = __classPrivateFieldGet(this, _HyperLiquidProvider_clientService, "f").getInfoClient();
|
|
4777
|
-
const userAddress = await __classPrivateFieldGet(this, _HyperLiquidProvider_walletService, "f").getUserAddressWithDefault();
|
|
4778
|
-
const spotState = await infoClient.spotClearinghouseState({
|
|
4779
|
-
user: userAddress,
|
|
4780
|
-
});
|
|
4781
|
-
const usdhBalance = spotState.balances.find((b) => b.coin === USDH_CONFIG.TokenName);
|
|
4782
|
-
const balance = usdhBalance ? parseFloat(usdhBalance.total) : 0;
|
|
4783
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Spot USDH balance', {
|
|
4784
|
-
balance,
|
|
4785
|
-
userAddress,
|
|
4786
|
-
});
|
|
4787
|
-
return balance;
|
|
4788
|
-
}, _HyperLiquidProvider_getSpotUsdcBalance =
|
|
4789
|
-
/**
|
|
4790
|
-
* Get user's USDC balance in spot wallet
|
|
4791
|
-
* Required for USDH DEX orders - need USDC in spot to swap to USDH
|
|
4792
|
-
*
|
|
4793
|
-
* @returns A promise that resolves to the numeric result.
|
|
4794
|
-
*/
|
|
4795
|
-
async function _HyperLiquidProvider_getSpotUsdcBalance() {
|
|
4796
|
-
const infoClient = __classPrivateFieldGet(this, _HyperLiquidProvider_clientService, "f").getInfoClient();
|
|
4797
|
-
const userAddress = await __classPrivateFieldGet(this, _HyperLiquidProvider_walletService, "f").getUserAddressWithDefault();
|
|
4798
|
-
const spotState = await infoClient.spotClearinghouseState({
|
|
4799
|
-
user: userAddress,
|
|
4800
|
-
});
|
|
4801
|
-
const usdcBalance = spotState.balances.find((b) => b.coin === 'USDC');
|
|
4802
|
-
const balance = usdcBalance ? parseFloat(usdcBalance.total) : 0;
|
|
4803
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Spot USDC balance', {
|
|
4804
|
-
balance,
|
|
4805
|
-
userAddress,
|
|
4806
|
-
});
|
|
4807
|
-
return balance;
|
|
4808
|
-
}, _HyperLiquidProvider_transferUsdcToSpot =
|
|
4809
|
-
/**
|
|
4810
|
-
* Transfer USDC from main perps wallet to spot wallet
|
|
4811
|
-
* Required before swapping USDC→USDH for USDH DEX orders
|
|
4812
|
-
*
|
|
4813
|
-
* @param amount - The amount value.
|
|
4814
|
-
* @returns A promise that resolves to the result.
|
|
4815
|
-
*/
|
|
4816
|
-
async function _HyperLiquidProvider_transferUsdcToSpot(amount) {
|
|
4817
|
-
const exchangeClient = __classPrivateFieldGet(this, _HyperLiquidProvider_clientService, "f").getExchangeClient();
|
|
4818
|
-
const userAddress = await __classPrivateFieldGet(this, _HyperLiquidProvider_walletService, "f").getUserAddressWithDefault();
|
|
4819
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Transferring USDC to spot', {
|
|
4820
|
-
amount,
|
|
4821
|
-
userAddress,
|
|
4822
|
-
});
|
|
4823
|
-
try {
|
|
4824
|
-
const result = await exchangeClient.sendAsset({
|
|
4825
|
-
destination: userAddress,
|
|
4826
|
-
sourceDex: '', // Main perps DEX (empty string)
|
|
4827
|
-
destinationDex: 'spot',
|
|
4828
|
-
token: await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getUsdcTokenId).call(this),
|
|
4829
|
-
amount: amount.toString(),
|
|
4830
|
-
});
|
|
4831
|
-
if (result.status === 'ok') {
|
|
4832
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: USDC transferred to spot', {
|
|
4833
|
-
amount,
|
|
4834
|
-
});
|
|
4835
|
-
return { success: true };
|
|
4836
|
-
}
|
|
4837
|
-
return { success: false, error: PERPS_ERROR_CODES.TRANSFER_FAILED };
|
|
4838
|
-
}
|
|
4839
|
-
catch (error) {
|
|
4840
|
-
const errorMsg = ensureError(error, 'HyperLiquidProvider.transferUSDCToPerps').message;
|
|
4841
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: USDC transfer to spot failed', {
|
|
4842
|
-
error: errorMsg,
|
|
4843
|
-
});
|
|
4844
|
-
return { success: false, error: errorMsg };
|
|
4845
|
-
}
|
|
4846
|
-
}, _HyperLiquidProvider_swapUsdcToUsdh =
|
|
4847
|
-
/**
|
|
4848
|
-
* Swap USDC to USDH on spot market
|
|
4849
|
-
* Returns the result of the swap including filled size
|
|
4850
|
-
*
|
|
4851
|
-
* @param amount - The amount value.
|
|
4852
|
-
* @returns A promise that resolves to the result.
|
|
4853
|
-
*/
|
|
4854
|
-
async function _HyperLiquidProvider_swapUsdcToUsdh(amount) {
|
|
4855
|
-
const spotMeta = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getCachedSpotMeta).call(this);
|
|
4856
|
-
// Find USDH and USDC tokens by name
|
|
4857
|
-
const usdhToken = spotMeta.tokens.find((tok) => tok.name === USDH_CONFIG.TokenName);
|
|
4858
|
-
const usdcToken = spotMeta.tokens.find((tok) => tok.name === 'USDC');
|
|
4859
|
-
if (!usdhToken || !usdcToken) {
|
|
4860
|
-
return {
|
|
4861
|
-
success: false,
|
|
4862
|
-
error: PERPS_ERROR_CODES.SPOT_PAIR_NOT_FOUND,
|
|
4863
|
-
};
|
|
4864
|
-
}
|
|
4865
|
-
// Find USDH/USDC pair by token indices (NOT by name - name is @230)
|
|
4866
|
-
const usdhUsdcPair = spotMeta.universe.find((univ) => univ.tokens.includes(usdhToken.index) &&
|
|
4867
|
-
univ.tokens.includes(usdcToken.index));
|
|
4868
|
-
if (!usdhUsdcPair) {
|
|
4869
|
-
return { success: false, error: PERPS_ERROR_CODES.SPOT_PAIR_NOT_FOUND };
|
|
4870
|
-
}
|
|
4871
|
-
const spotAssetId = SPOT_ASSET_ID_OFFSET + usdhUsdcPair.index;
|
|
4872
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Found USDH/USDC spot pair', {
|
|
4873
|
-
pairIndex: usdhUsdcPair.index,
|
|
4874
|
-
pairName: usdhUsdcPair.name,
|
|
4875
|
-
spotAssetId,
|
|
4876
|
-
usdhTokenIndex: usdhToken.index,
|
|
4877
|
-
usdcTokenIndex: usdcToken.index,
|
|
4878
|
-
});
|
|
4879
|
-
// Get current mid price
|
|
4880
|
-
const infoClient = __classPrivateFieldGet(this, _HyperLiquidProvider_clientService, "f").getInfoClient();
|
|
4881
|
-
const allMids = await infoClient.allMids();
|
|
4882
|
-
const pairKey = `@${usdhUsdcPair.index}`;
|
|
4883
|
-
const usdhPrice = parseFloat(allMids[pairKey] || '1');
|
|
4884
|
-
if (usdhPrice === 0) {
|
|
4885
|
-
return {
|
|
4886
|
-
success: false,
|
|
4887
|
-
error: PERPS_ERROR_CODES.PRICE_UNAVAILABLE,
|
|
4888
|
-
};
|
|
4889
|
-
}
|
|
4890
|
-
// Calculate order parameters
|
|
4891
|
-
// USDH is pegged 1:1 to USDC, add small slippage buffer
|
|
4892
|
-
const slippageMultiplier = 1 + USDH_CONFIG.SwapSlippageBps / BASIS_POINTS_DIVISOR;
|
|
4893
|
-
const maxPrice = usdhPrice * slippageMultiplier;
|
|
4894
|
-
// Size in USDH = amount / price (since we're buying USDH with USDC)
|
|
4895
|
-
let sizeInUsdh = amount / usdhPrice;
|
|
4896
|
-
// Format size according to HyperLiquid requirements
|
|
4897
|
-
let formattedSize = sizeInUsdh.toFixed(usdhToken.szDecimals);
|
|
4898
|
-
// CRITICAL: Ensure USDC cost meets $10 minimum after rounding
|
|
4899
|
-
// At price ~0.999995, buying 10.00 USDH costs 9.99995 USDC (under minimum)
|
|
4900
|
-
// Bump up by one increment if needed to meet minimum
|
|
4901
|
-
const minSpotOrderValue = TRADING_DEFAULTS.amount.mainnet;
|
|
4902
|
-
const estimatedCost = parseFloat(formattedSize) * usdhPrice;
|
|
4903
|
-
if (estimatedCost < minSpotOrderValue) {
|
|
4904
|
-
const increment = Math.pow(10, -usdhToken.szDecimals); // 0.01 for szDecimals=2
|
|
4905
|
-
sizeInUsdh = parseFloat(formattedSize) + increment;
|
|
4906
|
-
formattedSize = sizeInUsdh.toFixed(usdhToken.szDecimals);
|
|
4907
|
-
}
|
|
4908
|
-
// Format price according to HyperLiquid requirements
|
|
4909
|
-
const formattedPrice = formatHyperLiquidPrice({
|
|
4910
|
-
price: maxPrice,
|
|
4911
|
-
szDecimals: usdhToken.szDecimals,
|
|
4912
|
-
});
|
|
4913
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Placing USDC→USDH swap order', {
|
|
4914
|
-
usdcAmount: amount,
|
|
4915
|
-
usdhPrice,
|
|
4916
|
-
maxPrice: formattedPrice,
|
|
4917
|
-
size: formattedSize,
|
|
4918
|
-
szDecimals: usdhToken.szDecimals,
|
|
4919
|
-
});
|
|
4920
|
-
try {
|
|
4921
|
-
const exchangeClient = __classPrivateFieldGet(this, _HyperLiquidProvider_clientService, "f").getExchangeClient();
|
|
4922
|
-
const result = await exchangeClient.order({
|
|
4923
|
-
orders: [
|
|
4924
|
-
{
|
|
4925
|
-
a: spotAssetId,
|
|
4926
|
-
b: true, // Buy USDH
|
|
4927
|
-
p: formattedPrice,
|
|
4928
|
-
s: formattedSize,
|
|
4929
|
-
r: false, // Not reduce-only
|
|
4930
|
-
t: { limit: { tif: 'Ioc' } }, // Immediate-or-cancel
|
|
4931
|
-
},
|
|
4932
|
-
],
|
|
4933
|
-
grouping: 'na',
|
|
4934
|
-
});
|
|
4935
|
-
if (result.status !== 'ok') {
|
|
4936
|
-
return {
|
|
4937
|
-
success: false,
|
|
4938
|
-
error: PERPS_ERROR_CODES.SWAP_FAILED,
|
|
4939
|
-
};
|
|
4940
|
-
}
|
|
4941
|
-
// Check order status
|
|
4942
|
-
const status = result.response?.data?.statuses?.[0];
|
|
4943
|
-
if (isStatusObject(status) && hasProperty(status, 'error')) {
|
|
4944
|
-
return { success: false, error: String(status.error) };
|
|
4945
|
-
}
|
|
4946
|
-
// Note: `in` narrows the HyperLiquid SDK discriminated union to the
|
|
4947
|
-
// branch that has `filled`; `hasProperty` only narrows the key and
|
|
4948
|
-
// types `status.filled` as `unknown`, which loses access to `.totalSz`.
|
|
4949
|
-
/* eslint-disable no-restricted-syntax */
|
|
4950
|
-
const filledSize = isStatusObject(status) && 'filled' in status
|
|
4951
|
-
? parseFloat(status.filled?.totalSz ?? '0')
|
|
4952
|
-
: 0;
|
|
4953
|
-
/* eslint-enable no-restricted-syntax */
|
|
4954
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: USDC→USDH swap completed', {
|
|
4955
|
-
success: true,
|
|
4956
|
-
filledSize,
|
|
4957
|
-
requestedSize: formattedSize,
|
|
4958
|
-
});
|
|
4959
|
-
return { success: true, filledSize };
|
|
4960
|
-
}
|
|
4961
|
-
catch (error) {
|
|
4962
|
-
const errorMsg = ensureError(error, 'HyperLiquidProvider.swapUSDCToUSDH').message;
|
|
4963
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: USDC→USDH swap error', {
|
|
4964
|
-
error: errorMsg,
|
|
4965
|
-
});
|
|
4966
|
-
return { success: false, error: errorMsg };
|
|
4967
|
-
}
|
|
4968
|
-
}, _HyperLiquidProvider_ensureUsdhCollateralForOrder =
|
|
4969
|
-
/**
|
|
4970
|
-
* Ensure sufficient USDH collateral in spot for HIP-3 DEX order
|
|
4971
|
-
* If user lacks USDH, auto-swap from USDC
|
|
4972
|
-
*
|
|
4973
|
-
* @param dexName - The DEX identifier (empty string for main DEX).
|
|
4974
|
-
* @param requiredMargin - The required margin amount.
|
|
4975
|
-
*/
|
|
4976
|
-
async function _HyperLiquidProvider_ensureUsdhCollateralForOrder(dexName, requiredMargin) {
|
|
4977
|
-
const spotUsdhBalance = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getSpotUsdhBalance).call(this);
|
|
4978
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Checking USDH collateral', {
|
|
4979
|
-
dexName,
|
|
4980
|
-
requiredMargin,
|
|
4981
|
-
spotUsdhBalance,
|
|
4982
|
-
});
|
|
4983
|
-
if (spotUsdhBalance >= requiredMargin) {
|
|
4984
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Sufficient USDH in spot');
|
|
4985
|
-
return;
|
|
4986
|
-
}
|
|
4987
|
-
const shortfall = requiredMargin - spotUsdhBalance;
|
|
4988
|
-
// HyperLiquid spot has $10 minimum order value
|
|
4989
|
-
const minSpotOrderValue = TRADING_DEFAULTS.amount.mainnet;
|
|
4990
|
-
// If user has some USDH already, we can swap just the shortfall (if >= $10)
|
|
4991
|
-
// If user has zero USDH, they need at least $10 for first swap
|
|
4992
|
-
const swapAmount = spotUsdhBalance > 0 && shortfall >= minSpotOrderValue
|
|
4993
|
-
? shortfall
|
|
4994
|
-
: Math.max(shortfall, minSpotOrderValue);
|
|
4995
|
-
// Step 1: Check spot USDC balance
|
|
4996
|
-
const spotUsdcBalance = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_getSpotUsdcBalance).call(this);
|
|
4997
|
-
// Calculate total available USDC (spot + what we can transfer from perps)
|
|
4998
|
-
// For now, check if we have enough in spot first
|
|
4999
|
-
const totalUsdcNeeded = swapAmount - spotUsdcBalance;
|
|
5000
|
-
// Step 2: If insufficient USDC in spot, transfer from main perps
|
|
5001
|
-
if (spotUsdcBalance < swapAmount) {
|
|
5002
|
-
const transferAmount = totalUsdcNeeded;
|
|
5003
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Transferring USDC to spot for swap', {
|
|
5004
|
-
spotUsdcBalance,
|
|
5005
|
-
swapAmount,
|
|
5006
|
-
transferAmount,
|
|
5007
|
-
});
|
|
5008
|
-
const transferResult = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_transferUsdcToSpot).call(this, transferAmount);
|
|
5009
|
-
if (!transferResult.success) {
|
|
5010
|
-
// Provide user-friendly error for insufficient funds
|
|
5011
|
-
if (transferResult.error?.includes('Insufficient balance')) {
|
|
5012
|
-
throw new Error(`Insufficient USDC balance. Need $${swapAmount.toFixed(2)} for USDH swap but transfer failed. Please deposit more USDC to your HyperLiquid account.`);
|
|
5013
|
-
}
|
|
5014
|
-
throw new Error(`Failed to transfer USDC to spot: ${transferResult.error}`);
|
|
5015
|
-
}
|
|
5016
|
-
}
|
|
5017
|
-
// Step 3: Swap USDC → USDH
|
|
5018
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Swapping USDC→USDH for collateral', {
|
|
5019
|
-
shortfall,
|
|
5020
|
-
swapAmount,
|
|
5021
|
-
minOrderValue: minSpotOrderValue,
|
|
5022
|
-
});
|
|
5023
|
-
const swapResult = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_swapUsdcToUsdh).call(this, swapAmount);
|
|
5024
|
-
if (!swapResult.success) {
|
|
5025
|
-
throw new Error(`Failed to acquire USDH collateral for ${dexName}: ${swapResult.error}`);
|
|
5026
|
-
}
|
|
5027
|
-
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: USDH collateral acquired', {
|
|
5028
|
-
dexName,
|
|
5029
|
-
filledSize: swapResult.filledSize,
|
|
4784
|
+
isUsdc,
|
|
5030
4785
|
});
|
|
4786
|
+
return isUsdc;
|
|
5031
4787
|
}, _HyperLiquidProvider_buildAssetMapping =
|
|
5032
4788
|
/**
|
|
5033
4789
|
* Build asset ID mapping from market metadata
|
|
@@ -5847,26 +5603,19 @@ async function _HyperLiquidProvider_prepareAssetForTrading(params) {
|
|
|
5847
5603
|
*/
|
|
5848
5604
|
async function _HyperLiquidProvider_handleHip3PreOrder(params) {
|
|
5849
5605
|
const { dexName, symbol, orderPrice, positionSize, leverage, isBuy } = params;
|
|
5850
|
-
//
|
|
5851
|
-
//
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5606
|
+
// TAT-3304: Only USDC-collateral HIP-3 DEXs are supported for trading.
|
|
5607
|
+
// Following the USDH sunset, reject orders on any non-USDC-collateral
|
|
5608
|
+
// DEX here instead of attempting the (now-removed) USDH auto-swap path.
|
|
5609
|
+
// Market discovery (#fetchMarketsForDex) already filters such DEXs out,
|
|
5610
|
+
// so this is a defense-in-depth check against stale caches or a
|
|
5611
|
+
// misconfigured allowlist entry.
|
|
5612
|
+
const isUsdcDex = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_isUsdcCollateralDex).call(this, dexName);
|
|
5613
|
+
if (!isUsdcDex) {
|
|
5614
|
+
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('HyperLiquidProvider: Rejecting order for non-USDC-collateral DEX', {
|
|
5855
5615
|
dexName,
|
|
5856
5616
|
symbol,
|
|
5857
5617
|
});
|
|
5858
|
-
|
|
5859
|
-
const requiredMargin = await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_calculateHip3RequiredMargin).call(this, {
|
|
5860
|
-
symbol,
|
|
5861
|
-
dexName,
|
|
5862
|
-
positionSize,
|
|
5863
|
-
orderPrice,
|
|
5864
|
-
leverage,
|
|
5865
|
-
isBuy,
|
|
5866
|
-
});
|
|
5867
|
-
await __classPrivateFieldGet(this, _HyperLiquidProvider_instances, "m", _HyperLiquidProvider_ensureUsdhCollateralForOrder).call(this, dexName, requiredMargin);
|
|
5868
|
-
// Unified Account will pull USDH from spot automatically
|
|
5869
|
-
return { transferInfo: null };
|
|
5618
|
+
throw new Error(PERPS_ERROR_CODES.UNSUPPORTED_COLLATERAL);
|
|
5870
5619
|
}
|
|
5871
5620
|
if (__classPrivateFieldGet(this, _HyperLiquidProvider_useUnifiedAccount, "f")) {
|
|
5872
5621
|
__classPrivateFieldGet(this, _HyperLiquidProvider_deps, "f").debugLogger.log('Using Unified Account (no manual transfer)', {
|