@metamask-previews/perps-controller 0.0.0-preview-685dbf46b → 1.0.0-preview-bc00f2c
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 +30 -2
- package/dist/PerpsController.cjs +3077 -65
- package/dist/PerpsController.cjs.map +1 -1
- package/dist/PerpsController.d.cts +969 -82
- package/dist/PerpsController.d.cts.map +1 -1
- package/dist/PerpsController.d.mts +969 -82
- package/dist/PerpsController.d.mts.map +1 -1
- package/dist/PerpsController.mjs +3073 -62
- package/dist/PerpsController.mjs.map +1 -1
- package/dist/aggregation/SubscriptionMultiplexer.cjs +441 -0
- package/dist/aggregation/SubscriptionMultiplexer.cjs.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.cts +171 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.mts +171 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.mjs +437 -0
- package/dist/aggregation/SubscriptionMultiplexer.mjs.map +1 -0
- package/dist/aggregation/index.cjs +9 -0
- package/dist/aggregation/index.cjs.map +1 -0
- package/dist/aggregation/index.d.cts +6 -0
- package/dist/aggregation/index.d.cts.map +1 -0
- package/dist/aggregation/index.d.mts +6 -0
- package/dist/aggregation/index.d.mts.map +1 -0
- package/dist/aggregation/index.mjs +5 -0
- package/dist/aggregation/index.mjs.map +1 -0
- package/dist/constants/chartConfig.cjs +227 -0
- package/dist/constants/chartConfig.cjs.map +1 -0
- package/dist/constants/chartConfig.d.cts +216 -0
- package/dist/constants/chartConfig.d.cts.map +1 -0
- package/dist/constants/chartConfig.d.mts +216 -0
- package/dist/constants/chartConfig.d.mts.map +1 -0
- package/dist/constants/chartConfig.mjs +221 -0
- package/dist/constants/chartConfig.mjs.map +1 -0
- package/dist/constants/eventNames.cjs +436 -0
- package/dist/constants/eventNames.cjs.map +1 -0
- package/dist/constants/eventNames.d.cts +387 -0
- package/dist/constants/eventNames.d.cts.map +1 -0
- package/dist/constants/eventNames.d.mts +387 -0
- package/dist/constants/eventNames.d.mts.map +1 -0
- package/dist/constants/eventNames.mjs +433 -0
- package/dist/constants/eventNames.mjs.map +1 -0
- package/dist/constants/hyperLiquidConfig.cjs +380 -0
- package/dist/constants/hyperLiquidConfig.cjs.map +1 -0
- package/dist/constants/hyperLiquidConfig.d.cts +236 -0
- package/dist/constants/hyperLiquidConfig.d.cts.map +1 -0
- package/dist/constants/hyperLiquidConfig.d.mts +236 -0
- package/dist/constants/hyperLiquidConfig.d.mts.map +1 -0
- package/dist/constants/hyperLiquidConfig.mjs +371 -0
- package/dist/constants/hyperLiquidConfig.mjs.map +1 -0
- package/dist/constants/index.cjs +28 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +12 -0
- package/dist/constants/index.d.cts.map +1 -0
- package/dist/constants/index.d.mts +12 -0
- package/dist/constants/index.d.mts.map +1 -0
- package/dist/constants/index.mjs +12 -0
- package/dist/constants/index.mjs.map +1 -0
- package/dist/constants/myxConfig.cjs +229 -0
- package/dist/constants/myxConfig.cjs.map +1 -0
- package/dist/constants/myxConfig.d.cts +106 -0
- package/dist/constants/myxConfig.d.cts.map +1 -0
- package/dist/constants/myxConfig.d.mts +106 -0
- package/dist/constants/myxConfig.d.mts.map +1 -0
- package/dist/constants/myxConfig.mjs +219 -0
- package/dist/constants/myxConfig.mjs.map +1 -0
- package/dist/constants/orderTypes.cjs +31 -0
- package/dist/constants/orderTypes.cjs.map +1 -0
- package/dist/constants/orderTypes.d.cts +19 -0
- package/dist/constants/orderTypes.d.cts.map +1 -0
- package/dist/constants/orderTypes.d.mts +19 -0
- package/dist/constants/orderTypes.d.mts.map +1 -0
- package/dist/constants/orderTypes.mjs +27 -0
- package/dist/constants/orderTypes.mjs.map +1 -0
- package/dist/constants/performanceMetrics.cjs +63 -0
- package/dist/constants/performanceMetrics.cjs.map +1 -0
- package/dist/constants/performanceMetrics.d.cts +46 -0
- package/dist/constants/performanceMetrics.d.cts.map +1 -0
- package/dist/constants/performanceMetrics.d.mts +46 -0
- package/dist/constants/performanceMetrics.d.mts.map +1 -0
- package/dist/constants/performanceMetrics.mjs +60 -0
- package/dist/constants/performanceMetrics.mjs.map +1 -0
- package/dist/constants/perpsConfig.cjs +295 -0
- package/dist/constants/perpsConfig.cjs.map +1 -0
- package/dist/constants/perpsConfig.d.cts +221 -0
- package/dist/constants/perpsConfig.d.cts.map +1 -0
- package/dist/constants/perpsConfig.d.mts +221 -0
- package/dist/constants/perpsConfig.d.mts.map +1 -0
- package/dist/constants/perpsConfig.mjs +292 -0
- package/dist/constants/perpsConfig.mjs.map +1 -0
- package/dist/constants/transactionsHistoryConfig.cjs +19 -0
- package/dist/constants/transactionsHistoryConfig.cjs.map +1 -0
- package/dist/constants/transactionsHistoryConfig.d.cts +16 -0
- package/dist/constants/transactionsHistoryConfig.d.cts.map +1 -0
- package/dist/constants/transactionsHistoryConfig.d.mts +16 -0
- package/dist/constants/transactionsHistoryConfig.d.mts.map +1 -0
- package/dist/constants/transactionsHistoryConfig.mjs +16 -0
- package/dist/constants/transactionsHistoryConfig.mjs.map +1 -0
- package/dist/index.cjs +63 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +38 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +46 -1
- package/dist/index.mjs.map +1 -1
- package/dist/perpsErrorCodes.cjs +80 -0
- package/dist/perpsErrorCodes.cjs.map +1 -0
- package/dist/perpsErrorCodes.d.cts +65 -0
- package/dist/perpsErrorCodes.d.cts.map +1 -0
- package/dist/perpsErrorCodes.d.mts +65 -0
- package/dist/perpsErrorCodes.d.mts.map +1 -0
- package/dist/perpsErrorCodes.mjs +77 -0
- package/dist/perpsErrorCodes.mjs.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.cjs +508 -0
- package/dist/providers/AggregatedPerpsProvider.cjs.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.d.cts +171 -0
- package/dist/providers/AggregatedPerpsProvider.d.cts.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.d.mts +171 -0
- package/dist/providers/AggregatedPerpsProvider.d.mts.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.mjs +504 -0
- package/dist/providers/AggregatedPerpsProvider.mjs.map +1 -0
- package/dist/providers/HyperLiquidProvider.cjs +5679 -0
- package/dist/providers/HyperLiquidProvider.cjs.map +1 -0
- package/dist/providers/HyperLiquidProvider.d.cts +516 -0
- package/dist/providers/HyperLiquidProvider.d.cts.map +1 -0
- package/dist/providers/HyperLiquidProvider.d.mts +516 -0
- package/dist/providers/HyperLiquidProvider.d.mts.map +1 -0
- package/dist/providers/HyperLiquidProvider.mjs +5675 -0
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -0
- package/dist/providers/MYXProvider.cjs +514 -0
- package/dist/providers/MYXProvider.cjs.map +1 -0
- package/dist/providers/MYXProvider.d.cts +105 -0
- package/dist/providers/MYXProvider.d.cts.map +1 -0
- package/dist/providers/MYXProvider.d.mts +105 -0
- package/dist/providers/MYXProvider.d.mts.map +1 -0
- package/dist/providers/MYXProvider.mjs +510 -0
- package/dist/providers/MYXProvider.mjs.map +1 -0
- package/dist/routing/ProviderRouter.cjs +154 -0
- package/dist/routing/ProviderRouter.cjs.map +1 -0
- package/dist/routing/ProviderRouter.d.cts +112 -0
- package/dist/routing/ProviderRouter.d.cts.map +1 -0
- package/dist/routing/ProviderRouter.d.mts +112 -0
- package/dist/routing/ProviderRouter.d.mts.map +1 -0
- package/dist/routing/ProviderRouter.mjs +150 -0
- package/dist/routing/ProviderRouter.mjs.map +1 -0
- package/dist/routing/index.cjs +9 -0
- package/dist/routing/index.cjs.map +1 -0
- package/dist/routing/index.d.cts +6 -0
- package/dist/routing/index.d.cts.map +1 -0
- package/dist/routing/index.d.mts +6 -0
- package/dist/routing/index.d.mts.map +1 -0
- package/dist/routing/index.mjs +5 -0
- package/dist/routing/index.mjs.map +1 -0
- package/dist/selectors.cjs +166 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +362 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +362 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/selectors.mjs +158 -0
- package/dist/selectors.mjs.map +1 -0
- package/dist/services/AccountService.cjs +324 -0
- package/dist/services/AccountService.cjs.map +1 -0
- package/dist/services/AccountService.d.cts +56 -0
- package/dist/services/AccountService.d.cts.map +1 -0
- package/dist/services/AccountService.d.mts +56 -0
- package/dist/services/AccountService.d.mts.map +1 -0
- package/dist/services/AccountService.mjs +320 -0
- package/dist/services/AccountService.mjs.map +1 -0
- package/dist/services/DataLakeService.cjs +233 -0
- package/dist/services/DataLakeService.cjs.map +1 -0
- package/dist/services/DataLakeService.d.cts +51 -0
- package/dist/services/DataLakeService.d.cts.map +1 -0
- package/dist/services/DataLakeService.d.mts +51 -0
- package/dist/services/DataLakeService.d.mts.map +1 -0
- package/dist/services/DataLakeService.mjs +229 -0
- package/dist/services/DataLakeService.mjs.map +1 -0
- package/dist/services/DepositService.cjs +98 -0
- package/dist/services/DepositService.cjs.map +1 -0
- package/dist/services/DepositService.d.cts +39 -0
- package/dist/services/DepositService.d.cts.map +1 -0
- package/dist/services/DepositService.d.mts +39 -0
- package/dist/services/DepositService.d.mts.map +1 -0
- package/dist/services/DepositService.mjs +94 -0
- package/dist/services/DepositService.mjs.map +1 -0
- package/dist/services/EligibilityService.cjs +173 -0
- package/dist/services/EligibilityService.cjs.map +1 -0
- package/dist/services/EligibilityService.d.cts +39 -0
- package/dist/services/EligibilityService.d.cts.map +1 -0
- package/dist/services/EligibilityService.d.mts +39 -0
- package/dist/services/EligibilityService.d.mts.map +1 -0
- package/dist/services/EligibilityService.mjs +169 -0
- package/dist/services/EligibilityService.mjs.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.cjs +257 -0
- package/dist/services/FeatureFlagConfigurationService.cjs.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.d.cts +73 -0
- package/dist/services/FeatureFlagConfigurationService.d.cts.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.d.mts +73 -0
- package/dist/services/FeatureFlagConfigurationService.d.mts.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.mjs +253 -0
- package/dist/services/FeatureFlagConfigurationService.mjs.map +1 -0
- package/dist/services/HyperLiquidClientService.cjs +867 -0
- package/dist/services/HyperLiquidClientService.cjs.map +1 -0
- package/dist/services/HyperLiquidClientService.d.cts +214 -0
- package/dist/services/HyperLiquidClientService.d.cts.map +1 -0
- package/dist/services/HyperLiquidClientService.d.mts +214 -0
- package/dist/services/HyperLiquidClientService.d.mts.map +1 -0
- package/dist/services/HyperLiquidClientService.mjs +862 -0
- package/dist/services/HyperLiquidClientService.mjs.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.cjs +2199 -0
- package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.d.cts +187 -0
- package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.d.mts +187 -0
- package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.mjs +2195 -0
- package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -0
- package/dist/services/HyperLiquidWalletService.cjs +163 -0
- package/dist/services/HyperLiquidWalletService.cjs.map +1 -0
- package/dist/services/HyperLiquidWalletService.d.cts +78 -0
- package/dist/services/HyperLiquidWalletService.d.cts.map +1 -0
- package/dist/services/HyperLiquidWalletService.d.mts +78 -0
- package/dist/services/HyperLiquidWalletService.d.mts.map +1 -0
- package/dist/services/HyperLiquidWalletService.mjs +159 -0
- package/dist/services/HyperLiquidWalletService.mjs.map +1 -0
- package/dist/services/MYXClientService.cjs +304 -0
- package/dist/services/MYXClientService.cjs.map +1 -0
- package/dist/services/MYXClientService.d.cts +81 -0
- package/dist/services/MYXClientService.d.cts.map +1 -0
- package/dist/services/MYXClientService.d.mts +81 -0
- package/dist/services/MYXClientService.d.mts.map +1 -0
- package/dist/services/MYXClientService.mjs +300 -0
- package/dist/services/MYXClientService.mjs.map +1 -0
- package/dist/services/MarketDataService.cjs +848 -0
- package/dist/services/MarketDataService.cjs.map +1 -0
- package/dist/services/MarketDataService.d.cts +291 -0
- package/dist/services/MarketDataService.d.cts.map +1 -0
- package/dist/services/MarketDataService.d.mts +291 -0
- package/dist/services/MarketDataService.d.mts.map +1 -0
- package/dist/services/MarketDataService.mjs +844 -0
- package/dist/services/MarketDataService.mjs.map +1 -0
- package/dist/services/RewardsIntegrationService.cjs +120 -0
- package/dist/services/RewardsIntegrationService.cjs.map +1 -0
- package/dist/services/RewardsIntegrationService.d.cts +28 -0
- package/dist/services/RewardsIntegrationService.d.cts.map +1 -0
- package/dist/services/RewardsIntegrationService.d.mts +28 -0
- package/dist/services/RewardsIntegrationService.d.mts.map +1 -0
- package/dist/services/RewardsIntegrationService.mjs +116 -0
- package/dist/services/RewardsIntegrationService.mjs.map +1 -0
- package/dist/services/ServiceContext.cjs +3 -0
- package/dist/services/ServiceContext.cjs.map +1 -0
- package/dist/services/ServiceContext.d.cts +86 -0
- package/dist/services/ServiceContext.d.cts.map +1 -0
- package/dist/services/ServiceContext.d.mts +86 -0
- package/dist/services/ServiceContext.d.mts.map +1 -0
- package/dist/services/ServiceContext.mjs +2 -0
- package/dist/services/ServiceContext.mjs.map +1 -0
- package/dist/services/TradingReadinessCache.cjs +288 -0
- package/dist/services/TradingReadinessCache.cjs.map +1 -0
- package/dist/services/TradingReadinessCache.d.cts +174 -0
- package/dist/services/TradingReadinessCache.d.cts.map +1 -0
- package/dist/services/TradingReadinessCache.d.mts +174 -0
- package/dist/services/TradingReadinessCache.d.mts.map +1 -0
- package/dist/services/TradingReadinessCache.mjs +285 -0
- package/dist/services/TradingReadinessCache.mjs.map +1 -0
- package/dist/services/TradingService.cjs +1457 -0
- package/dist/services/TradingService.cjs.map +1 -0
- package/dist/services/TradingService.d.cts +195 -0
- package/dist/services/TradingService.d.cts.map +1 -0
- package/dist/services/TradingService.d.mts +195 -0
- package/dist/services/TradingService.d.mts.map +1 -0
- package/dist/services/TradingService.mjs +1453 -0
- package/dist/services/TradingService.mjs.map +1 -0
- package/dist/types/config.cjs +3 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +49 -0
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/config.d.mts +49 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +2 -0
- package/dist/types/config.mjs.map +1 -0
- package/dist/types/hyperliquid-types.cjs +3 -0
- package/dist/types/hyperliquid-types.cjs.map +1 -0
- package/dist/types/hyperliquid-types.d.cts +20 -0
- package/dist/types/hyperliquid-types.d.cts.map +1 -0
- package/dist/types/hyperliquid-types.d.mts +20 -0
- package/dist/types/hyperliquid-types.d.mts.map +1 -0
- package/dist/types/hyperliquid-types.mjs +2 -0
- package/dist/types/hyperliquid-types.mjs.map +1 -0
- package/dist/types/index.cjs +115 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +1262 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +1262 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +97 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/messenger.cjs +3 -0
- package/dist/types/messenger.cjs.map +1 -0
- package/dist/types/messenger.d.cts +27 -0
- package/dist/types/messenger.d.cts.map +1 -0
- package/dist/types/messenger.d.mts +27 -0
- package/dist/types/messenger.d.mts.map +1 -0
- package/dist/types/messenger.mjs +2 -0
- package/dist/types/messenger.mjs.map +1 -0
- package/dist/types/myx-types.cjs +25 -0
- package/dist/types/myx-types.cjs.map +1 -0
- package/dist/types/myx-types.d.cts +63 -0
- package/dist/types/myx-types.d.cts.map +1 -0
- package/dist/types/myx-types.d.mts +63 -0
- package/dist/types/myx-types.d.mts.map +1 -0
- package/dist/types/myx-types.mjs +22 -0
- package/dist/types/myx-types.mjs.map +1 -0
- package/dist/types/perps-types.cjs +4 -0
- package/dist/types/perps-types.cjs.map +1 -0
- package/dist/types/perps-types.d.cts +105 -0
- package/dist/types/perps-types.d.cts.map +1 -0
- package/dist/types/perps-types.d.mts +105 -0
- package/dist/types/perps-types.d.mts.map +1 -0
- package/dist/types/perps-types.mjs +2 -0
- package/dist/types/perps-types.mjs.map +1 -0
- package/dist/types/token.cjs +3 -0
- package/dist/types/token.cjs.map +1 -0
- package/dist/types/token.d.cts +25 -0
- package/dist/types/token.d.cts.map +1 -0
- package/dist/types/token.d.mts +25 -0
- package/dist/types/token.d.mts.map +1 -0
- package/dist/types/token.mjs +2 -0
- package/dist/types/token.mjs.map +1 -0
- package/dist/types/transactionTypes.cjs +28 -0
- package/dist/types/transactionTypes.cjs.map +1 -0
- package/dist/types/transactionTypes.d.cts +64 -0
- package/dist/types/transactionTypes.d.cts.map +1 -0
- package/dist/types/transactionTypes.d.mts +64 -0
- package/dist/types/transactionTypes.d.mts.map +1 -0
- package/dist/types/transactionTypes.mjs +23 -0
- package/dist/types/transactionTypes.mjs.map +1 -0
- package/dist/utils/accountUtils.cjs +100 -0
- package/dist/utils/accountUtils.cjs.map +1 -0
- package/dist/utils/accountUtils.d.cts +30 -0
- package/dist/utils/accountUtils.d.cts.map +1 -0
- package/dist/utils/accountUtils.d.mts +30 -0
- package/dist/utils/accountUtils.d.mts.map +1 -0
- package/dist/utils/accountUtils.mjs +92 -0
- package/dist/utils/accountUtils.mjs.map +1 -0
- package/dist/utils/errorUtils.cjs +35 -0
- package/dist/utils/errorUtils.cjs.map +1 -0
- package/dist/utils/errorUtils.d.cts +15 -0
- package/dist/utils/errorUtils.d.cts.map +1 -0
- package/dist/utils/errorUtils.d.mts +15 -0
- package/dist/utils/errorUtils.d.mts.map +1 -0
- package/dist/utils/errorUtils.mjs +31 -0
- package/dist/utils/errorUtils.mjs.map +1 -0
- package/dist/utils/hyperLiquidAdapter.cjs +331 -0
- package/dist/utils/hyperLiquidAdapter.cjs.map +1 -0
- package/dist/utils/hyperLiquidAdapter.d.cts +42 -0
- package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -0
- package/dist/utils/hyperLiquidAdapter.d.mts +42 -0
- package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -0
- package/dist/utils/hyperLiquidAdapter.mjs +316 -0
- package/dist/utils/hyperLiquidAdapter.mjs.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs +83 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +55 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +55 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs +78 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +1 -0
- package/dist/utils/hyperLiquidValidation.cjs +426 -0
- package/dist/utils/hyperLiquidValidation.cjs.map +1 -0
- package/dist/utils/hyperLiquidValidation.d.cts +143 -0
- package/dist/utils/hyperLiquidValidation.d.cts.map +1 -0
- package/dist/utils/hyperLiquidValidation.d.mts +143 -0
- package/dist/utils/hyperLiquidValidation.d.mts.map +1 -0
- package/dist/utils/hyperLiquidValidation.mjs +413 -0
- package/dist/utils/hyperLiquidValidation.mjs.map +1 -0
- package/dist/utils/idUtils.cjs +18 -0
- package/dist/utils/idUtils.cjs.map +1 -0
- package/dist/utils/idUtils.d.cts +6 -0
- package/dist/utils/idUtils.d.cts.map +1 -0
- package/dist/utils/idUtils.d.mts +6 -0
- package/dist/utils/idUtils.d.mts.map +1 -0
- package/dist/utils/idUtils.mjs +10 -0
- package/dist/utils/idUtils.mjs.map +1 -0
- package/dist/utils/index.cjs +59 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +25 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +25 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +30 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/marketDataTransform.cjs +211 -0
- package/dist/utils/marketDataTransform.cjs.map +1 -0
- package/dist/utils/marketDataTransform.d.cts +40 -0
- package/dist/utils/marketDataTransform.d.cts.map +1 -0
- package/dist/utils/marketDataTransform.d.mts +40 -0
- package/dist/utils/marketDataTransform.d.mts.map +1 -0
- package/dist/utils/marketDataTransform.mjs +205 -0
- package/dist/utils/marketDataTransform.mjs.map +1 -0
- package/dist/utils/marketUtils.cjs +151 -0
- package/dist/utils/marketUtils.cjs.map +1 -0
- package/dist/utils/marketUtils.d.cts +30 -0
- package/dist/utils/marketUtils.d.cts.map +1 -0
- package/dist/utils/marketUtils.d.mts +30 -0
- package/dist/utils/marketUtils.d.mts.map +1 -0
- package/dist/utils/marketUtils.mjs +138 -0
- package/dist/utils/marketUtils.mjs.map +1 -0
- package/dist/utils/myxAdapter.cjs +224 -0
- package/dist/utils/myxAdapter.cjs.map +1 -0
- package/dist/utils/myxAdapter.d.cts +81 -0
- package/dist/utils/myxAdapter.d.cts.map +1 -0
- package/dist/utils/myxAdapter.d.mts +81 -0
- package/dist/utils/myxAdapter.d.mts.map +1 -0
- package/dist/utils/myxAdapter.mjs +213 -0
- package/dist/utils/myxAdapter.mjs.map +1 -0
- package/dist/utils/orderCalculations.cjs +283 -0
- package/dist/utils/orderCalculations.cjs.map +1 -0
- package/dist/utils/orderCalculations.d.cts +107 -0
- package/dist/utils/orderCalculations.d.cts.map +1 -0
- package/dist/utils/orderCalculations.d.mts +107 -0
- package/dist/utils/orderCalculations.d.mts.map +1 -0
- package/dist/utils/orderCalculations.mjs +274 -0
- package/dist/utils/orderCalculations.mjs.map +1 -0
- package/dist/utils/rewardsUtils.cjs +98 -0
- package/dist/utils/rewardsUtils.cjs.map +1 -0
- package/dist/utils/rewardsUtils.d.cts +33 -0
- package/dist/utils/rewardsUtils.d.cts.map +1 -0
- package/dist/utils/rewardsUtils.d.mts +33 -0
- package/dist/utils/rewardsUtils.d.mts.map +1 -0
- package/dist/utils/rewardsUtils.mjs +92 -0
- package/dist/utils/rewardsUtils.mjs.map +1 -0
- package/dist/utils/significantFigures.cjs +88 -0
- package/dist/utils/significantFigures.cjs.map +1 -0
- package/dist/utils/significantFigures.d.cts +25 -0
- package/dist/utils/significantFigures.d.cts.map +1 -0
- package/dist/utils/significantFigures.d.mts +25 -0
- package/dist/utils/significantFigures.d.mts.map +1 -0
- package/dist/utils/significantFigures.mjs +82 -0
- package/dist/utils/significantFigures.mjs.map +1 -0
- package/dist/utils/sortMarkets.cjs +93 -0
- package/dist/utils/sortMarkets.cjs.map +1 -0
- package/dist/utils/sortMarkets.d.cts +27 -0
- package/dist/utils/sortMarkets.d.cts.map +1 -0
- package/dist/utils/sortMarkets.d.mts +27 -0
- package/dist/utils/sortMarkets.d.mts.map +1 -0
- package/dist/utils/sortMarkets.mjs +88 -0
- package/dist/utils/sortMarkets.mjs.map +1 -0
- package/dist/utils/standaloneInfoClient.cjs +70 -0
- package/dist/utils/standaloneInfoClient.cjs.map +1 -0
- package/dist/utils/standaloneInfoClient.d.cts +37 -0
- package/dist/utils/standaloneInfoClient.d.cts.map +1 -0
- package/dist/utils/standaloneInfoClient.d.mts +37 -0
- package/dist/utils/standaloneInfoClient.d.mts.map +1 -0
- package/dist/utils/standaloneInfoClient.mjs +64 -0
- package/dist/utils/standaloneInfoClient.mjs.map +1 -0
- package/dist/utils/stringParseUtils.cjs +18 -0
- package/dist/utils/stringParseUtils.cjs.map +1 -0
- package/dist/utils/stringParseUtils.d.cts +3 -0
- package/dist/utils/stringParseUtils.d.cts.map +1 -0
- package/dist/utils/stringParseUtils.d.mts +3 -0
- package/dist/utils/stringParseUtils.d.mts.map +1 -0
- package/dist/utils/stringParseUtils.mjs +13 -0
- package/dist/utils/stringParseUtils.mjs.map +1 -0
- package/dist/utils/transferData.cjs +33 -0
- package/dist/utils/transferData.cjs.map +1 -0
- package/dist/utils/transferData.d.cts +9 -0
- package/dist/utils/transferData.d.cts.map +1 -0
- package/dist/utils/transferData.d.mts +9 -0
- package/dist/utils/transferData.d.mts.map +1 -0
- package/dist/utils/transferData.mjs +29 -0
- package/dist/utils/transferData.mjs.map +1 -0
- package/dist/utils/wait.cjs +6 -0
- package/dist/utils/wait.cjs.map +1 -0
- package/dist/utils/wait.d.cts +2 -0
- package/dist/utils/wait.d.cts.map +1 -0
- package/dist/utils/wait.d.mts +2 -0
- package/dist/utils/wait.d.mts.map +1 -0
- package/dist/utils/wait.mjs +2 -0
- package/dist/utils/wait.mjs.map +1 -0
- package/package.json +16 -2
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { AssetCtxsWsEvent } from "@nktkas/hyperliquid";
|
|
2
|
+
import type { HyperLiquidClientService } from "./HyperLiquidClientService.cjs";
|
|
3
|
+
import type { HyperLiquidWalletService } from "./HyperLiquidWalletService.cjs";
|
|
4
|
+
import type { Position, OrderFill, Order, SubscribePricesParams, SubscribePositionsParams, SubscribeOrderFillsParams, SubscribeOrdersParams, SubscribeAccountParams, SubscribeOICapsParams, SubscribeOrderBookParams, PerpsPlatformDependencies } from "../types/index.cjs";
|
|
5
|
+
/**
|
|
6
|
+
* Service for managing HyperLiquid WebSocket subscriptions
|
|
7
|
+
* Implements singleton subscription architecture with reference counting
|
|
8
|
+
*/
|
|
9
|
+
export declare class HyperLiquidSubscriptionService {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(clientService: HyperLiquidClientService, walletService: HyperLiquidWalletService, platformDependencies: PerpsPlatformDependencies, hip3Enabled?: boolean, enabledDexs?: string[], allowlistMarkets?: string[], blocklistMarkets?: string[]);
|
|
12
|
+
/**
|
|
13
|
+
* Populate DEX meta cache with pre-fetched meta data
|
|
14
|
+
* Called by Provider after buildAssetMapping to share cached meta,
|
|
15
|
+
* avoiding redundant metaAndAssetCtxs/meta API calls during subscription setup
|
|
16
|
+
*
|
|
17
|
+
* @param dex - DEX key ('' for main DEX, 'xyz'/'flx'/etc for HIP-3)
|
|
18
|
+
* @param meta - Meta response containing universe data
|
|
19
|
+
* @param meta.universe - The array of asset universe entries from the meta response.
|
|
20
|
+
*/
|
|
21
|
+
setDexMetaCache(dex: string, meta: {
|
|
22
|
+
universe: {
|
|
23
|
+
name: string;
|
|
24
|
+
szDecimals: number;
|
|
25
|
+
maxLeverage: number;
|
|
26
|
+
}[];
|
|
27
|
+
}): void;
|
|
28
|
+
/**
|
|
29
|
+
* Cache asset contexts for a specific DEX from API response
|
|
30
|
+
* This allows buildAssetMapping() to populate cache for getMarketDataWithPrices() to use
|
|
31
|
+
*
|
|
32
|
+
* @param dex - DEX name ('' for main perps)
|
|
33
|
+
* @param assetCtxs - Asset contexts from metaAndAssetCtxs response
|
|
34
|
+
*/
|
|
35
|
+
setDexAssetCtxsCache(dex: string, assetCtxs: AssetCtxsWsEvent['ctxs']): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get cached assetCtxs for a DEX
|
|
38
|
+
* Returns the cached asset contexts from WebSocket subscription if available
|
|
39
|
+
*
|
|
40
|
+
* @param dex - DEX key ('' for main DEX, 'xyz'/'flx'/etc for HIP-3)
|
|
41
|
+
* @returns Array of asset contexts or undefined if not cached
|
|
42
|
+
*/
|
|
43
|
+
getDexAssetCtxsCache(dex: string): AssetCtxsWsEvent['ctxs'] | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Update feature flags for HIP-3 support
|
|
46
|
+
* Called when provider configuration changes at runtime
|
|
47
|
+
* Note: Market filtering is NOT applied in subscription service - only in Provider
|
|
48
|
+
*
|
|
49
|
+
* @param hip3Enabled - Whether HIP-3 multi-DEX support is enabled.
|
|
50
|
+
* @param enabledDexs - The array of enabled DEX identifiers.
|
|
51
|
+
* @param allowlistMarkets - The array of allowed market patterns.
|
|
52
|
+
* @param blocklistMarkets - The array of blocked market patterns.
|
|
53
|
+
*/
|
|
54
|
+
updateFeatureFlags(hip3Enabled: boolean, enabledDexs: string[], allowlistMarkets: string[], blocklistMarkets: string[]): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to live price updates with singleton subscription architecture
|
|
57
|
+
* Uses allMids for fast price updates and predictedFundings for accurate funding rates
|
|
58
|
+
*
|
|
59
|
+
* @param params - The subscription parameters including symbols and callbacks.
|
|
60
|
+
* @returns A cleanup function to unsubscribe from price updates.
|
|
61
|
+
*/
|
|
62
|
+
subscribeToPrices(params: SubscribePricesParams): Promise<() => void>;
|
|
63
|
+
/**
|
|
64
|
+
* Subscribe to live position updates with TP/SL data
|
|
65
|
+
*
|
|
66
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
67
|
+
* @returns A cleanup function to unsubscribe from position updates.
|
|
68
|
+
*/
|
|
69
|
+
subscribeToPositions(params: SubscribePositionsParams): () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Subscribe to open interest cap updates
|
|
72
|
+
* OI caps are extracted from webData2 subscription (zero additional overhead)
|
|
73
|
+
*
|
|
74
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
75
|
+
* @returns A cleanup function to unsubscribe from OI cap updates.
|
|
76
|
+
*/
|
|
77
|
+
subscribeToOICaps(params: SubscribeOICapsParams): () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Check if OI caps cache has been initialized
|
|
80
|
+
* Useful for preventing UI flashing before first data arrives
|
|
81
|
+
*
|
|
82
|
+
* @returns True if the condition is met.
|
|
83
|
+
*/
|
|
84
|
+
isOICapsCacheInitialized(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Subscribe to live order fill updates
|
|
87
|
+
* Shares subscriptions per accountId to avoid duplicate WebSocket connections
|
|
88
|
+
*
|
|
89
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
90
|
+
* @returns A cleanup function to unsubscribe from order fill updates.
|
|
91
|
+
*/
|
|
92
|
+
subscribeToOrderFills(params: SubscribeOrderFillsParams): () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Subscribe to live order updates
|
|
95
|
+
* Uses the shared webData2 subscription to avoid duplicate connections
|
|
96
|
+
*
|
|
97
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
98
|
+
* @returns A cleanup function to unsubscribe from order updates.
|
|
99
|
+
*/
|
|
100
|
+
subscribeToOrders(params: SubscribeOrdersParams): () => void;
|
|
101
|
+
/**
|
|
102
|
+
* Subscribe to live account updates
|
|
103
|
+
* Uses the shared webData2 subscription to avoid duplicate connections
|
|
104
|
+
*
|
|
105
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
106
|
+
* @returns A cleanup function to unsubscribe from account updates.
|
|
107
|
+
*/
|
|
108
|
+
subscribeToAccount(params: SubscribeAccountParams): () => void;
|
|
109
|
+
/**
|
|
110
|
+
* Check if orders cache has been initialized from WebSocket
|
|
111
|
+
*
|
|
112
|
+
* @returns true if WebSocket has sent at least one update, false otherwise
|
|
113
|
+
*/
|
|
114
|
+
isOrdersCacheInitialized(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Check if positions cache has been initialized from WebSocket
|
|
117
|
+
*
|
|
118
|
+
* @returns true if WebSocket has sent at least one update, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
isPositionsCacheInitialized(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Get cached positions from WebSocket subscription
|
|
123
|
+
*
|
|
124
|
+
* @returns Cached positions array, or null if not initialized
|
|
125
|
+
*/
|
|
126
|
+
getCachedPositions(): Position[] | null;
|
|
127
|
+
/**
|
|
128
|
+
* Get cached orders from WebSocket subscription
|
|
129
|
+
*
|
|
130
|
+
* @returns Cached orders array, or null if not initialized
|
|
131
|
+
*/
|
|
132
|
+
getCachedOrders(): Order[] | null;
|
|
133
|
+
/**
|
|
134
|
+
* Atomically get cached orders if initialized
|
|
135
|
+
* Prevents race condition between checking initialization and getting data
|
|
136
|
+
*
|
|
137
|
+
* @returns Cached orders array if initialized, null otherwise
|
|
138
|
+
*/
|
|
139
|
+
getOrdersCacheIfInitialized(): Order[] | null;
|
|
140
|
+
/**
|
|
141
|
+
* Get cached price for a symbol from WebSocket allMids subscription
|
|
142
|
+
* OPTIMIZATION: Use this instead of REST infoClient.allMids() to avoid rate limiting
|
|
143
|
+
*
|
|
144
|
+
* @param symbol - Asset symbol (e.g., 'BTC', 'ETH', 'xyz:TSLA')
|
|
145
|
+
* @returns Price string, or undefined if not cached
|
|
146
|
+
*/
|
|
147
|
+
getCachedPrice(symbol: string): string | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Get cached fills from WebSocket userFills subscription
|
|
150
|
+
* OPTIMIZATION: Use this instead of REST userFills() to avoid rate limiting
|
|
151
|
+
*
|
|
152
|
+
* @returns Copy of cached fills array, or null if not cached
|
|
153
|
+
*/
|
|
154
|
+
getCachedFills(): OrderFill[] | null;
|
|
155
|
+
/**
|
|
156
|
+
* Get cached fills only if the cache has been initialized from WebSocket
|
|
157
|
+
* OPTIMIZATION: Distinguishes between "not initialized" (null) and "initialized but empty" ([])
|
|
158
|
+
* - Returns null if cache hasn't received WebSocket snapshot yet (caller should use REST)
|
|
159
|
+
* - Returns empty array [] if cache is initialized but user has no fills (caller can skip REST)
|
|
160
|
+
* - Returns fills array if cache has data
|
|
161
|
+
*
|
|
162
|
+
* @returns Fills array or empty array if initialized, null if not yet initialized
|
|
163
|
+
*/
|
|
164
|
+
getFillsCacheIfInitialized(): OrderFill[] | null;
|
|
165
|
+
/**
|
|
166
|
+
* Subscribe to full order book updates with multiple depth levels
|
|
167
|
+
* Creates a dedicated L2Book subscription for the requested symbol
|
|
168
|
+
* and processes data into OrderBookData format for UI consumption
|
|
169
|
+
*
|
|
170
|
+
* @param params - Subscription parameters
|
|
171
|
+
* @returns Cleanup function to unsubscribe
|
|
172
|
+
*/
|
|
173
|
+
subscribeToOrderBook(params: SubscribeOrderBookParams): () => void;
|
|
174
|
+
/**
|
|
175
|
+
* Restore all active subscriptions after WebSocket reconnection
|
|
176
|
+
* Re-establishes WebSocket subscriptions for all active subscribers
|
|
177
|
+
*
|
|
178
|
+
* IMPORTANT: This method verifies transport readiness before attempting
|
|
179
|
+
* any subscriptions to prevent "subscribe error: undefined" errors.
|
|
180
|
+
*/
|
|
181
|
+
restoreSubscriptions(): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Clear all subscriptions and cached data (multi-DEX support)
|
|
184
|
+
*/
|
|
185
|
+
clearAll(): void;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=HyperLiquidSubscriptionService.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HyperLiquidSubscriptionService.d.cts","sourceRoot":"","sources":["../../src/services/HyperLiquidSubscriptionService.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { AssetCtxsWsEvent } from "@nktkas/hyperliquid";
|
|
2
|
+
import type { HyperLiquidClientService } from "./HyperLiquidClientService.mjs";
|
|
3
|
+
import type { HyperLiquidWalletService } from "./HyperLiquidWalletService.mjs";
|
|
4
|
+
import type { Position, OrderFill, Order, SubscribePricesParams, SubscribePositionsParams, SubscribeOrderFillsParams, SubscribeOrdersParams, SubscribeAccountParams, SubscribeOICapsParams, SubscribeOrderBookParams, PerpsPlatformDependencies } from "../types/index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Service for managing HyperLiquid WebSocket subscriptions
|
|
7
|
+
* Implements singleton subscription architecture with reference counting
|
|
8
|
+
*/
|
|
9
|
+
export declare class HyperLiquidSubscriptionService {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(clientService: HyperLiquidClientService, walletService: HyperLiquidWalletService, platformDependencies: PerpsPlatformDependencies, hip3Enabled?: boolean, enabledDexs?: string[], allowlistMarkets?: string[], blocklistMarkets?: string[]);
|
|
12
|
+
/**
|
|
13
|
+
* Populate DEX meta cache with pre-fetched meta data
|
|
14
|
+
* Called by Provider after buildAssetMapping to share cached meta,
|
|
15
|
+
* avoiding redundant metaAndAssetCtxs/meta API calls during subscription setup
|
|
16
|
+
*
|
|
17
|
+
* @param dex - DEX key ('' for main DEX, 'xyz'/'flx'/etc for HIP-3)
|
|
18
|
+
* @param meta - Meta response containing universe data
|
|
19
|
+
* @param meta.universe - The array of asset universe entries from the meta response.
|
|
20
|
+
*/
|
|
21
|
+
setDexMetaCache(dex: string, meta: {
|
|
22
|
+
universe: {
|
|
23
|
+
name: string;
|
|
24
|
+
szDecimals: number;
|
|
25
|
+
maxLeverage: number;
|
|
26
|
+
}[];
|
|
27
|
+
}): void;
|
|
28
|
+
/**
|
|
29
|
+
* Cache asset contexts for a specific DEX from API response
|
|
30
|
+
* This allows buildAssetMapping() to populate cache for getMarketDataWithPrices() to use
|
|
31
|
+
*
|
|
32
|
+
* @param dex - DEX name ('' for main perps)
|
|
33
|
+
* @param assetCtxs - Asset contexts from metaAndAssetCtxs response
|
|
34
|
+
*/
|
|
35
|
+
setDexAssetCtxsCache(dex: string, assetCtxs: AssetCtxsWsEvent['ctxs']): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get cached assetCtxs for a DEX
|
|
38
|
+
* Returns the cached asset contexts from WebSocket subscription if available
|
|
39
|
+
*
|
|
40
|
+
* @param dex - DEX key ('' for main DEX, 'xyz'/'flx'/etc for HIP-3)
|
|
41
|
+
* @returns Array of asset contexts or undefined if not cached
|
|
42
|
+
*/
|
|
43
|
+
getDexAssetCtxsCache(dex: string): AssetCtxsWsEvent['ctxs'] | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Update feature flags for HIP-3 support
|
|
46
|
+
* Called when provider configuration changes at runtime
|
|
47
|
+
* Note: Market filtering is NOT applied in subscription service - only in Provider
|
|
48
|
+
*
|
|
49
|
+
* @param hip3Enabled - Whether HIP-3 multi-DEX support is enabled.
|
|
50
|
+
* @param enabledDexs - The array of enabled DEX identifiers.
|
|
51
|
+
* @param allowlistMarkets - The array of allowed market patterns.
|
|
52
|
+
* @param blocklistMarkets - The array of blocked market patterns.
|
|
53
|
+
*/
|
|
54
|
+
updateFeatureFlags(hip3Enabled: boolean, enabledDexs: string[], allowlistMarkets: string[], blocklistMarkets: string[]): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to live price updates with singleton subscription architecture
|
|
57
|
+
* Uses allMids for fast price updates and predictedFundings for accurate funding rates
|
|
58
|
+
*
|
|
59
|
+
* @param params - The subscription parameters including symbols and callbacks.
|
|
60
|
+
* @returns A cleanup function to unsubscribe from price updates.
|
|
61
|
+
*/
|
|
62
|
+
subscribeToPrices(params: SubscribePricesParams): Promise<() => void>;
|
|
63
|
+
/**
|
|
64
|
+
* Subscribe to live position updates with TP/SL data
|
|
65
|
+
*
|
|
66
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
67
|
+
* @returns A cleanup function to unsubscribe from position updates.
|
|
68
|
+
*/
|
|
69
|
+
subscribeToPositions(params: SubscribePositionsParams): () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Subscribe to open interest cap updates
|
|
72
|
+
* OI caps are extracted from webData2 subscription (zero additional overhead)
|
|
73
|
+
*
|
|
74
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
75
|
+
* @returns A cleanup function to unsubscribe from OI cap updates.
|
|
76
|
+
*/
|
|
77
|
+
subscribeToOICaps(params: SubscribeOICapsParams): () => void;
|
|
78
|
+
/**
|
|
79
|
+
* Check if OI caps cache has been initialized
|
|
80
|
+
* Useful for preventing UI flashing before first data arrives
|
|
81
|
+
*
|
|
82
|
+
* @returns True if the condition is met.
|
|
83
|
+
*/
|
|
84
|
+
isOICapsCacheInitialized(): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Subscribe to live order fill updates
|
|
87
|
+
* Shares subscriptions per accountId to avoid duplicate WebSocket connections
|
|
88
|
+
*
|
|
89
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
90
|
+
* @returns A cleanup function to unsubscribe from order fill updates.
|
|
91
|
+
*/
|
|
92
|
+
subscribeToOrderFills(params: SubscribeOrderFillsParams): () => void;
|
|
93
|
+
/**
|
|
94
|
+
* Subscribe to live order updates
|
|
95
|
+
* Uses the shared webData2 subscription to avoid duplicate connections
|
|
96
|
+
*
|
|
97
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
98
|
+
* @returns A cleanup function to unsubscribe from order updates.
|
|
99
|
+
*/
|
|
100
|
+
subscribeToOrders(params: SubscribeOrdersParams): () => void;
|
|
101
|
+
/**
|
|
102
|
+
* Subscribe to live account updates
|
|
103
|
+
* Uses the shared webData2 subscription to avoid duplicate connections
|
|
104
|
+
*
|
|
105
|
+
* @param params - The subscription parameters including callback and account ID.
|
|
106
|
+
* @returns A cleanup function to unsubscribe from account updates.
|
|
107
|
+
*/
|
|
108
|
+
subscribeToAccount(params: SubscribeAccountParams): () => void;
|
|
109
|
+
/**
|
|
110
|
+
* Check if orders cache has been initialized from WebSocket
|
|
111
|
+
*
|
|
112
|
+
* @returns true if WebSocket has sent at least one update, false otherwise
|
|
113
|
+
*/
|
|
114
|
+
isOrdersCacheInitialized(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Check if positions cache has been initialized from WebSocket
|
|
117
|
+
*
|
|
118
|
+
* @returns true if WebSocket has sent at least one update, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
isPositionsCacheInitialized(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Get cached positions from WebSocket subscription
|
|
123
|
+
*
|
|
124
|
+
* @returns Cached positions array, or null if not initialized
|
|
125
|
+
*/
|
|
126
|
+
getCachedPositions(): Position[] | null;
|
|
127
|
+
/**
|
|
128
|
+
* Get cached orders from WebSocket subscription
|
|
129
|
+
*
|
|
130
|
+
* @returns Cached orders array, or null if not initialized
|
|
131
|
+
*/
|
|
132
|
+
getCachedOrders(): Order[] | null;
|
|
133
|
+
/**
|
|
134
|
+
* Atomically get cached orders if initialized
|
|
135
|
+
* Prevents race condition between checking initialization and getting data
|
|
136
|
+
*
|
|
137
|
+
* @returns Cached orders array if initialized, null otherwise
|
|
138
|
+
*/
|
|
139
|
+
getOrdersCacheIfInitialized(): Order[] | null;
|
|
140
|
+
/**
|
|
141
|
+
* Get cached price for a symbol from WebSocket allMids subscription
|
|
142
|
+
* OPTIMIZATION: Use this instead of REST infoClient.allMids() to avoid rate limiting
|
|
143
|
+
*
|
|
144
|
+
* @param symbol - Asset symbol (e.g., 'BTC', 'ETH', 'xyz:TSLA')
|
|
145
|
+
* @returns Price string, or undefined if not cached
|
|
146
|
+
*/
|
|
147
|
+
getCachedPrice(symbol: string): string | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Get cached fills from WebSocket userFills subscription
|
|
150
|
+
* OPTIMIZATION: Use this instead of REST userFills() to avoid rate limiting
|
|
151
|
+
*
|
|
152
|
+
* @returns Copy of cached fills array, or null if not cached
|
|
153
|
+
*/
|
|
154
|
+
getCachedFills(): OrderFill[] | null;
|
|
155
|
+
/**
|
|
156
|
+
* Get cached fills only if the cache has been initialized from WebSocket
|
|
157
|
+
* OPTIMIZATION: Distinguishes between "not initialized" (null) and "initialized but empty" ([])
|
|
158
|
+
* - Returns null if cache hasn't received WebSocket snapshot yet (caller should use REST)
|
|
159
|
+
* - Returns empty array [] if cache is initialized but user has no fills (caller can skip REST)
|
|
160
|
+
* - Returns fills array if cache has data
|
|
161
|
+
*
|
|
162
|
+
* @returns Fills array or empty array if initialized, null if not yet initialized
|
|
163
|
+
*/
|
|
164
|
+
getFillsCacheIfInitialized(): OrderFill[] | null;
|
|
165
|
+
/**
|
|
166
|
+
* Subscribe to full order book updates with multiple depth levels
|
|
167
|
+
* Creates a dedicated L2Book subscription for the requested symbol
|
|
168
|
+
* and processes data into OrderBookData format for UI consumption
|
|
169
|
+
*
|
|
170
|
+
* @param params - Subscription parameters
|
|
171
|
+
* @returns Cleanup function to unsubscribe
|
|
172
|
+
*/
|
|
173
|
+
subscribeToOrderBook(params: SubscribeOrderBookParams): () => void;
|
|
174
|
+
/**
|
|
175
|
+
* Restore all active subscriptions after WebSocket reconnection
|
|
176
|
+
* Re-establishes WebSocket subscriptions for all active subscribers
|
|
177
|
+
*
|
|
178
|
+
* IMPORTANT: This method verifies transport readiness before attempting
|
|
179
|
+
* any subscriptions to prevent "subscribe error: undefined" errors.
|
|
180
|
+
*/
|
|
181
|
+
restoreSubscriptions(): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Clear all subscriptions and cached data (multi-DEX support)
|
|
184
|
+
*/
|
|
185
|
+
clearAll(): void;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=HyperLiquidSubscriptionService.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HyperLiquidSubscriptionService.d.mts","sourceRoot":"","sources":["../../src/services/HyperLiquidSubscriptionService.ts"],"names":[],"mappings":"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"}
|