@metamask-previews/perps-controller 0.0.0-preview-e4aa1532 → 0.0.0-preview-6dfa4aeba
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 +1 -11
- package/dist/PerpsController.cjs +66 -2224
- package/dist/PerpsController.cjs.map +1 -1
- package/dist/PerpsController.d.cts +79 -933
- package/dist/PerpsController.d.cts.map +1 -1
- package/dist/PerpsController.d.mts +79 -933
- package/dist/PerpsController.d.mts.map +1 -1
- package/dist/PerpsController.mjs +64 -2221
- package/dist/PerpsController.mjs.map +1 -1
- package/dist/index.cjs +1 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -19
- package/dist/__mocks__/hyperliquidMock.cjs +0 -68
- package/dist/__mocks__/hyperliquidMock.cjs.map +0 -1
- package/dist/__mocks__/hyperliquidMock.d.cts +0 -15
- package/dist/__mocks__/hyperliquidMock.d.cts.map +0 -1
- package/dist/__mocks__/hyperliquidMock.d.mts +0 -15
- package/dist/__mocks__/hyperliquidMock.d.mts.map +0 -1
- package/dist/__mocks__/hyperliquidMock.mjs +0 -65
- package/dist/__mocks__/hyperliquidMock.mjs.map +0 -1
- package/dist/__mocks__/providerMocks.cjs +0 -144
- package/dist/__mocks__/providerMocks.cjs.map +0 -1
- package/dist/__mocks__/providerMocks.d.cts +0 -44
- package/dist/__mocks__/providerMocks.d.cts.map +0 -1
- package/dist/__mocks__/providerMocks.d.mts +0 -44
- package/dist/__mocks__/providerMocks.d.mts.map +0 -1
- package/dist/__mocks__/providerMocks.mjs +0 -136
- package/dist/__mocks__/providerMocks.mjs.map +0 -1
- package/dist/__mocks__/serviceMocks.cjs +0 -187
- package/dist/__mocks__/serviceMocks.cjs.map +0 -1
- package/dist/__mocks__/serviceMocks.d.cts +0 -58
- package/dist/__mocks__/serviceMocks.d.cts.map +0 -1
- package/dist/__mocks__/serviceMocks.d.mts +0 -58
- package/dist/__mocks__/serviceMocks.d.mts.map +0 -1
- package/dist/__mocks__/serviceMocks.mjs +0 -180
- package/dist/__mocks__/serviceMocks.mjs.map +0 -1
- package/dist/aggregation/SubscriptionMultiplexer.cjs +0 -459
- package/dist/aggregation/SubscriptionMultiplexer.cjs.map +0 -1
- package/dist/aggregation/SubscriptionMultiplexer.d.cts +0 -222
- package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +0 -1
- package/dist/aggregation/SubscriptionMultiplexer.d.mts +0 -222
- package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +0 -1
- package/dist/aggregation/SubscriptionMultiplexer.mjs +0 -455
- package/dist/aggregation/SubscriptionMultiplexer.mjs.map +0 -1
- package/dist/aggregation/index.cjs +0 -9
- package/dist/aggregation/index.cjs.map +0 -1
- package/dist/aggregation/index.d.cts +0 -6
- package/dist/aggregation/index.d.cts.map +0 -1
- package/dist/aggregation/index.d.mts +0 -6
- package/dist/aggregation/index.d.mts.map +0 -1
- package/dist/aggregation/index.mjs +0 -5
- package/dist/aggregation/index.mjs.map +0 -1
- package/dist/constants/eventNames.cjs +0 -117
- package/dist/constants/eventNames.cjs.map +0 -1
- package/dist/constants/eventNames.d.cts +0 -106
- package/dist/constants/eventNames.d.cts.map +0 -1
- package/dist/constants/eventNames.d.mts +0 -106
- package/dist/constants/eventNames.d.mts.map +0 -1
- package/dist/constants/eventNames.mjs +0 -114
- package/dist/constants/eventNames.mjs.map +0 -1
- package/dist/constants/hyperLiquidConfig.cjs +0 -366
- package/dist/constants/hyperLiquidConfig.cjs.map +0 -1
- package/dist/constants/hyperLiquidConfig.d.cts +0 -276
- package/dist/constants/hyperLiquidConfig.d.cts.map +0 -1
- package/dist/constants/hyperLiquidConfig.d.mts +0 -276
- package/dist/constants/hyperLiquidConfig.d.mts.map +0 -1
- package/dist/constants/hyperLiquidConfig.mjs +0 -357
- package/dist/constants/hyperLiquidConfig.mjs.map +0 -1
- package/dist/constants/index.cjs +0 -23
- package/dist/constants/index.cjs.map +0 -1
- package/dist/constants/index.d.cts +0 -7
- package/dist/constants/index.d.cts.map +0 -1
- package/dist/constants/index.d.mts +0 -7
- package/dist/constants/index.d.mts.map +0 -1
- package/dist/constants/index.mjs +0 -7
- package/dist/constants/index.mjs.map +0 -1
- package/dist/constants/orderTypes.cjs +0 -31
- package/dist/constants/orderTypes.cjs.map +0 -1
- package/dist/constants/orderTypes.d.cts +0 -19
- package/dist/constants/orderTypes.d.cts.map +0 -1
- package/dist/constants/orderTypes.d.mts +0 -19
- package/dist/constants/orderTypes.d.mts.map +0 -1
- package/dist/constants/orderTypes.mjs +0 -27
- package/dist/constants/orderTypes.mjs.map +0 -1
- package/dist/constants/performanceMetrics.cjs +0 -61
- package/dist/constants/performanceMetrics.cjs.map +0 -1
- package/dist/constants/performanceMetrics.d.cts +0 -44
- package/dist/constants/performanceMetrics.d.cts.map +0 -1
- package/dist/constants/performanceMetrics.d.mts +0 -44
- package/dist/constants/performanceMetrics.d.mts.map +0 -1
- package/dist/constants/performanceMetrics.mjs +0 -58
- package/dist/constants/performanceMetrics.mjs.map +0 -1
- package/dist/constants/perpsConfig.cjs +0 -461
- package/dist/constants/perpsConfig.cjs.map +0 -1
- package/dist/constants/perpsConfig.d.cts +0 -343
- package/dist/constants/perpsConfig.d.cts.map +0 -1
- package/dist/constants/perpsConfig.d.mts +0 -343
- package/dist/constants/perpsConfig.d.mts.map +0 -1
- package/dist/constants/perpsConfig.mjs +0 -458
- package/dist/constants/perpsConfig.mjs.map +0 -1
- package/dist/constants/perpsErrorCodes.cjs +0 -79
- package/dist/constants/perpsErrorCodes.cjs.map +0 -1
- package/dist/constants/perpsErrorCodes.d.cts +0 -64
- package/dist/constants/perpsErrorCodes.d.cts.map +0 -1
- package/dist/constants/perpsErrorCodes.d.mts +0 -64
- package/dist/constants/perpsErrorCodes.d.mts.map +0 -1
- package/dist/constants/perpsErrorCodes.mjs +0 -76
- package/dist/constants/perpsErrorCodes.mjs.map +0 -1
- package/dist/platform-services/HyperLiquidClientService.cjs +0 -857
- package/dist/platform-services/HyperLiquidClientService.cjs.map +0 -1
- package/dist/platform-services/HyperLiquidClientService.d.cts +0 -263
- package/dist/platform-services/HyperLiquidClientService.d.cts.map +0 -1
- package/dist/platform-services/HyperLiquidClientService.d.mts +0 -263
- package/dist/platform-services/HyperLiquidClientService.d.mts.map +0 -1
- package/dist/platform-services/HyperLiquidClientService.mjs +0 -853
- package/dist/platform-services/HyperLiquidClientService.mjs.map +0 -1
- package/dist/platform-services/HyperLiquidSubscriptionService.cjs +0 -2170
- package/dist/platform-services/HyperLiquidSubscriptionService.cjs.map +0 -1
- package/dist/platform-services/HyperLiquidSubscriptionService.d.cts +0 -424
- package/dist/platform-services/HyperLiquidSubscriptionService.d.cts.map +0 -1
- package/dist/platform-services/HyperLiquidSubscriptionService.d.mts +0 -424
- package/dist/platform-services/HyperLiquidSubscriptionService.d.mts.map +0 -1
- package/dist/platform-services/HyperLiquidSubscriptionService.mjs +0 -2166
- package/dist/platform-services/HyperLiquidSubscriptionService.mjs.map +0 -1
- package/dist/platform-services/HyperLiquidWalletService.cjs +0 -140
- package/dist/platform-services/HyperLiquidWalletService.cjs.map +0 -1
- package/dist/platform-services/HyperLiquidWalletService.d.cts +0 -78
- package/dist/platform-services/HyperLiquidWalletService.d.cts.map +0 -1
- package/dist/platform-services/HyperLiquidWalletService.d.mts +0 -78
- package/dist/platform-services/HyperLiquidWalletService.d.mts.map +0 -1
- package/dist/platform-services/HyperLiquidWalletService.mjs +0 -136
- package/dist/platform-services/HyperLiquidWalletService.mjs.map +0 -1
- package/dist/providers/AggregatedPerpsProvider.cjs +0 -777
- package/dist/providers/AggregatedPerpsProvider.cjs.map +0 -1
- package/dist/providers/AggregatedPerpsProvider.d.cts +0 -466
- package/dist/providers/AggregatedPerpsProvider.d.cts.map +0 -1
- package/dist/providers/AggregatedPerpsProvider.d.mts +0 -466
- package/dist/providers/AggregatedPerpsProvider.d.mts.map +0 -1
- package/dist/providers/AggregatedPerpsProvider.mjs +0 -773
- package/dist/providers/AggregatedPerpsProvider.mjs.map +0 -1
- package/dist/providers/HyperLiquidProvider.cjs +0 -5172
- package/dist/providers/HyperLiquidProvider.cjs.map +0 -1
- package/dist/providers/HyperLiquidProvider.d.cts +0 -881
- package/dist/providers/HyperLiquidProvider.d.cts.map +0 -1
- package/dist/providers/HyperLiquidProvider.d.mts +0 -881
- package/dist/providers/HyperLiquidProvider.d.mts.map +0 -1
- package/dist/providers/HyperLiquidProvider.mjs +0 -5168
- package/dist/providers/HyperLiquidProvider.mjs.map +0 -1
- package/dist/providers/index.cjs +0 -11
- package/dist/providers/index.cjs.map +0 -1
- package/dist/providers/index.d.cts +0 -6
- package/dist/providers/index.d.cts.map +0 -1
- package/dist/providers/index.d.mts +0 -6
- package/dist/providers/index.d.mts.map +0 -1
- package/dist/providers/index.mjs +0 -6
- package/dist/providers/index.mjs.map +0 -1
- package/dist/routing/ProviderRouter.cjs +0 -148
- package/dist/routing/ProviderRouter.cjs.map +0 -1
- package/dist/routing/ProviderRouter.d.cts +0 -124
- package/dist/routing/ProviderRouter.d.cts.map +0 -1
- package/dist/routing/ProviderRouter.d.mts +0 -124
- package/dist/routing/ProviderRouter.d.mts.map +0 -1
- package/dist/routing/ProviderRouter.mjs +0 -144
- package/dist/routing/ProviderRouter.mjs.map +0 -1
- package/dist/routing/index.cjs +0 -9
- package/dist/routing/index.cjs.map +0 -1
- package/dist/routing/index.d.cts +0 -6
- package/dist/routing/index.d.cts.map +0 -1
- package/dist/routing/index.d.mts +0 -6
- package/dist/routing/index.d.mts.map +0 -1
- package/dist/routing/index.mjs +0 -5
- package/dist/routing/index.mjs.map +0 -1
- package/dist/selectors.cjs +0 -161
- package/dist/selectors.cjs.map +0 -1
- package/dist/selectors.d.cts +0 -345
- package/dist/selectors.d.cts.map +0 -1
- package/dist/selectors.d.mts +0 -345
- package/dist/selectors.d.mts.map +0 -1
- package/dist/selectors.mjs +0 -153
- package/dist/selectors.mjs.map +0 -1
- package/dist/services/AccountService.cjs +0 -313
- package/dist/services/AccountService.cjs.map +0 -1
- package/dist/services/AccountService.d.cts +0 -53
- package/dist/services/AccountService.d.cts.map +0 -1
- package/dist/services/AccountService.d.mts +0 -53
- package/dist/services/AccountService.d.mts.map +0 -1
- package/dist/services/AccountService.mjs +0 -309
- package/dist/services/AccountService.mjs.map +0 -1
- package/dist/services/DataLakeService.cjs +0 -219
- package/dist/services/DataLakeService.cjs.map +0 -1
- package/dist/services/DataLakeService.d.cts +0 -49
- package/dist/services/DataLakeService.d.cts.map +0 -1
- package/dist/services/DataLakeService.d.mts +0 -49
- package/dist/services/DataLakeService.d.mts.map +0 -1
- package/dist/services/DataLakeService.mjs +0 -215
- package/dist/services/DataLakeService.mjs.map +0 -1
- package/dist/services/DepositService.cjs +0 -96
- package/dist/services/DepositService.cjs.map +0 -1
- package/dist/services/DepositService.d.cts +0 -37
- package/dist/services/DepositService.d.cts.map +0 -1
- package/dist/services/DepositService.d.mts +0 -37
- package/dist/services/DepositService.d.mts.map +0 -1
- package/dist/services/DepositService.mjs +0 -92
- package/dist/services/DepositService.mjs.map +0 -1
- package/dist/services/EligibilityService.cjs +0 -156
- package/dist/services/EligibilityService.cjs.map +0 -1
- package/dist/services/EligibilityService.d.cts +0 -48
- package/dist/services/EligibilityService.d.cts.map +0 -1
- package/dist/services/EligibilityService.d.mts +0 -48
- package/dist/services/EligibilityService.d.mts.map +0 -1
- package/dist/services/EligibilityService.mjs +0 -152
- package/dist/services/EligibilityService.mjs.map +0 -1
- package/dist/services/FeatureFlagConfigurationService.cjs +0 -258
- package/dist/services/FeatureFlagConfigurationService.cjs.map +0 -1
- package/dist/services/FeatureFlagConfigurationService.d.cts +0 -100
- package/dist/services/FeatureFlagConfigurationService.d.cts.map +0 -1
- package/dist/services/FeatureFlagConfigurationService.d.mts +0 -100
- package/dist/services/FeatureFlagConfigurationService.d.mts.map +0 -1
- package/dist/services/FeatureFlagConfigurationService.mjs +0 -254
- package/dist/services/FeatureFlagConfigurationService.mjs.map +0 -1
- package/dist/services/MarketDataService.cjs +0 -875
- package/dist/services/MarketDataService.cjs.map +0 -1
- package/dist/services/MarketDataService.d.cts +0 -289
- package/dist/services/MarketDataService.d.cts.map +0 -1
- package/dist/services/MarketDataService.d.mts +0 -289
- package/dist/services/MarketDataService.d.mts.map +0 -1
- package/dist/services/MarketDataService.mjs +0 -871
- package/dist/services/MarketDataService.mjs.map +0 -1
- package/dist/services/RewardsIntegrationService.cjs +0 -94
- package/dist/services/RewardsIntegrationService.cjs.map +0 -1
- package/dist/services/RewardsIntegrationService.d.cts +0 -30
- package/dist/services/RewardsIntegrationService.d.cts.map +0 -1
- package/dist/services/RewardsIntegrationService.d.mts +0 -30
- package/dist/services/RewardsIntegrationService.d.mts.map +0 -1
- package/dist/services/RewardsIntegrationService.mjs +0 -90
- package/dist/services/RewardsIntegrationService.mjs.map +0 -1
- package/dist/services/ServiceContext.cjs +0 -3
- package/dist/services/ServiceContext.cjs.map +0 -1
- package/dist/services/ServiceContext.d.cts +0 -110
- package/dist/services/ServiceContext.d.cts.map +0 -1
- package/dist/services/ServiceContext.d.mts +0 -110
- package/dist/services/ServiceContext.d.mts.map +0 -1
- package/dist/services/ServiceContext.mjs +0 -2
- package/dist/services/ServiceContext.mjs.map +0 -1
- package/dist/services/TradingService.cjs +0 -1481
- package/dist/services/TradingService.cjs.map +0 -1
- package/dist/services/TradingService.d.cts +0 -308
- package/dist/services/TradingService.d.cts.map +0 -1
- package/dist/services/TradingService.d.mts +0 -308
- package/dist/services/TradingService.d.mts.map +0 -1
- package/dist/services/TradingService.mjs +0 -1477
- package/dist/services/TradingService.mjs.map +0 -1
- package/dist/services/index.cjs +0 -26
- package/dist/services/index.cjs.map +0 -1
- package/dist/services/index.d.cts +0 -11
- package/dist/services/index.d.cts.map +0 -1
- package/dist/services/index.d.mts +0 -11
- package/dist/services/index.d.mts.map +0 -1
- package/dist/services/index.mjs +0 -10
- package/dist/services/index.mjs.map +0 -1
- package/dist/services/utils.cjs +0 -16
- package/dist/services/utils.cjs.map +0 -1
- package/dist/services/utils.d.cts +0 -8
- package/dist/services/utils.d.cts.map +0 -1
- package/dist/services/utils.d.mts +0 -8
- package/dist/services/utils.d.mts.map +0 -1
- package/dist/services/utils.mjs +0 -12
- package/dist/services/utils.mjs.map +0 -1
- package/dist/types/chart.cjs +0 -42
- package/dist/types/chart.cjs.map +0 -1
- package/dist/types/chart.d.cts +0 -62
- package/dist/types/chart.d.cts.map +0 -1
- package/dist/types/chart.d.mts +0 -62
- package/dist/types/chart.d.mts.map +0 -1
- package/dist/types/chart.mjs +0 -39
- package/dist/types/chart.mjs.map +0 -1
- package/dist/types/hyperliquid-types.cjs +0 -3
- package/dist/types/hyperliquid-types.cjs.map +0 -1
- package/dist/types/hyperliquid-types.d.cts +0 -52
- package/dist/types/hyperliquid-types.d.cts.map +0 -1
- package/dist/types/hyperliquid-types.d.mts +0 -52
- package/dist/types/hyperliquid-types.d.mts.map +0 -1
- package/dist/types/hyperliquid-types.mjs +0 -2
- package/dist/types/hyperliquid-types.mjs.map +0 -1
- package/dist/types/index.cjs +0 -96
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.cts +0 -1153
- package/dist/types/index.d.cts.map +0 -1
- package/dist/types/index.d.mts +0 -1153
- package/dist/types/index.d.mts.map +0 -1
- package/dist/types/index.mjs +0 -79
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/transactionTypes.cjs +0 -28
- package/dist/types/transactionTypes.cjs.map +0 -1
- package/dist/types/transactionTypes.d.cts +0 -64
- package/dist/types/transactionTypes.d.cts.map +0 -1
- package/dist/types/transactionTypes.d.mts +0 -64
- package/dist/types/transactionTypes.d.mts.map +0 -1
- package/dist/types/transactionTypes.mjs +0 -23
- package/dist/types/transactionTypes.mjs.map +0 -1
- package/dist/utils/accountUtils.cjs +0 -65
- package/dist/utils/accountUtils.cjs.map +0 -1
- package/dist/utils/accountUtils.d.cts +0 -26
- package/dist/utils/accountUtils.d.cts.map +0 -1
- package/dist/utils/accountUtils.d.mts +0 -26
- package/dist/utils/accountUtils.d.mts.map +0 -1
- package/dist/utils/accountUtils.mjs +0 -61
- package/dist/utils/accountUtils.mjs.map +0 -1
- package/dist/utils/amountConversion.cjs +0 -61
- package/dist/utils/amountConversion.cjs.map +0 -1
- package/dist/utils/amountConversion.d.cts +0 -16
- package/dist/utils/amountConversion.d.cts.map +0 -1
- package/dist/utils/amountConversion.d.mts +0 -16
- package/dist/utils/amountConversion.d.mts.map +0 -1
- package/dist/utils/amountConversion.mjs +0 -54
- package/dist/utils/amountConversion.mjs.map +0 -1
- package/dist/utils/chartUtils.cjs +0 -98
- package/dist/utils/chartUtils.cjs.map +0 -1
- package/dist/utils/chartUtils.d.cts +0 -14
- package/dist/utils/chartUtils.d.cts.map +0 -1
- package/dist/utils/chartUtils.d.mts +0 -14
- package/dist/utils/chartUtils.d.mts.map +0 -1
- package/dist/utils/chartUtils.mjs +0 -94
- package/dist/utils/chartUtils.mjs.map +0 -1
- package/dist/utils/errorUtils.cjs +0 -22
- package/dist/utils/errorUtils.cjs.map +0 -1
- package/dist/utils/errorUtils.d.cts +0 -13
- package/dist/utils/errorUtils.d.cts.map +0 -1
- package/dist/utils/errorUtils.d.mts +0 -13
- package/dist/utils/errorUtils.d.mts.map +0 -1
- package/dist/utils/errorUtils.mjs +0 -18
- package/dist/utils/errorUtils.mjs.map +0 -1
- package/dist/utils/formatUtils.cjs +0 -987
- package/dist/utils/formatUtils.cjs.map +0 -1
- package/dist/utils/formatUtils.d.cts +0 -387
- package/dist/utils/formatUtils.d.cts.map +0 -1
- package/dist/utils/formatUtils.d.mts +0 -387
- package/dist/utils/formatUtils.d.mts.map +0 -1
- package/dist/utils/formatUtils.mjs +0 -966
- package/dist/utils/formatUtils.mjs.map +0 -1
- package/dist/utils/hyperLiquidAdapter.cjs +0 -454
- package/dist/utils/hyperLiquidAdapter.cjs.map +0 -1
- package/dist/utils/hyperLiquidAdapter.d.cts +0 -158
- package/dist/utils/hyperLiquidAdapter.d.cts.map +0 -1
- package/dist/utils/hyperLiquidAdapter.d.mts +0 -158
- package/dist/utils/hyperLiquidAdapter.d.mts.map +0 -1
- package/dist/utils/hyperLiquidAdapter.mjs +0 -439
- package/dist/utils/hyperLiquidAdapter.mjs.map +0 -1
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs +0 -89
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +0 -1
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +0 -58
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +0 -1
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +0 -58
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +0 -1
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs +0 -84
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +0 -1
- package/dist/utils/hyperLiquidValidation.cjs +0 -426
- package/dist/utils/hyperLiquidValidation.cjs.map +0 -1
- package/dist/utils/hyperLiquidValidation.d.cts +0 -143
- package/dist/utils/hyperLiquidValidation.d.cts.map +0 -1
- package/dist/utils/hyperLiquidValidation.d.mts +0 -143
- package/dist/utils/hyperLiquidValidation.d.mts.map +0 -1
- package/dist/utils/hyperLiquidValidation.mjs +0 -413
- package/dist/utils/hyperLiquidValidation.mjs.map +0 -1
- package/dist/utils/idUtils.cjs +0 -50
- package/dist/utils/idUtils.cjs.map +0 -1
- package/dist/utils/idUtils.d.cts +0 -38
- package/dist/utils/idUtils.d.cts.map +0 -1
- package/dist/utils/idUtils.d.mts +0 -38
- package/dist/utils/idUtils.d.mts.map +0 -1
- package/dist/utils/idUtils.mjs +0 -42
- package/dist/utils/idUtils.mjs.map +0 -1
- package/dist/utils/marginUtils.cjs +0 -137
- package/dist/utils/marginUtils.cjs.map +0 -1
- package/dist/utils/marginUtils.d.cts +0 -64
- package/dist/utils/marginUtils.d.cts.map +0 -1
- package/dist/utils/marginUtils.d.mts +0 -64
- package/dist/utils/marginUtils.d.mts.map +0 -1
- package/dist/utils/marginUtils.mjs +0 -131
- package/dist/utils/marginUtils.mjs.map +0 -1
- package/dist/utils/marketDataTransform.cjs +0 -227
- package/dist/utils/marketDataTransform.cjs.map +0 -1
- package/dist/utils/marketDataTransform.d.cts +0 -45
- package/dist/utils/marketDataTransform.d.cts.map +0 -1
- package/dist/utils/marketDataTransform.d.mts +0 -45
- package/dist/utils/marketDataTransform.d.mts.map +0 -1
- package/dist/utils/marketDataTransform.mjs +0 -220
- package/dist/utils/marketDataTransform.mjs.map +0 -1
- package/dist/utils/marketUtils.cjs +0 -420
- package/dist/utils/marketUtils.cjs.map +0 -1
- package/dist/utils/marketUtils.d.cts +0 -227
- package/dist/utils/marketUtils.d.cts.map +0 -1
- package/dist/utils/marketUtils.d.mts +0 -227
- package/dist/utils/marketUtils.d.mts.map +0 -1
- package/dist/utils/marketUtils.mjs +0 -404
- package/dist/utils/marketUtils.mjs.map +0 -1
- package/dist/utils/orderBookGrouping.cjs +0 -151
- package/dist/utils/orderBookGrouping.cjs.map +0 -1
- package/dist/utils/orderBookGrouping.d.cts +0 -76
- package/dist/utils/orderBookGrouping.d.cts.map +0 -1
- package/dist/utils/orderBookGrouping.d.mts +0 -76
- package/dist/utils/orderBookGrouping.d.mts.map +0 -1
- package/dist/utils/orderBookGrouping.mjs +0 -143
- package/dist/utils/orderBookGrouping.mjs.map +0 -1
- package/dist/utils/orderCalculations.cjs +0 -283
- package/dist/utils/orderCalculations.cjs.map +0 -1
- package/dist/utils/orderCalculations.d.cts +0 -107
- package/dist/utils/orderCalculations.d.cts.map +0 -1
- package/dist/utils/orderCalculations.d.mts +0 -107
- package/dist/utils/orderCalculations.d.mts.map +0 -1
- package/dist/utils/orderCalculations.mjs +0 -274
- package/dist/utils/orderCalculations.mjs.map +0 -1
- package/dist/utils/orderUtils.cjs +0 -159
- package/dist/utils/orderUtils.cjs.map +0 -1
- package/dist/utils/orderUtils.d.cts +0 -66
- package/dist/utils/orderUtils.d.cts.map +0 -1
- package/dist/utils/orderUtils.d.mts +0 -66
- package/dist/utils/orderUtils.d.mts.map +0 -1
- package/dist/utils/orderUtils.mjs +0 -151
- package/dist/utils/orderUtils.mjs.map +0 -1
- package/dist/utils/pnlCalculations.cjs +0 -107
- package/dist/utils/pnlCalculations.cjs.map +0 -1
- package/dist/utils/pnlCalculations.d.cts +0 -79
- package/dist/utils/pnlCalculations.d.cts.map +0 -1
- package/dist/utils/pnlCalculations.d.mts +0 -79
- package/dist/utils/pnlCalculations.d.mts.map +0 -1
- package/dist/utils/pnlCalculations.mjs +0 -97
- package/dist/utils/pnlCalculations.mjs.map +0 -1
- package/dist/utils/positionCalculations.cjs +0 -176
- package/dist/utils/positionCalculations.cjs.map +0 -1
- package/dist/utils/positionCalculations.d.cts +0 -85
- package/dist/utils/positionCalculations.d.cts.map +0 -1
- package/dist/utils/positionCalculations.d.mts +0 -85
- package/dist/utils/positionCalculations.d.mts.map +0 -1
- package/dist/utils/positionCalculations.mjs +0 -165
- package/dist/utils/positionCalculations.mjs.map +0 -1
- package/dist/utils/sortMarkets.cjs +0 -88
- package/dist/utils/sortMarkets.cjs.map +0 -1
- package/dist/utils/sortMarkets.d.cts +0 -21
- package/dist/utils/sortMarkets.d.cts.map +0 -1
- package/dist/utils/sortMarkets.d.mts +0 -21
- package/dist/utils/sortMarkets.d.mts.map +0 -1
- package/dist/utils/sortMarkets.mjs +0 -84
- package/dist/utils/sortMarkets.mjs.map +0 -1
- package/dist/utils/standaloneInfoClient.cjs +0 -34
- package/dist/utils/standaloneInfoClient.cjs.map +0 -1
- package/dist/utils/standaloneInfoClient.d.cts +0 -31
- package/dist/utils/standaloneInfoClient.d.cts.map +0 -1
- package/dist/utils/standaloneInfoClient.d.mts +0 -31
- package/dist/utils/standaloneInfoClient.d.mts.map +0 -1
- package/dist/utils/standaloneInfoClient.mjs +0 -30
- package/dist/utils/standaloneInfoClient.mjs.map +0 -1
- package/dist/utils/stringParseUtils.cjs +0 -49
- package/dist/utils/stringParseUtils.cjs.map +0 -1
- package/dist/utils/stringParseUtils.d.cts +0 -35
- package/dist/utils/stringParseUtils.d.cts.map +0 -1
- package/dist/utils/stringParseUtils.d.mts +0 -35
- package/dist/utils/stringParseUtils.d.mts.map +0 -1
- package/dist/utils/stringParseUtils.mjs +0 -44
- package/dist/utils/stringParseUtils.mjs.map +0 -1
- package/dist/utils/time.cjs +0 -37
- package/dist/utils/time.cjs.map +0 -1
- package/dist/utils/time.d.cts +0 -17
- package/dist/utils/time.d.cts.map +0 -1
- package/dist/utils/time.d.mts +0 -17
- package/dist/utils/time.d.mts.map +0 -1
- package/dist/utils/time.mjs +0 -33
- package/dist/utils/time.mjs.map +0 -1
- package/dist/utils/tpslValidation.cjs +0 -505
- package/dist/utils/tpslValidation.cjs.map +0 -1
- package/dist/utils/tpslValidation.d.cts +0 -182
- package/dist/utils/tpslValidation.d.cts.map +0 -1
- package/dist/utils/tpslValidation.d.mts +0 -182
- package/dist/utils/tpslValidation.d.mts.map +0 -1
- package/dist/utils/tpslValidation.mjs +0 -482
- package/dist/utils/tpslValidation.mjs.map +0 -1
- package/dist/utils/transactionUtils.cjs +0 -36
- package/dist/utils/transactionUtils.cjs.map +0 -1
- package/dist/utils/transactionUtils.d.cts +0 -17
- package/dist/utils/transactionUtils.d.cts.map +0 -1
- package/dist/utils/transactionUtils.d.mts +0 -17
- package/dist/utils/transactionUtils.d.mts.map +0 -1
- package/dist/utils/transactionUtils.mjs +0 -32
- package/dist/utils/transactionUtils.mjs.map +0 -1
- package/dist/utils/wait.cjs +0 -12
- package/dist/utils/wait.cjs.map +0 -1
- package/dist/utils/wait.d.cts +0 -8
- package/dist/utils/wait.d.cts.map +0 -1
- package/dist/utils/wait.d.mts +0 -8
- package/dist/utils/wait.d.mts.map +0 -1
- package/dist/utils/wait.mjs +0 -8
- package/dist/utils/wait.mjs.map +0 -1
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import type { BadgeType, CandleData, PerpsMarketData } from "../types/index.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Pattern matcher type - either string (exact match) or RegExp (wildcard)
|
|
4
|
-
*/
|
|
5
|
-
export type MarketPatternMatcher = RegExp | string;
|
|
6
|
-
/**
|
|
7
|
-
* Pre-compiled pattern with original pattern string and matcher
|
|
8
|
-
*/
|
|
9
|
-
export type CompiledMarketPattern = {
|
|
10
|
-
pattern: string;
|
|
11
|
-
matcher: MarketPatternMatcher;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Escape special regex characters in a string
|
|
15
|
-
*
|
|
16
|
-
* @param str - String to escape
|
|
17
|
-
* @returns Escaped string safe for regex
|
|
18
|
-
*/
|
|
19
|
-
export declare const escapeRegex: (str: string) => string;
|
|
20
|
-
/**
|
|
21
|
-
* Validate market filter pattern for safety
|
|
22
|
-
* Prevents regex DoS attacks from malicious patterns
|
|
23
|
-
*
|
|
24
|
-
* @param pattern - Pattern to validate
|
|
25
|
-
* @returns true if pattern is safe
|
|
26
|
-
* @throws Error if pattern is unsafe
|
|
27
|
-
*
|
|
28
|
-
* @example Valid patterns
|
|
29
|
-
* validateMarketPattern("BTC") // → true
|
|
30
|
-
* validateMarketPattern("xyz:TSLA") // → true
|
|
31
|
-
* validateMarketPattern("xyz:*") // → true
|
|
32
|
-
*
|
|
33
|
-
* @example Invalid patterns
|
|
34
|
-
* validateMarketPattern("") // → throws Error
|
|
35
|
-
* validateMarketPattern("xyz:.*") // → throws Error (regex chars)
|
|
36
|
-
* validateMarketPattern("BTC#SCAM") // → throws Error (invalid char)
|
|
37
|
-
*/
|
|
38
|
-
export declare const validateMarketPattern: (pattern: string) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Compile market filter pattern into optimized matcher
|
|
41
|
-
* Supports wildcards ("xyz:*"), DEX shorthand ("xyz"), and exact matches ("xyz:TSLA")
|
|
42
|
-
*
|
|
43
|
-
* Note: Main DEX markets (no prefix) don't need filtering - they're always included.
|
|
44
|
-
* Patterns without colons are treated as HIP-3 DEX shorthand.
|
|
45
|
-
*
|
|
46
|
-
* @param pattern - Pattern string (e.g., "xyz:*", "xyz:TSLA", "xyz")
|
|
47
|
-
* @returns Compiled matcher (RegExp for wildcards/shorthand, string for exact match)
|
|
48
|
-
*
|
|
49
|
-
* @example Wildcard - matches all markets from a DEX
|
|
50
|
-
* compileMarketPattern("xyz:*") // → /^xyz:/
|
|
51
|
-
*
|
|
52
|
-
* @example DEX shorthand - equivalent to wildcard
|
|
53
|
-
* compileMarketPattern("xyz") // → /^xyz:/ (matches all xyz markets)
|
|
54
|
-
*
|
|
55
|
-
* @example Exact match - matches specific market
|
|
56
|
-
* compileMarketPattern("xyz:TSLA") // → "xyz:TSLA"
|
|
57
|
-
*/
|
|
58
|
-
export declare const compileMarketPattern: (pattern: string) => MarketPatternMatcher;
|
|
59
|
-
/**
|
|
60
|
-
* Check if a symbol matches a compiled pattern matcher
|
|
61
|
-
*
|
|
62
|
-
* @param symbol - Market symbol (e.g., "BTC", "xyz:TSLA")
|
|
63
|
-
* @param matcher - Compiled matcher (string or RegExp)
|
|
64
|
-
* @returns true if symbol matches the pattern
|
|
65
|
-
*/
|
|
66
|
-
export declare const matchesMarketPattern: (symbol: string, matcher: MarketPatternMatcher) => boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check if a market should be included based on HIP-3 master switch and whitelist/blacklist patterns
|
|
69
|
-
* Main DEX markets (null dex) are ALWAYS included (no filtering)
|
|
70
|
-
*
|
|
71
|
-
* Logic: Check master switch → apply whitelist (if non-empty) → apply blacklist
|
|
72
|
-
*
|
|
73
|
-
* @param symbol - Market symbol (e.g., "BTC", "xyz:TSLA")
|
|
74
|
-
* @param dex - DEX identifier (null for main DEX, "xyz" for HIP-3 DEX)
|
|
75
|
-
* @param hip3Enabled - Master switch for HIP-3 markets (false = block all HIP-3)
|
|
76
|
-
* @param compiledEnabledPatterns - Pre-compiled whitelist patterns (empty = allow all)
|
|
77
|
-
* @param compiledBlockedPatterns - Pre-compiled blacklist patterns (empty = block none)
|
|
78
|
-
* @returns true if market should be shown to users
|
|
79
|
-
*
|
|
80
|
-
* @example Main DEX market (always included)
|
|
81
|
-
* shouldIncludeMarket("BTC", null, true, [...], [...]) // → true
|
|
82
|
-
*
|
|
83
|
-
* @example HIP-3 when master switch is OFF
|
|
84
|
-
* shouldIncludeMarket("xyz:TSLA", "xyz", false, [...], [...]) // → false (HIP-3 disabled)
|
|
85
|
-
*
|
|
86
|
-
* @example HIP-3 with empty whitelist (discovery mode)
|
|
87
|
-
* shouldIncludeMarket("xyz:TSLA", "xyz", true, [], []) // → true (allow all)
|
|
88
|
-
*
|
|
89
|
-
* @example HIP-3 with whitelist
|
|
90
|
-
* shouldIncludeMarket("xyz:TSLA", "xyz", true,
|
|
91
|
-
* [{pattern: "xyz:*", matcher: /^xyz:/}], []) // → true (matches whitelist)
|
|
92
|
-
*
|
|
93
|
-
* @example HIP-3 with blacklist
|
|
94
|
-
* shouldIncludeMarket("xyz:SCAM", "xyz", true, [],
|
|
95
|
-
* [{pattern: "xyz:SCAM", matcher: "xyz:SCAM"}]) // → false (blocked)
|
|
96
|
-
*/
|
|
97
|
-
export declare const shouldIncludeMarket: (symbol: string, dex: string | null, hip3Enabled: boolean, compiledEnabledPatterns: CompiledMarketPattern[], compiledBlockedPatterns: CompiledMarketPattern[]) => boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Extract the display symbol from a full symbol string
|
|
100
|
-
* Strips DEX prefix for HIP-3 markets (e.g., "xyz:XYZ100" -> "XYZ100")
|
|
101
|
-
* Returns the symbol unchanged if no DEX prefix is present
|
|
102
|
-
*
|
|
103
|
-
* @param symbol - Full symbol (e.g., "BTC" or "xyz:XYZ100")
|
|
104
|
-
* @returns Display symbol without DEX prefix (e.g., "BTC" or "XYZ100")
|
|
105
|
-
*/
|
|
106
|
-
export declare const getPerpsDisplaySymbol: (symbol: string) => string;
|
|
107
|
-
/**
|
|
108
|
-
* Extract the DEX identifier from a full symbol string
|
|
109
|
-
* Returns the DEX prefix for HIP-3 markets (e.g., "xyz:XYZ100" -> "xyz")
|
|
110
|
-
* Returns null if no DEX prefix is present (main DEX market)
|
|
111
|
-
*
|
|
112
|
-
* @param symbol - Full symbol (e.g., "BTC" or "xyz:XYZ100")
|
|
113
|
-
* @returns DEX identifier or null if main DEX (e.g., "xyz" or null)
|
|
114
|
-
*/
|
|
115
|
-
export declare const getPerpsDexFromSymbol: (symbol: string) => string | null;
|
|
116
|
-
type FundingCountdownParams = {
|
|
117
|
-
/**
|
|
118
|
-
* Next funding time in milliseconds since epoch (optional, market-specific)
|
|
119
|
-
*/
|
|
120
|
-
nextFundingTime?: number;
|
|
121
|
-
/**
|
|
122
|
-
* Funding interval in hours (optional, market-specific)
|
|
123
|
-
* Default is 1 hour for HyperLiquid (funding is paid every hour)
|
|
124
|
-
*/
|
|
125
|
-
fundingIntervalHours?: number;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Calculate the time until the next funding period.
|
|
129
|
-
* Supports market-specific funding times when provided.
|
|
130
|
-
* Falls back to default HyperLiquid 1-hour periods (funding paid every hour).
|
|
131
|
-
*
|
|
132
|
-
* @param params - Optional funding countdown parameters
|
|
133
|
-
* @returns Formatted countdown string in HH:MM:SS format
|
|
134
|
-
*/
|
|
135
|
-
export declare const calculateFundingCountdown: (params?: FundingCountdownParams) => string;
|
|
136
|
-
/**
|
|
137
|
-
* Calculate 24h high and low from candlestick data.
|
|
138
|
-
*
|
|
139
|
-
* @param candleData - Candlestick data containing price candles
|
|
140
|
-
* @returns Object with high and low prices for the last 24 hours
|
|
141
|
-
*/
|
|
142
|
-
export declare const calculate24hHighLow: (candleData: CandleData | null) => {
|
|
143
|
-
high: number;
|
|
144
|
-
low: number;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Determine badge type for a market based on its metadata
|
|
148
|
-
* Prioritizes explicit marketType over generic experimental badge
|
|
149
|
-
*
|
|
150
|
-
* @param market - Market data object (only needs marketType and marketSource fields)
|
|
151
|
-
* @returns Badge type to display, or undefined for no badge (main DEX)
|
|
152
|
-
*
|
|
153
|
-
* @example Main DEX
|
|
154
|
-
* getMarketBadgeType({ symbol: 'BTC', marketSource: null }) // → undefined
|
|
155
|
-
*
|
|
156
|
-
* @example Mapped HIP-3 DEX
|
|
157
|
-
* getMarketBadgeType({ symbol: 'xyz:XYZ100', marketSource: 'xyz', marketType: 'equity' }) // → 'equity'
|
|
158
|
-
*
|
|
159
|
-
* @example Unmapped HIP-3 DEX
|
|
160
|
-
* getMarketBadgeType({ symbol: 'abc:ABC100', marketSource: 'abc' }) // → 'experimental'
|
|
161
|
-
*/
|
|
162
|
-
export declare const getMarketBadgeType: (market: Pick<PerpsMarketData, 'marketType' | 'marketSource'>) => BadgeType | undefined;
|
|
163
|
-
/**
|
|
164
|
-
* Filter markets by search query
|
|
165
|
-
* Searches through both symbol and name fields (case-insensitive)
|
|
166
|
-
*
|
|
167
|
-
* @param markets - Array of markets to filter
|
|
168
|
-
* @param searchQuery - Search query string
|
|
169
|
-
* @returns Filtered array of markets matching the query
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* filterMarketsByQuery([{ symbol: 'BTC', name: 'Bitcoin' }], 'btc') // → [{ symbol: 'BTC', name: 'Bitcoin' }]
|
|
173
|
-
* filterMarketsByQuery([{ symbol: 'BTC', name: 'Bitcoin' }], 'coin') // → [{ symbol: 'BTC', name: 'Bitcoin' }]
|
|
174
|
-
* filterMarketsByQuery([{ symbol: 'BTC', name: 'Bitcoin' }], '') // → [{ symbol: 'BTC', name: 'Bitcoin' }]
|
|
175
|
-
*/
|
|
176
|
-
export declare const filterMarketsByQuery: (markets: PerpsMarketData[], searchQuery: string) => PerpsMarketData[];
|
|
177
|
-
/**
|
|
178
|
-
* Generate the appropriate icon URL for an asset symbol
|
|
179
|
-
* Handles both regular assets and HIP-3 assets (dex:symbol format)
|
|
180
|
-
*
|
|
181
|
-
* @param symbol - Asset symbol (e.g., "BTC" or "xyz:TSLA")
|
|
182
|
-
* @param kPrefixAssets - Optional set of assets that have a 'k' prefix to remove
|
|
183
|
-
* @returns Icon URL for the asset
|
|
184
|
-
*
|
|
185
|
-
* @example Regular asset
|
|
186
|
-
* getAssetIconUrl('BTC') // → 'https://app.hyperliquid.xyz/coins/BTC.svg'
|
|
187
|
-
*
|
|
188
|
-
* @example HIP-3 asset
|
|
189
|
-
* getAssetIconUrl('xyz:TSLA') // → 'https://raw.githubusercontent.com/.../hip3%3Axyz_TSLA.svg'
|
|
190
|
-
*
|
|
191
|
-
* @example With k-prefix handling
|
|
192
|
-
* getAssetIconUrl('kBONK', new Set(['KBONK'])) // → 'https://app.hyperliquid.xyz/coins/BONK.svg'
|
|
193
|
-
*/
|
|
194
|
-
export declare const getAssetIconUrl: (symbol: string, kPrefixAssets?: Set<string>) => string;
|
|
195
|
-
/**
|
|
196
|
-
* Icon URLs with primary (MetaMask-hosted) and fallback (HyperLiquid) sources
|
|
197
|
-
*/
|
|
198
|
-
export type AssetIconUrls = {
|
|
199
|
-
/** MetaMask contract-metadata repo (preferred source) */
|
|
200
|
-
primary: string;
|
|
201
|
-
/** HyperLiquid CDN (fallback source) */
|
|
202
|
-
fallback: string;
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Generate icon URLs for an asset symbol with fallback support
|
|
206
|
-
*
|
|
207
|
-
* Resolution order:
|
|
208
|
-
* 1. Primary: MetaMask contract-metadata repo (manually curated)
|
|
209
|
-
* 2. Fallback: HyperLiquid CDN (always available)
|
|
210
|
-
*
|
|
211
|
-
* @param symbol - Asset symbol (e.g., "BTC" or "xyz:TSLA")
|
|
212
|
-
* @param kPrefixAssets - Optional set of assets that have a 'k' prefix to remove
|
|
213
|
-
* @returns Object with primary and fallback URLs, or null if no symbol
|
|
214
|
-
*
|
|
215
|
-
* @example Regular asset
|
|
216
|
-
* getAssetIconUrls('BTC')
|
|
217
|
-
* // → { primary: 'https://raw.githubusercontent.com/.../BTC.svg',
|
|
218
|
-
* // fallback: 'https://app.hyperliquid.xyz/coins/BTC.svg' }
|
|
219
|
-
*
|
|
220
|
-
* @example HIP-3 asset
|
|
221
|
-
* getAssetIconUrls('xyz:TSLA')
|
|
222
|
-
* // → { primary: 'https://raw.githubusercontent.com/.../hip3:xyz_TSLA.svg',
|
|
223
|
-
* // fallback: 'https://app.hyperliquid.xyz/coins/xyz:TSLA.svg' }
|
|
224
|
-
*/
|
|
225
|
-
export declare const getAssetIconUrls: (symbol: string, kPrefixAssets?: Set<string>) => AssetIconUrls | null;
|
|
226
|
-
export {};
|
|
227
|
-
//# sourceMappingURL=marketUtils.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marketUtils.d.cts","sourceRoot":"","sources":["../../src/utils/marketUtils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAEV,eAAe,EAChB,2BAAiB;AAOlB;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MACG,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,OAkCvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,oBAkBtD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,WACvB,MAAM,WACL,oBAAoB,KAC5B,OAQF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,mBAAmB,WACtB,MAAM,OACT,MAAM,GAAG,IAAI,eACL,OAAO,2BACK,qBAAqB,EAAE,2BACvB,qBAAqB,EAAE,KAC/C,OAgCF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,MActD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,MAAM,GAAG,IAc/D,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,YAC3B,sBAAsB,KAC9B,MAuDF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,eAClB,UAAU,GAAG,IAAI,KAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CA6B7B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,WACrB,KAAK,eAAe,EAAE,YAAY,GAAG,cAAc,CAAC,KAC3D,SAAS,GAAG,SAI0D,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,YACtB,eAAe,EAAE,eACb,MAAM,KAClB,eAAe,EAajB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,kBACE,IAAI,MAAM,CAAC,KAC1B,MAqBF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,WACnB,MAAM,kBACE,IAAI,MAAM,CAAC,KAC1B,aAAa,GAAG,IA8BlB,CAAC"}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import type { BadgeType, CandleData, PerpsMarketData } from "../types/index.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* Pattern matcher type - either string (exact match) or RegExp (wildcard)
|
|
4
|
-
*/
|
|
5
|
-
export type MarketPatternMatcher = RegExp | string;
|
|
6
|
-
/**
|
|
7
|
-
* Pre-compiled pattern with original pattern string and matcher
|
|
8
|
-
*/
|
|
9
|
-
export type CompiledMarketPattern = {
|
|
10
|
-
pattern: string;
|
|
11
|
-
matcher: MarketPatternMatcher;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Escape special regex characters in a string
|
|
15
|
-
*
|
|
16
|
-
* @param str - String to escape
|
|
17
|
-
* @returns Escaped string safe for regex
|
|
18
|
-
*/
|
|
19
|
-
export declare const escapeRegex: (str: string) => string;
|
|
20
|
-
/**
|
|
21
|
-
* Validate market filter pattern for safety
|
|
22
|
-
* Prevents regex DoS attacks from malicious patterns
|
|
23
|
-
*
|
|
24
|
-
* @param pattern - Pattern to validate
|
|
25
|
-
* @returns true if pattern is safe
|
|
26
|
-
* @throws Error if pattern is unsafe
|
|
27
|
-
*
|
|
28
|
-
* @example Valid patterns
|
|
29
|
-
* validateMarketPattern("BTC") // → true
|
|
30
|
-
* validateMarketPattern("xyz:TSLA") // → true
|
|
31
|
-
* validateMarketPattern("xyz:*") // → true
|
|
32
|
-
*
|
|
33
|
-
* @example Invalid patterns
|
|
34
|
-
* validateMarketPattern("") // → throws Error
|
|
35
|
-
* validateMarketPattern("xyz:.*") // → throws Error (regex chars)
|
|
36
|
-
* validateMarketPattern("BTC#SCAM") // → throws Error (invalid char)
|
|
37
|
-
*/
|
|
38
|
-
export declare const validateMarketPattern: (pattern: string) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Compile market filter pattern into optimized matcher
|
|
41
|
-
* Supports wildcards ("xyz:*"), DEX shorthand ("xyz"), and exact matches ("xyz:TSLA")
|
|
42
|
-
*
|
|
43
|
-
* Note: Main DEX markets (no prefix) don't need filtering - they're always included.
|
|
44
|
-
* Patterns without colons are treated as HIP-3 DEX shorthand.
|
|
45
|
-
*
|
|
46
|
-
* @param pattern - Pattern string (e.g., "xyz:*", "xyz:TSLA", "xyz")
|
|
47
|
-
* @returns Compiled matcher (RegExp for wildcards/shorthand, string for exact match)
|
|
48
|
-
*
|
|
49
|
-
* @example Wildcard - matches all markets from a DEX
|
|
50
|
-
* compileMarketPattern("xyz:*") // → /^xyz:/
|
|
51
|
-
*
|
|
52
|
-
* @example DEX shorthand - equivalent to wildcard
|
|
53
|
-
* compileMarketPattern("xyz") // → /^xyz:/ (matches all xyz markets)
|
|
54
|
-
*
|
|
55
|
-
* @example Exact match - matches specific market
|
|
56
|
-
* compileMarketPattern("xyz:TSLA") // → "xyz:TSLA"
|
|
57
|
-
*/
|
|
58
|
-
export declare const compileMarketPattern: (pattern: string) => MarketPatternMatcher;
|
|
59
|
-
/**
|
|
60
|
-
* Check if a symbol matches a compiled pattern matcher
|
|
61
|
-
*
|
|
62
|
-
* @param symbol - Market symbol (e.g., "BTC", "xyz:TSLA")
|
|
63
|
-
* @param matcher - Compiled matcher (string or RegExp)
|
|
64
|
-
* @returns true if symbol matches the pattern
|
|
65
|
-
*/
|
|
66
|
-
export declare const matchesMarketPattern: (symbol: string, matcher: MarketPatternMatcher) => boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check if a market should be included based on HIP-3 master switch and whitelist/blacklist patterns
|
|
69
|
-
* Main DEX markets (null dex) are ALWAYS included (no filtering)
|
|
70
|
-
*
|
|
71
|
-
* Logic: Check master switch → apply whitelist (if non-empty) → apply blacklist
|
|
72
|
-
*
|
|
73
|
-
* @param symbol - Market symbol (e.g., "BTC", "xyz:TSLA")
|
|
74
|
-
* @param dex - DEX identifier (null for main DEX, "xyz" for HIP-3 DEX)
|
|
75
|
-
* @param hip3Enabled - Master switch for HIP-3 markets (false = block all HIP-3)
|
|
76
|
-
* @param compiledEnabledPatterns - Pre-compiled whitelist patterns (empty = allow all)
|
|
77
|
-
* @param compiledBlockedPatterns - Pre-compiled blacklist patterns (empty = block none)
|
|
78
|
-
* @returns true if market should be shown to users
|
|
79
|
-
*
|
|
80
|
-
* @example Main DEX market (always included)
|
|
81
|
-
* shouldIncludeMarket("BTC", null, true, [...], [...]) // → true
|
|
82
|
-
*
|
|
83
|
-
* @example HIP-3 when master switch is OFF
|
|
84
|
-
* shouldIncludeMarket("xyz:TSLA", "xyz", false, [...], [...]) // → false (HIP-3 disabled)
|
|
85
|
-
*
|
|
86
|
-
* @example HIP-3 with empty whitelist (discovery mode)
|
|
87
|
-
* shouldIncludeMarket("xyz:TSLA", "xyz", true, [], []) // → true (allow all)
|
|
88
|
-
*
|
|
89
|
-
* @example HIP-3 with whitelist
|
|
90
|
-
* shouldIncludeMarket("xyz:TSLA", "xyz", true,
|
|
91
|
-
* [{pattern: "xyz:*", matcher: /^xyz:/}], []) // → true (matches whitelist)
|
|
92
|
-
*
|
|
93
|
-
* @example HIP-3 with blacklist
|
|
94
|
-
* shouldIncludeMarket("xyz:SCAM", "xyz", true, [],
|
|
95
|
-
* [{pattern: "xyz:SCAM", matcher: "xyz:SCAM"}]) // → false (blocked)
|
|
96
|
-
*/
|
|
97
|
-
export declare const shouldIncludeMarket: (symbol: string, dex: string | null, hip3Enabled: boolean, compiledEnabledPatterns: CompiledMarketPattern[], compiledBlockedPatterns: CompiledMarketPattern[]) => boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Extract the display symbol from a full symbol string
|
|
100
|
-
* Strips DEX prefix for HIP-3 markets (e.g., "xyz:XYZ100" -> "XYZ100")
|
|
101
|
-
* Returns the symbol unchanged if no DEX prefix is present
|
|
102
|
-
*
|
|
103
|
-
* @param symbol - Full symbol (e.g., "BTC" or "xyz:XYZ100")
|
|
104
|
-
* @returns Display symbol without DEX prefix (e.g., "BTC" or "XYZ100")
|
|
105
|
-
*/
|
|
106
|
-
export declare const getPerpsDisplaySymbol: (symbol: string) => string;
|
|
107
|
-
/**
|
|
108
|
-
* Extract the DEX identifier from a full symbol string
|
|
109
|
-
* Returns the DEX prefix for HIP-3 markets (e.g., "xyz:XYZ100" -> "xyz")
|
|
110
|
-
* Returns null if no DEX prefix is present (main DEX market)
|
|
111
|
-
*
|
|
112
|
-
* @param symbol - Full symbol (e.g., "BTC" or "xyz:XYZ100")
|
|
113
|
-
* @returns DEX identifier or null if main DEX (e.g., "xyz" or null)
|
|
114
|
-
*/
|
|
115
|
-
export declare const getPerpsDexFromSymbol: (symbol: string) => string | null;
|
|
116
|
-
type FundingCountdownParams = {
|
|
117
|
-
/**
|
|
118
|
-
* Next funding time in milliseconds since epoch (optional, market-specific)
|
|
119
|
-
*/
|
|
120
|
-
nextFundingTime?: number;
|
|
121
|
-
/**
|
|
122
|
-
* Funding interval in hours (optional, market-specific)
|
|
123
|
-
* Default is 1 hour for HyperLiquid (funding is paid every hour)
|
|
124
|
-
*/
|
|
125
|
-
fundingIntervalHours?: number;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Calculate the time until the next funding period.
|
|
129
|
-
* Supports market-specific funding times when provided.
|
|
130
|
-
* Falls back to default HyperLiquid 1-hour periods (funding paid every hour).
|
|
131
|
-
*
|
|
132
|
-
* @param params - Optional funding countdown parameters
|
|
133
|
-
* @returns Formatted countdown string in HH:MM:SS format
|
|
134
|
-
*/
|
|
135
|
-
export declare const calculateFundingCountdown: (params?: FundingCountdownParams) => string;
|
|
136
|
-
/**
|
|
137
|
-
* Calculate 24h high and low from candlestick data.
|
|
138
|
-
*
|
|
139
|
-
* @param candleData - Candlestick data containing price candles
|
|
140
|
-
* @returns Object with high and low prices for the last 24 hours
|
|
141
|
-
*/
|
|
142
|
-
export declare const calculate24hHighLow: (candleData: CandleData | null) => {
|
|
143
|
-
high: number;
|
|
144
|
-
low: number;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Determine badge type for a market based on its metadata
|
|
148
|
-
* Prioritizes explicit marketType over generic experimental badge
|
|
149
|
-
*
|
|
150
|
-
* @param market - Market data object (only needs marketType and marketSource fields)
|
|
151
|
-
* @returns Badge type to display, or undefined for no badge (main DEX)
|
|
152
|
-
*
|
|
153
|
-
* @example Main DEX
|
|
154
|
-
* getMarketBadgeType({ symbol: 'BTC', marketSource: null }) // → undefined
|
|
155
|
-
*
|
|
156
|
-
* @example Mapped HIP-3 DEX
|
|
157
|
-
* getMarketBadgeType({ symbol: 'xyz:XYZ100', marketSource: 'xyz', marketType: 'equity' }) // → 'equity'
|
|
158
|
-
*
|
|
159
|
-
* @example Unmapped HIP-3 DEX
|
|
160
|
-
* getMarketBadgeType({ symbol: 'abc:ABC100', marketSource: 'abc' }) // → 'experimental'
|
|
161
|
-
*/
|
|
162
|
-
export declare const getMarketBadgeType: (market: Pick<PerpsMarketData, 'marketType' | 'marketSource'>) => BadgeType | undefined;
|
|
163
|
-
/**
|
|
164
|
-
* Filter markets by search query
|
|
165
|
-
* Searches through both symbol and name fields (case-insensitive)
|
|
166
|
-
*
|
|
167
|
-
* @param markets - Array of markets to filter
|
|
168
|
-
* @param searchQuery - Search query string
|
|
169
|
-
* @returns Filtered array of markets matching the query
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* filterMarketsByQuery([{ symbol: 'BTC', name: 'Bitcoin' }], 'btc') // → [{ symbol: 'BTC', name: 'Bitcoin' }]
|
|
173
|
-
* filterMarketsByQuery([{ symbol: 'BTC', name: 'Bitcoin' }], 'coin') // → [{ symbol: 'BTC', name: 'Bitcoin' }]
|
|
174
|
-
* filterMarketsByQuery([{ symbol: 'BTC', name: 'Bitcoin' }], '') // → [{ symbol: 'BTC', name: 'Bitcoin' }]
|
|
175
|
-
*/
|
|
176
|
-
export declare const filterMarketsByQuery: (markets: PerpsMarketData[], searchQuery: string) => PerpsMarketData[];
|
|
177
|
-
/**
|
|
178
|
-
* Generate the appropriate icon URL for an asset symbol
|
|
179
|
-
* Handles both regular assets and HIP-3 assets (dex:symbol format)
|
|
180
|
-
*
|
|
181
|
-
* @param symbol - Asset symbol (e.g., "BTC" or "xyz:TSLA")
|
|
182
|
-
* @param kPrefixAssets - Optional set of assets that have a 'k' prefix to remove
|
|
183
|
-
* @returns Icon URL for the asset
|
|
184
|
-
*
|
|
185
|
-
* @example Regular asset
|
|
186
|
-
* getAssetIconUrl('BTC') // → 'https://app.hyperliquid.xyz/coins/BTC.svg'
|
|
187
|
-
*
|
|
188
|
-
* @example HIP-3 asset
|
|
189
|
-
* getAssetIconUrl('xyz:TSLA') // → 'https://raw.githubusercontent.com/.../hip3%3Axyz_TSLA.svg'
|
|
190
|
-
*
|
|
191
|
-
* @example With k-prefix handling
|
|
192
|
-
* getAssetIconUrl('kBONK', new Set(['KBONK'])) // → 'https://app.hyperliquid.xyz/coins/BONK.svg'
|
|
193
|
-
*/
|
|
194
|
-
export declare const getAssetIconUrl: (symbol: string, kPrefixAssets?: Set<string>) => string;
|
|
195
|
-
/**
|
|
196
|
-
* Icon URLs with primary (MetaMask-hosted) and fallback (HyperLiquid) sources
|
|
197
|
-
*/
|
|
198
|
-
export type AssetIconUrls = {
|
|
199
|
-
/** MetaMask contract-metadata repo (preferred source) */
|
|
200
|
-
primary: string;
|
|
201
|
-
/** HyperLiquid CDN (fallback source) */
|
|
202
|
-
fallback: string;
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Generate icon URLs for an asset symbol with fallback support
|
|
206
|
-
*
|
|
207
|
-
* Resolution order:
|
|
208
|
-
* 1. Primary: MetaMask contract-metadata repo (manually curated)
|
|
209
|
-
* 2. Fallback: HyperLiquid CDN (always available)
|
|
210
|
-
*
|
|
211
|
-
* @param symbol - Asset symbol (e.g., "BTC" or "xyz:TSLA")
|
|
212
|
-
* @param kPrefixAssets - Optional set of assets that have a 'k' prefix to remove
|
|
213
|
-
* @returns Object with primary and fallback URLs, or null if no symbol
|
|
214
|
-
*
|
|
215
|
-
* @example Regular asset
|
|
216
|
-
* getAssetIconUrls('BTC')
|
|
217
|
-
* // → { primary: 'https://raw.githubusercontent.com/.../BTC.svg',
|
|
218
|
-
* // fallback: 'https://app.hyperliquid.xyz/coins/BTC.svg' }
|
|
219
|
-
*
|
|
220
|
-
* @example HIP-3 asset
|
|
221
|
-
* getAssetIconUrls('xyz:TSLA')
|
|
222
|
-
* // → { primary: 'https://raw.githubusercontent.com/.../hip3:xyz_TSLA.svg',
|
|
223
|
-
* // fallback: 'https://app.hyperliquid.xyz/coins/xyz:TSLA.svg' }
|
|
224
|
-
*/
|
|
225
|
-
export declare const getAssetIconUrls: (symbol: string, kPrefixAssets?: Set<string>) => AssetIconUrls | null;
|
|
226
|
-
export {};
|
|
227
|
-
//# sourceMappingURL=marketUtils.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marketUtils.d.mts","sourceRoot":"","sources":["../../src/utils/marketUtils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAEV,eAAe,EAChB,2BAAiB;AAOlB;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MACG,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,OAkCvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,oBAkBtD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,WACvB,MAAM,WACL,oBAAoB,KAC5B,OAQF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,mBAAmB,WACtB,MAAM,OACT,MAAM,GAAG,IAAI,eACL,OAAO,2BACK,qBAAqB,EAAE,2BACvB,qBAAqB,EAAE,KAC/C,OAgCF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,MActD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,MAAM,GAAG,IAc/D,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,YAC3B,sBAAsB,KAC9B,MAuDF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,eAClB,UAAU,GAAG,IAAI,KAC5B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CA6B7B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB,WACrB,KAAK,eAAe,EAAE,YAAY,GAAG,cAAc,CAAC,KAC3D,SAAS,GAAG,SAI0D,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,YACtB,eAAe,EAAE,eACb,MAAM,KAClB,eAAe,EAajB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,kBACE,IAAI,MAAM,CAAC,KAC1B,MAqBF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB,WACnB,MAAM,kBACE,IAAI,MAAM,CAAC,KAC1B,aAAa,GAAG,IA8BlB,CAAC"}
|