@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,366 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BASIS_POINTS_DIVISOR = exports.HIP3_ASSET_ID_CONFIG = exports.HYPERLIQUID_CONFIG = exports.CAIP_ASSET_NAMESPACES = exports.getSupportedAssets = exports.getBridgeInfo = exports.getCaipChainId = exports.getChainId = exports.getWebSocketEndpoint = exports.HYPERLIQUID_WITHDRAWAL_PROGRESS_INTERVAL_MS = exports.HYPERLIQUID_WITHDRAWAL_MINUTES = exports.DEPOSIT_CONFIG = exports.ORDER_BOOK_SPREAD = exports.WITHDRAWAL_ESTIMATED_TIME = exports.METAMASK_WITHDRAWAL_FEE_PLACEHOLDER = exports.METAMASK_WITHDRAWAL_FEE = exports.HYPERLIQUID_WITHDRAWAL_FEE = exports.METAMASK_DEPOSIT_FEE = exports.REFERRAL_CONFIG = exports.BUILDER_FEE_CONFIG = exports.HIP3_FEE_CONFIG = exports.FEE_RATES = exports.TRADING_DEFAULTS = exports.HYPERLIQUID_TRANSPORT_CONFIG = exports.HYPERLIQUID_BRIDGE_CONTRACTS = exports.HYPERLIQUID_ASSET_CONFIGS = exports.METAMASK_PERPS_ICONS_BASE_URL = exports.HYPERLIQUID_ASSET_ICONS_BASE_URL = exports.HYPERLIQUID_ENDPOINTS = exports.USDC_TOKEN_ICON_URL = exports.USDC_ARBITRUM_TESTNET_ADDRESS = exports.USDC_ARBITRUM_MAINNET_ADDRESS = exports.USDC_ETHEREUM_MAINNET_ADDRESS = exports.ARBITRUM_SEPOLIA_CHAIN_ID = exports.ZERO_BALANCE = exports.ZERO_ADDRESS = exports.TOKEN_DECIMALS = exports.USDC_DECIMALS = exports.USDC_NAME = exports.USDC_SYMBOL = exports.HYPERLIQUID_NETWORK_NAME = exports.HYPERLIQUID_TESTNET_CAIP_CHAIN_ID = exports.HYPERLIQUID_MAINNET_CAIP_CHAIN_ID = exports.HYPERLIQUID_TESTNET_CHAIN_ID = exports.HYPERLIQUID_MAINNET_CHAIN_ID = exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID = exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID = exports.ARBITRUM_TESTNET_CHAIN_ID = exports.ARBITRUM_MAINNET_CHAIN_ID = exports.ARBITRUM_MAINNET_CHAIN_ID_HEX = void 0;
|
|
4
|
-
exports.PROGRESS_BAR_COMPLETION_DELAY_MS = exports.WITHDRAWAL_PROGRESS_STAGES = exports.INITIAL_AMOUNT_UI_PROGRESS = exports.USDH_CONFIG = exports.HIP3_MARGIN_CONFIG = exports.TESTNET_HIP3_CONFIG = exports.HIP3_ASSET_MARKET_TYPES = void 0;
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Network Constants
|
|
7
|
-
// ============================================================================
|
|
8
|
-
exports.ARBITRUM_MAINNET_CHAIN_ID_HEX = '0xa4b1';
|
|
9
|
-
exports.ARBITRUM_MAINNET_CHAIN_ID = '42161';
|
|
10
|
-
exports.ARBITRUM_TESTNET_CHAIN_ID = '421614';
|
|
11
|
-
exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID = `eip155:${exports.ARBITRUM_MAINNET_CHAIN_ID}`;
|
|
12
|
-
exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID = `eip155:${exports.ARBITRUM_TESTNET_CHAIN_ID}`;
|
|
13
|
-
// Hyperliquid chain constants
|
|
14
|
-
exports.HYPERLIQUID_MAINNET_CHAIN_ID = '0x3e7'; // 999 in decimal
|
|
15
|
-
exports.HYPERLIQUID_TESTNET_CHAIN_ID = '0x3e6'; // 998 in decimal (assumed)
|
|
16
|
-
exports.HYPERLIQUID_MAINNET_CAIP_CHAIN_ID = 'eip155:999';
|
|
17
|
-
exports.HYPERLIQUID_TESTNET_CAIP_CHAIN_ID = 'eip155:998';
|
|
18
|
-
exports.HYPERLIQUID_NETWORK_NAME = 'Hyperliquid';
|
|
19
|
-
// ============================================================================
|
|
20
|
-
// Token Constants
|
|
21
|
-
// ============================================================================
|
|
22
|
-
exports.USDC_SYMBOL = 'USDC';
|
|
23
|
-
exports.USDC_NAME = 'USD Coin';
|
|
24
|
-
exports.USDC_DECIMALS = 6;
|
|
25
|
-
exports.TOKEN_DECIMALS = 18;
|
|
26
|
-
exports.ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
27
|
-
exports.ZERO_BALANCE = '0x0';
|
|
28
|
-
// Network constants
|
|
29
|
-
exports.ARBITRUM_SEPOLIA_CHAIN_ID = '0x66eee'; // 421614 in decimal
|
|
30
|
-
// USDC token addresses
|
|
31
|
-
exports.USDC_ETHEREUM_MAINNET_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
|
|
32
|
-
exports.USDC_ARBITRUM_MAINNET_ADDRESS = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
|
|
33
|
-
exports.USDC_ARBITRUM_TESTNET_ADDRESS = '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d';
|
|
34
|
-
// USDC token icon URL using MetaMask's official Token Icons API
|
|
35
|
-
// Format: https://static.cx.metamask.io/api/v1/tokenIcons/{chainId}/{contractAddress}.png
|
|
36
|
-
// This URL follows the same pattern used throughout MetaMask (bridges, swaps, etc.)
|
|
37
|
-
exports.USDC_TOKEN_ICON_URL = `https://static.cx.metamask.io/api/v1/tokenIcons/1/${exports.USDC_ETHEREUM_MAINNET_ADDRESS}.png`;
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// WebSocket Endpoints
|
|
40
|
-
// ============================================================================
|
|
41
|
-
exports.HYPERLIQUID_ENDPOINTS = {
|
|
42
|
-
mainnet: 'wss://api.hyperliquid.xyz/ws',
|
|
43
|
-
testnet: 'wss://api.hyperliquid-testnet.xyz/ws',
|
|
44
|
-
};
|
|
45
|
-
// Asset icons base URL (HyperLiquid CDN - fallback source)
|
|
46
|
-
exports.HYPERLIQUID_ASSET_ICONS_BASE_URL = 'https://app.hyperliquid.xyz/coins/';
|
|
47
|
-
// MetaMask-hosted Perps asset icons (primary source)
|
|
48
|
-
// Assets uploaded to: https://github.com/MetaMask/contract-metadata/tree/master/icons/eip155:999
|
|
49
|
-
// HIP-3 assets use format: hip3:dex_SYMBOL.svg (e.g., hip3:xyz_AAPL.svg)
|
|
50
|
-
// Regular assets use format: SYMBOL.svg (e.g., BTC.svg)
|
|
51
|
-
exports.METAMASK_PERPS_ICONS_BASE_URL = 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/icons/eip155:999/';
|
|
52
|
-
// ============================================================================
|
|
53
|
-
// Asset Configurations
|
|
54
|
-
// ============================================================================
|
|
55
|
-
exports.HYPERLIQUID_ASSET_CONFIGS = {
|
|
56
|
-
usdc: {
|
|
57
|
-
mainnet: `${exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID}/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831/default`,
|
|
58
|
-
testnet: `${exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID}/erc20:0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d/default`,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
// HyperLiquid bridge contract addresses for direct USDC deposits
|
|
62
|
-
// These are the official bridge contracts where USDC must be sent to credit user's HyperLiquid account
|
|
63
|
-
exports.HYPERLIQUID_BRIDGE_CONTRACTS = {
|
|
64
|
-
mainnet: {
|
|
65
|
-
chainId: exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID,
|
|
66
|
-
contractAddress: '0x2df1c51e09aecf9cacb7bc98cb1742757f163df7',
|
|
67
|
-
},
|
|
68
|
-
testnet: {
|
|
69
|
-
chainId: exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID,
|
|
70
|
-
contractAddress: '0x08cfc1B6b2dCF36A1480b99353A354AA8AC56f89',
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
// ============================================================================
|
|
74
|
-
// SDK Transport Configuration
|
|
75
|
-
// ============================================================================
|
|
76
|
-
exports.HYPERLIQUID_TRANSPORT_CONFIG = {
|
|
77
|
-
timeout: 10000,
|
|
78
|
-
keepAlive: { interval: 30000 },
|
|
79
|
-
reconnect: {
|
|
80
|
-
maxRetries: 5,
|
|
81
|
-
connectionTimeout: 10000,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
// ============================================================================
|
|
85
|
-
// Trading Configuration Constants
|
|
86
|
-
// ============================================================================
|
|
87
|
-
exports.TRADING_DEFAULTS = {
|
|
88
|
-
leverage: 3, // 3x default leverage
|
|
89
|
-
marginPercent: 10, // 10% fixed margin default
|
|
90
|
-
takeProfitPercent: 0.3, // 30% take profit
|
|
91
|
-
stopLossPercent: 0.1, // 10% stop loss
|
|
92
|
-
amount: {
|
|
93
|
-
mainnet: 10, // $10 minimum order size
|
|
94
|
-
testnet: 10, // $10 minimum order size
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
// Fee configuration
|
|
98
|
-
// Note: These are base rates (Tier 0, no discounts)
|
|
99
|
-
// Actual fees will be calculated based on user's volume tier and staking
|
|
100
|
-
exports.FEE_RATES = {
|
|
101
|
-
taker: 0.00045, // 0.045% - Market orders and aggressive limit orders
|
|
102
|
-
maker: 0.00015, // 0.015% - Limit orders that add liquidity
|
|
103
|
-
};
|
|
104
|
-
// ============================================================================
|
|
105
|
-
// HIP-3 Fee Configuration
|
|
106
|
-
// ============================================================================
|
|
107
|
-
/**
|
|
108
|
-
* HIP-3 dynamic fee calculation configuration
|
|
109
|
-
*
|
|
110
|
-
* HIP-3 (builder-deployed) perpetual markets have variable fees based on:
|
|
111
|
-
* 1. deployerFeeScale - Per-DEX fee multiplier (fetched from perpDexs API)
|
|
112
|
-
* 2. growthMode - Per-asset 90% fee reduction (fetched from meta API)
|
|
113
|
-
*
|
|
114
|
-
* Fee Formula (from HyperLiquid docs):
|
|
115
|
-
* - scaleIfHip3 = deployerFeeScale < 1 ? deployerFeeScale + 1 : deployerFeeScale * 2
|
|
116
|
-
* - growthModeScale = growthMode ? 0.1 : 1
|
|
117
|
-
* - finalRate = baseRate * scaleIfHip3 * growthModeScale
|
|
118
|
-
*
|
|
119
|
-
* Example: For xyz:TSLA with deployerFeeScale=1.0 and growthMode="enabled":
|
|
120
|
-
* - scaleIfHip3 = 1.0 * 2 = 2.0
|
|
121
|
-
* - growthModeScale = 0.1 (90% reduction)
|
|
122
|
-
* - Final multiplier = 2.0 * 0.1 = 0.2 (effectively 80% off standard 2x HIP-3 fees)
|
|
123
|
-
*
|
|
124
|
-
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
|
|
125
|
-
* @see parseAssetName() in HyperLiquidProvider for HIP-3 asset detection
|
|
126
|
-
*/
|
|
127
|
-
exports.HIP3_FEE_CONFIG = {
|
|
128
|
-
/**
|
|
129
|
-
* Growth Mode multiplier - 90% fee reduction for assets in growth phase
|
|
130
|
-
* This is a protocol constant from HyperLiquid's fee formula
|
|
131
|
-
*/
|
|
132
|
-
GrowthModeScale: 0.1,
|
|
133
|
-
/**
|
|
134
|
-
* Default deployerFeeScale when API is unavailable
|
|
135
|
-
* Most HIP-3 DEXs use 1.0, which results in 2x base fees
|
|
136
|
-
*/
|
|
137
|
-
DefaultDeployerFeeScale: 1.0,
|
|
138
|
-
/**
|
|
139
|
-
* Cache TTL for perpDexs data (5 minutes)
|
|
140
|
-
* Fee scales rarely change, so longer cache is acceptable
|
|
141
|
-
*/
|
|
142
|
-
PerpDexsCacheTtlMs: 5 * 60 * 1000,
|
|
143
|
-
/**
|
|
144
|
-
* @deprecated Use dynamic calculation via calculateHip3FeeMultiplier()
|
|
145
|
-
* Kept for backwards compatibility during migration
|
|
146
|
-
*/
|
|
147
|
-
FeeMultiplier: 2,
|
|
148
|
-
};
|
|
149
|
-
const BUILDER_FEE_MAX_FEE_DECIMAL = 0.001;
|
|
150
|
-
// Builder fee configuration
|
|
151
|
-
exports.BUILDER_FEE_CONFIG = {
|
|
152
|
-
// Test builder wallet
|
|
153
|
-
TestnetBuilder: '0x724e57771ba749650875bd8adb2e29a85d0cacfa',
|
|
154
|
-
// Production builder wallet
|
|
155
|
-
MainnetBuilder: '0xe95a5e31904e005066614247d309e00d8ad753aa',
|
|
156
|
-
// Fee in decimal (10 bp = 0.1%)
|
|
157
|
-
MaxFeeDecimal: BUILDER_FEE_MAX_FEE_DECIMAL,
|
|
158
|
-
MaxFeeTenthsBps: BUILDER_FEE_MAX_FEE_DECIMAL * 100000,
|
|
159
|
-
MaxFeeRate: `${(BUILDER_FEE_MAX_FEE_DECIMAL * 100)
|
|
160
|
-
.toFixed(4)
|
|
161
|
-
.replace(/\.?0+$/u, '')}%`,
|
|
162
|
-
};
|
|
163
|
-
// Referral code configuration
|
|
164
|
-
exports.REFERRAL_CONFIG = {
|
|
165
|
-
// Production referral code
|
|
166
|
-
MainnetCode: 'MMCSI',
|
|
167
|
-
// Development/testnet referral code
|
|
168
|
-
TestnetCode: 'MMCSITEST',
|
|
169
|
-
};
|
|
170
|
-
// MetaMask fee for deposits (temporary placeholder)
|
|
171
|
-
exports.METAMASK_DEPOSIT_FEE = '$0.00';
|
|
172
|
-
// Withdrawal fees
|
|
173
|
-
exports.HYPERLIQUID_WITHDRAWAL_FEE = 1; // $1 USD fixed fee
|
|
174
|
-
exports.METAMASK_WITHDRAWAL_FEE = 0; // $0 - no MM fee for withdrawals
|
|
175
|
-
exports.METAMASK_WITHDRAWAL_FEE_PLACEHOLDER = '$0.00'; // Display format
|
|
176
|
-
// Withdrawal timing
|
|
177
|
-
exports.WITHDRAWAL_ESTIMATED_TIME = '5 minutes';
|
|
178
|
-
// Order book spread constants
|
|
179
|
-
exports.ORDER_BOOK_SPREAD = {
|
|
180
|
-
// Default bid/ask spread when real order book data is not available
|
|
181
|
-
// This represents a 0.02% spread (2 basis points) which is typical for liquid markets
|
|
182
|
-
DefaultBidMultiplier: 0.9999, // Bid price is 0.01% below current price
|
|
183
|
-
DefaultAskMultiplier: 1.0001, // Ask price is 0.01% above current price
|
|
184
|
-
};
|
|
185
|
-
// Deposit constants
|
|
186
|
-
exports.DEPOSIT_CONFIG = {
|
|
187
|
-
EstimatedGasLimit: 150000, // Estimated gas limit for bridge deposit
|
|
188
|
-
DefaultSlippage: 1, // 1% default slippage for bridge quotes
|
|
189
|
-
BridgeQuoteTimeout: 1000, // 1 second timeout for bridge quotes
|
|
190
|
-
RefreshRate: 30000, // 30 seconds quote refresh rate
|
|
191
|
-
EstimatedTime: {
|
|
192
|
-
DirectDeposit: '3-5 seconds', // Direct USDC deposit on Arbitrum
|
|
193
|
-
SameChainSwap: '30-60 seconds', // Swap on same chain before deposit
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
// Withdrawal constants (HyperLiquid-specific)
|
|
197
|
-
exports.HYPERLIQUID_WITHDRAWAL_MINUTES = 5; // HyperLiquid withdrawal processing time in minutes
|
|
198
|
-
exports.HYPERLIQUID_WITHDRAWAL_PROGRESS_INTERVAL_MS = 30000; // 30 seconds progress update interval
|
|
199
|
-
// ============================================================================
|
|
200
|
-
// Configuration Helpers
|
|
201
|
-
// ============================================================================
|
|
202
|
-
function getWebSocketEndpoint(isTestnet) {
|
|
203
|
-
return isTestnet
|
|
204
|
-
? exports.HYPERLIQUID_ENDPOINTS.testnet
|
|
205
|
-
: exports.HYPERLIQUID_ENDPOINTS.mainnet;
|
|
206
|
-
}
|
|
207
|
-
exports.getWebSocketEndpoint = getWebSocketEndpoint;
|
|
208
|
-
function getChainId(isTestnet) {
|
|
209
|
-
return isTestnet ? exports.ARBITRUM_TESTNET_CHAIN_ID : exports.ARBITRUM_MAINNET_CHAIN_ID;
|
|
210
|
-
}
|
|
211
|
-
exports.getChainId = getChainId;
|
|
212
|
-
function getCaipChainId(isTestnet) {
|
|
213
|
-
const network = isTestnet ? 'testnet' : 'mainnet';
|
|
214
|
-
return exports.HYPERLIQUID_BRIDGE_CONTRACTS[network].chainId;
|
|
215
|
-
}
|
|
216
|
-
exports.getCaipChainId = getCaipChainId;
|
|
217
|
-
function getBridgeInfo(isTestnet) {
|
|
218
|
-
const network = isTestnet ? 'testnet' : 'mainnet';
|
|
219
|
-
return exports.HYPERLIQUID_BRIDGE_CONTRACTS[network];
|
|
220
|
-
}
|
|
221
|
-
exports.getBridgeInfo = getBridgeInfo;
|
|
222
|
-
function getSupportedAssets(isTestnet) {
|
|
223
|
-
const network = isTestnet ? 'testnet' : 'mainnet';
|
|
224
|
-
return Object.values(exports.HYPERLIQUID_ASSET_CONFIGS).map((config) => config[network]);
|
|
225
|
-
}
|
|
226
|
-
exports.getSupportedAssets = getSupportedAssets;
|
|
227
|
-
// CAIP asset namespace constants
|
|
228
|
-
exports.CAIP_ASSET_NAMESPACES = {
|
|
229
|
-
Erc20: 'erc20',
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* HyperLiquid protocol-specific configuration
|
|
233
|
-
* Contains constants specific to HyperLiquid's perps exchange
|
|
234
|
-
*/
|
|
235
|
-
exports.HYPERLIQUID_CONFIG = {
|
|
236
|
-
// Exchange name used in predicted funding data
|
|
237
|
-
// HyperLiquid uses 'HlPerp' as their perps exchange identifier
|
|
238
|
-
ExchangeName: 'HlPerp',
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* HIP-3 multi-DEX asset ID calculation constants
|
|
242
|
-
* Per HIP-3-IMPLEMENTATION.md:
|
|
243
|
-
* - Main DEX: assetId = index (0, 1, 2, ...)
|
|
244
|
-
* - HIP-3 DEX: assetId = BASE_ASSET_ID + (perpDexIndex × DEX_MULTIPLIER) + index
|
|
245
|
-
*
|
|
246
|
-
* This formula enables proper order routing across multiple DEXs:
|
|
247
|
-
* - Main DEX (perpDexIndex=0): Uses index directly (BTC=0, ETH=1, SOL=2, etc.)
|
|
248
|
-
* - xyz DEX (perpDexIndex=1): 100000 + (1 × 10000) + index = 110000-110999
|
|
249
|
-
* - abc DEX (perpDexIndex=2): 100000 + (2 × 10000) + index = 120000-120999
|
|
250
|
-
*
|
|
251
|
-
* Supports up to 10 HIP-3 DEXs with 10000 assets each.
|
|
252
|
-
*/
|
|
253
|
-
exports.HIP3_ASSET_ID_CONFIG = {
|
|
254
|
-
// Base offset for HIP-3 asset IDs (100000)
|
|
255
|
-
// Ensures HIP-3 asset IDs don't conflict with main DEX indices
|
|
256
|
-
BaseAssetId: 100000,
|
|
257
|
-
// Multiplier for DEX index in asset ID calculation (10000)
|
|
258
|
-
// Allocates 10000 asset ID slots per DEX (0-9999)
|
|
259
|
-
DexMultiplier: 10000,
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* Basis points conversion constant
|
|
263
|
-
* 1 basis point (bp) = 0.01% = 0.0001 as decimal
|
|
264
|
-
* Used for fee discount calculations (e.g., 6500 bps = 65%)
|
|
265
|
-
*/
|
|
266
|
-
exports.BASIS_POINTS_DIVISOR = 10000;
|
|
267
|
-
/**
|
|
268
|
-
* HIP-3 asset market type classifications (PRODUCTION DEFAULT)
|
|
269
|
-
*
|
|
270
|
-
* This is the production default configuration, can be overridden via feature flag
|
|
271
|
-
* (remoteFeatureFlags.perpsAssetMarketTypes) for dynamic control.
|
|
272
|
-
*
|
|
273
|
-
* Maps asset symbols (e.g., "xyz:TSLA") to their market type for badge display.
|
|
274
|
-
*
|
|
275
|
-
* Market type determines the badge shown in the UI:
|
|
276
|
-
* - 'equity': STOCK badge (stocks like TSLA, NVDA)
|
|
277
|
-
* - 'commodity': COMMODITY badge (commodities like GOLD)
|
|
278
|
-
* - 'forex': FOREX badge (forex pairs)
|
|
279
|
-
* - undefined: No badge for crypto or unmapped assets
|
|
280
|
-
*
|
|
281
|
-
* Format: 'dex:SYMBOL' → MarketType
|
|
282
|
-
* This allows flexible per-asset classification.
|
|
283
|
-
* Assets not listed here will have no market type (undefined).
|
|
284
|
-
*/
|
|
285
|
-
exports.HIP3_ASSET_MARKET_TYPES = {
|
|
286
|
-
// xyz DEX - Equities
|
|
287
|
-
'xyz:TSLA': 'equity',
|
|
288
|
-
'xyz:NVDA': 'equity',
|
|
289
|
-
'xyz:XYZ100': 'equity',
|
|
290
|
-
// xyz DEX - Commodities
|
|
291
|
-
'xyz:GOLD': 'commodity',
|
|
292
|
-
'xyz:SILVER': 'commodity',
|
|
293
|
-
'xyz:CL': 'commodity',
|
|
294
|
-
'xyz:COPPER': 'commodity',
|
|
295
|
-
// Future asset mappings as xyz adds more markets
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Testnet-specific HIP-3 DEX configuration
|
|
299
|
-
*
|
|
300
|
-
* On testnet, there are many HIP-3 DEXs (test deployments from various builders).
|
|
301
|
-
* Subscribing to all of them causes connection/subscription overload and instability.
|
|
302
|
-
* This configuration limits which DEXs are discovered and subscribed to on testnet.
|
|
303
|
-
*
|
|
304
|
-
* On mainnet, full DEX discovery continues unchanged.
|
|
305
|
-
*/
|
|
306
|
-
exports.TESTNET_HIP3_CONFIG = {
|
|
307
|
-
/**
|
|
308
|
-
* Allowed DEX names for testnet
|
|
309
|
-
* Empty array = main DEX only (no HIP-3 DEXs)
|
|
310
|
-
* Add specific DEX names to test with particular HIP-3 DEXs: ['testdex1', 'testdex2']
|
|
311
|
-
*/
|
|
312
|
-
EnabledDexs: ['xyz'],
|
|
313
|
-
/**
|
|
314
|
-
* Set to true to enable full HIP-3 discovery on testnet (not recommended)
|
|
315
|
-
* When false, only DEXs in ENABLED_DEXS are used
|
|
316
|
-
*/
|
|
317
|
-
AutoDiscoverAll: false,
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* HIP-3 margin management configuration
|
|
321
|
-
* Controls margin buffers and auto-rebalance behavior for HIP-3 DEXes with isolated margin
|
|
322
|
-
*
|
|
323
|
-
* Background: HyperLiquid validates availableBalance >= totalRequiredMargin BEFORE reallocating
|
|
324
|
-
* existing locked margin. This requires temporary over-funding when increasing positions,
|
|
325
|
-
* followed by automatic cleanup to minimize locked capital.
|
|
326
|
-
*/
|
|
327
|
-
exports.HIP3_MARGIN_CONFIG = {
|
|
328
|
-
/**
|
|
329
|
-
* Margin buffer multiplier for fees and slippage (0.3% = multiply by 1.003)
|
|
330
|
-
* Covers HyperLiquid's max taker fee (0.035%) with comfortable margin
|
|
331
|
-
*/
|
|
332
|
-
BufferMultiplier: 1.003,
|
|
333
|
-
/**
|
|
334
|
-
* Desired buffer to keep on HIP-3 DEX after auto-rebalance (USDC amount)
|
|
335
|
-
* Small buffer allows quick follow-up orders without transfers
|
|
336
|
-
*/
|
|
337
|
-
RebalanceDesiredBuffer: 0.1,
|
|
338
|
-
/**
|
|
339
|
-
* Minimum excess threshold to trigger auto-rebalance (USDC amount)
|
|
340
|
-
* Prevents unnecessary transfers for tiny amounts
|
|
341
|
-
*/
|
|
342
|
-
RebalanceMinThreshold: 0.1,
|
|
343
|
-
};
|
|
344
|
-
/**
|
|
345
|
-
* Configuration for USDH collateral handling on HIP-3 DEXs
|
|
346
|
-
* Per HyperLiquid docs: USDH DEXs pull collateral from spot balance automatically
|
|
347
|
-
*
|
|
348
|
-
* USDH is HyperLiquid's native stablecoin pegged 1:1 to USDC
|
|
349
|
-
*/
|
|
350
|
-
exports.USDH_CONFIG = {
|
|
351
|
-
/** Token name for USDH collateral */
|
|
352
|
-
TokenName: 'USDH',
|
|
353
|
-
/**
|
|
354
|
-
* Maximum slippage for USDC→USDH spot swap in basis points
|
|
355
|
-
* USDH is pegged 1:1 to USDC so slippage should be minimal
|
|
356
|
-
* 10 bps (0.1%) provides small buffer for spread
|
|
357
|
-
*/
|
|
358
|
-
SwapSlippageBps: 10,
|
|
359
|
-
};
|
|
360
|
-
// Progress bar constants
|
|
361
|
-
exports.INITIAL_AMOUNT_UI_PROGRESS = 10;
|
|
362
|
-
exports.WITHDRAWAL_PROGRESS_STAGES = [
|
|
363
|
-
25, 35, 45, 55, 65, 75, 85, 90, 95, 98,
|
|
364
|
-
];
|
|
365
|
-
exports.PROGRESS_BAR_COMPLETION_DELAY_MS = 500;
|
|
366
|
-
//# sourceMappingURL=hyperLiquidConfig.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,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;;;;GAOG;AACU,QAAA,kBAAkB,GAAG;IAChC;;;OAGG;IACH,gBAAgB,EAAE,KAAK;IAEvB;;;OAGG;IACH,sBAAsB,EAAE,GAAG;IAE3B;;;OAGG;IACH,qBAAqB,EAAE,GAAG;CAClB,CAAC;AAEX;;;;;GAKG;AACU,QAAA,WAAW,GAAG;IACzB,qCAAqC;IACrC,SAAS,EAAE,MAAM;IAEjB;;;;OAIG;IACH,eAAe,EAAE,EAAE;CACX,CAAC;AAEX,yBAAyB;AACZ,QAAA,0BAA0B,GAAG,EAAE,CAAC;AAChC,QAAA,0BAA0B,GAAG;IACxC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;CACvC,CAAC;AACW,QAAA,gCAAgC,GAAG,GAAG,CAAC","sourcesContent":["import type { CaipAssetId, CaipChainId, Hex } from '@metamask/utils';\n\n// ============================================================================\n// HyperLiquid Configuration Types\n// ============================================================================\n\n// WebSocket endpoints type\nexport type HyperLiquidEndpoints = {\n mainnet: string;\n testnet: string;\n};\n\n// Asset configuration type\nexport type AssetNetworkConfig = {\n mainnet: CaipAssetId;\n testnet: CaipAssetId;\n};\n\nexport type HyperLiquidAssetConfigs = {\n usdc: AssetNetworkConfig;\n};\n\n// Bridge contract configuration type\nexport type BridgeContractConfig = {\n chainId: CaipChainId;\n contractAddress: Hex;\n};\n\nexport type HyperLiquidBridgeContracts = {\n mainnet: BridgeContractConfig;\n testnet: BridgeContractConfig;\n};\n\n// SDK transport configuration type\nexport type TransportReconnectConfig = {\n maxRetries: number;\n connectionTimeout: number;\n};\n\nexport type TransportKeepAliveConfig = {\n interval: number;\n};\n\nexport type HyperLiquidTransportConfig = {\n timeout: number;\n keepAlive: TransportKeepAliveConfig;\n reconnect: TransportReconnectConfig;\n};\n\n// Trading configuration type\nexport type TradingAmountConfig = {\n mainnet: number;\n testnet: number;\n};\n\nexport type TradingDefaultsConfig = {\n leverage: number;\n marginPercent: number;\n takeProfitPercent: number;\n stopLossPercent: number;\n amount: TradingAmountConfig;\n};\n\n// Fee configuration type\nexport type FeeRatesConfig = {\n taker: number;\n maker: number;\n};\n\n// Network type helper\nexport type HyperLiquidNetwork = 'mainnet' | 'testnet';\n\n// ============================================================================\n// Network Constants\n// ============================================================================\n\nexport const ARBITRUM_MAINNET_CHAIN_ID_HEX = '0xa4b1';\nexport const ARBITRUM_MAINNET_CHAIN_ID = '42161';\nexport const ARBITRUM_TESTNET_CHAIN_ID = '421614';\nexport const ARBITRUM_MAINNET_CAIP_CHAIN_ID = `eip155:${ARBITRUM_MAINNET_CHAIN_ID}`;\nexport const ARBITRUM_TESTNET_CAIP_CHAIN_ID = `eip155:${ARBITRUM_TESTNET_CHAIN_ID}`;\n\n// Hyperliquid chain constants\nexport const HYPERLIQUID_MAINNET_CHAIN_ID = '0x3e7'; // 999 in decimal\nexport const HYPERLIQUID_TESTNET_CHAIN_ID = '0x3e6'; // 998 in decimal (assumed)\nexport const HYPERLIQUID_MAINNET_CAIP_CHAIN_ID = 'eip155:999' as CaipChainId;\nexport const HYPERLIQUID_TESTNET_CAIP_CHAIN_ID = 'eip155:998' as CaipChainId;\nexport const HYPERLIQUID_NETWORK_NAME = 'Hyperliquid';\n\n// ============================================================================\n// Token Constants\n// ============================================================================\n\nexport const USDC_SYMBOL = 'USDC';\nexport const USDC_NAME = 'USD Coin';\nexport const USDC_DECIMALS = 6;\nexport const TOKEN_DECIMALS = 18;\nexport const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';\nexport const ZERO_BALANCE = '0x0';\n\n// Network constants\nexport const ARBITRUM_SEPOLIA_CHAIN_ID = '0x66eee'; // 421614 in decimal\n\n// USDC token addresses\nexport const USDC_ETHEREUM_MAINNET_ADDRESS =\n '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';\nexport const USDC_ARBITRUM_MAINNET_ADDRESS =\n '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';\nexport const USDC_ARBITRUM_TESTNET_ADDRESS =\n '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d';\n\n// USDC token icon URL using MetaMask's official Token Icons API\n// Format: https://static.cx.metamask.io/api/v1/tokenIcons/{chainId}/{contractAddress}.png\n// This URL follows the same pattern used throughout MetaMask (bridges, swaps, etc.)\nexport const USDC_TOKEN_ICON_URL = `https://static.cx.metamask.io/api/v1/tokenIcons/1/${USDC_ETHEREUM_MAINNET_ADDRESS}.png`;\n\n// ============================================================================\n// WebSocket Endpoints\n// ============================================================================\n\nexport const HYPERLIQUID_ENDPOINTS: HyperLiquidEndpoints = {\n mainnet: 'wss://api.hyperliquid.xyz/ws',\n testnet: 'wss://api.hyperliquid-testnet.xyz/ws',\n};\n\n// Asset icons base URL (HyperLiquid CDN - fallback source)\nexport const HYPERLIQUID_ASSET_ICONS_BASE_URL =\n 'https://app.hyperliquid.xyz/coins/';\n\n// MetaMask-hosted Perps asset icons (primary source)\n// Assets uploaded to: https://github.com/MetaMask/contract-metadata/tree/master/icons/eip155:999\n// HIP-3 assets use format: hip3:dex_SYMBOL.svg (e.g., hip3:xyz_AAPL.svg)\n// Regular assets use format: SYMBOL.svg (e.g., BTC.svg)\nexport const METAMASK_PERPS_ICONS_BASE_URL =\n 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/icons/eip155:999/';\n\n// ============================================================================\n// Asset Configurations\n// ============================================================================\n\nexport const HYPERLIQUID_ASSET_CONFIGS: HyperLiquidAssetConfigs = {\n usdc: {\n mainnet: `${ARBITRUM_MAINNET_CAIP_CHAIN_ID}/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831/default`,\n testnet: `${ARBITRUM_TESTNET_CAIP_CHAIN_ID}/erc20:0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d/default`,\n },\n};\n\n// HyperLiquid bridge contract addresses for direct USDC deposits\n// These are the official bridge contracts where USDC must be sent to credit user's HyperLiquid account\nexport const HYPERLIQUID_BRIDGE_CONTRACTS: HyperLiquidBridgeContracts = {\n mainnet: {\n chainId: ARBITRUM_MAINNET_CAIP_CHAIN_ID,\n contractAddress: '0x2df1c51e09aecf9cacb7bc98cb1742757f163df7',\n },\n testnet: {\n chainId: ARBITRUM_TESTNET_CAIP_CHAIN_ID,\n contractAddress: '0x08cfc1B6b2dCF36A1480b99353A354AA8AC56f89',\n },\n};\n\n// ============================================================================\n// SDK Transport Configuration\n// ============================================================================\n\nexport const HYPERLIQUID_TRANSPORT_CONFIG: HyperLiquidTransportConfig = {\n timeout: 10_000,\n keepAlive: { interval: 30_000 },\n reconnect: {\n maxRetries: 5,\n connectionTimeout: 10_000,\n },\n};\n\n// ============================================================================\n// Trading Configuration Constants\n// ============================================================================\n\nexport const TRADING_DEFAULTS: TradingDefaultsConfig = {\n leverage: 3, // 3x default leverage\n marginPercent: 10, // 10% fixed margin default\n takeProfitPercent: 0.3, // 30% take profit\n stopLossPercent: 0.1, // 10% stop loss\n amount: {\n mainnet: 10, // $10 minimum order size\n testnet: 10, // $10 minimum order size\n },\n};\n\n// Fee configuration\n// Note: These are base rates (Tier 0, no discounts)\n// Actual fees will be calculated based on user's volume tier and staking\nexport const FEE_RATES: FeeRatesConfig = {\n taker: 0.00045, // 0.045% - Market orders and aggressive limit orders\n maker: 0.00015, // 0.015% - Limit orders that add liquidity\n};\n\n// ============================================================================\n// HIP-3 Fee Configuration\n// ============================================================================\n\n/**\n * HIP-3 dynamic fee calculation configuration\n *\n * HIP-3 (builder-deployed) perpetual markets have variable fees based on:\n * 1. deployerFeeScale - Per-DEX fee multiplier (fetched from perpDexs API)\n * 2. growthMode - Per-asset 90% fee reduction (fetched from meta API)\n *\n * Fee Formula (from HyperLiquid docs):\n * - scaleIfHip3 = deployerFeeScale < 1 ? deployerFeeScale + 1 : deployerFeeScale * 2\n * - growthModeScale = growthMode ? 0.1 : 1\n * - finalRate = baseRate * scaleIfHip3 * growthModeScale\n *\n * Example: For xyz:TSLA with deployerFeeScale=1.0 and growthMode=\"enabled\":\n * - scaleIfHip3 = 1.0 * 2 = 2.0\n * - growthModeScale = 0.1 (90% reduction)\n * - Final multiplier = 2.0 * 0.1 = 0.2 (effectively 80% off standard 2x HIP-3 fees)\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers\n * @see parseAssetName() in HyperLiquidProvider for HIP-3 asset detection\n */\nexport const HIP3_FEE_CONFIG = {\n /**\n * Growth Mode multiplier - 90% fee reduction for assets in growth phase\n * This is a protocol constant from HyperLiquid's fee formula\n */\n GrowthModeScale: 0.1,\n\n /**\n * Default deployerFeeScale when API is unavailable\n * Most HIP-3 DEXs use 1.0, which results in 2x base fees\n */\n DefaultDeployerFeeScale: 1.0,\n\n /**\n * Cache TTL for perpDexs data (5 minutes)\n * Fee scales rarely change, so longer cache is acceptable\n */\n PerpDexsCacheTtlMs: 5 * 60 * 1000,\n\n /**\n * @deprecated Use dynamic calculation via calculateHip3FeeMultiplier()\n * Kept for backwards compatibility during migration\n */\n FeeMultiplier: 2,\n} as const;\n\nconst BUILDER_FEE_MAX_FEE_DECIMAL = 0.001;\n\n// Builder fee configuration\nexport const BUILDER_FEE_CONFIG = {\n // Test builder wallet\n TestnetBuilder: '0x724e57771ba749650875bd8adb2e29a85d0cacfa' as Hex,\n // Production builder wallet\n MainnetBuilder: '0xe95a5e31904e005066614247d309e00d8ad753aa' as Hex,\n // Fee in decimal (10 bp = 0.1%)\n MaxFeeDecimal: BUILDER_FEE_MAX_FEE_DECIMAL,\n MaxFeeTenthsBps: BUILDER_FEE_MAX_FEE_DECIMAL * 100000,\n MaxFeeRate: `${(BUILDER_FEE_MAX_FEE_DECIMAL * 100)\n .toFixed(4)\n .replace(/\\.?0+$/u, '')}%`,\n};\n\n// Referral code configuration\nexport const REFERRAL_CONFIG = {\n // Production referral code\n MainnetCode: 'MMCSI',\n // Development/testnet referral code\n TestnetCode: 'MMCSITEST',\n};\n\n// MetaMask fee for deposits (temporary placeholder)\nexport const METAMASK_DEPOSIT_FEE = '$0.00';\n\n// Withdrawal fees\nexport const HYPERLIQUID_WITHDRAWAL_FEE = 1; // $1 USD fixed fee\nexport const METAMASK_WITHDRAWAL_FEE = 0; // $0 - no MM fee for withdrawals\nexport const METAMASK_WITHDRAWAL_FEE_PLACEHOLDER = '$0.00'; // Display format\n\n// Withdrawal timing\nexport const WITHDRAWAL_ESTIMATED_TIME = '5 minutes';\n\n// Order book spread constants\nexport const ORDER_BOOK_SPREAD = {\n // Default bid/ask spread when real order book data is not available\n // This represents a 0.02% spread (2 basis points) which is typical for liquid markets\n DefaultBidMultiplier: 0.9999, // Bid price is 0.01% below current price\n DefaultAskMultiplier: 1.0001, // Ask price is 0.01% above current price\n};\n\n// Deposit constants\nexport const DEPOSIT_CONFIG = {\n EstimatedGasLimit: 150000, // Estimated gas limit for bridge deposit\n DefaultSlippage: 1, // 1% default slippage for bridge quotes\n BridgeQuoteTimeout: 1000, // 1 second timeout for bridge quotes\n RefreshRate: 30000, // 30 seconds quote refresh rate\n EstimatedTime: {\n DirectDeposit: '3-5 seconds', // Direct USDC deposit on Arbitrum\n SameChainSwap: '30-60 seconds', // Swap on same chain before deposit\n },\n};\n\n// Withdrawal constants (HyperLiquid-specific)\nexport const HYPERLIQUID_WITHDRAWAL_MINUTES = 5; // HyperLiquid withdrawal processing time in minutes\nexport const HYPERLIQUID_WITHDRAWAL_PROGRESS_INTERVAL_MS = 30000; // 30 seconds progress update interval\n\n// Type helpers\nexport type SupportedAsset = keyof typeof HYPERLIQUID_ASSET_CONFIGS;\n\n// ============================================================================\n// Configuration Helpers\n// ============================================================================\n\nexport function getWebSocketEndpoint(isTestnet: boolean): string {\n return isTestnet\n ? HYPERLIQUID_ENDPOINTS.testnet\n : HYPERLIQUID_ENDPOINTS.mainnet;\n}\n\nexport function getChainId(isTestnet: boolean): string {\n return isTestnet ? ARBITRUM_TESTNET_CHAIN_ID : ARBITRUM_MAINNET_CHAIN_ID;\n}\n\nexport function getCaipChainId(isTestnet: boolean): CaipChainId {\n const network: HyperLiquidNetwork = isTestnet ? 'testnet' : 'mainnet';\n return HYPERLIQUID_BRIDGE_CONTRACTS[network].chainId;\n}\n\nexport function getBridgeInfo(isTestnet: boolean): BridgeContractConfig {\n const network: HyperLiquidNetwork = isTestnet ? 'testnet' : 'mainnet';\n return HYPERLIQUID_BRIDGE_CONTRACTS[network];\n}\n\nexport function getSupportedAssets(isTestnet?: boolean): CaipAssetId[] {\n const network = isTestnet ? 'testnet' : 'mainnet';\n return Object.values(HYPERLIQUID_ASSET_CONFIGS).map(\n (config) => config[network],\n );\n}\n\n// CAIP asset namespace constants\nexport const CAIP_ASSET_NAMESPACES = {\n Erc20: 'erc20',\n} as const;\n\n/**\n * HyperLiquid protocol-specific configuration\n * Contains constants specific to HyperLiquid's perps exchange\n */\nexport const HYPERLIQUID_CONFIG = {\n // Exchange name used in predicted funding data\n // HyperLiquid uses 'HlPerp' as their perps exchange identifier\n ExchangeName: 'HlPerp',\n} as const;\n\n/**\n * HIP-3 multi-DEX asset ID calculation constants\n * Per HIP-3-IMPLEMENTATION.md:\n * - Main DEX: assetId = index (0, 1, 2, ...)\n * - HIP-3 DEX: assetId = BASE_ASSET_ID + (perpDexIndex × DEX_MULTIPLIER) + index\n *\n * This formula enables proper order routing across multiple DEXs:\n * - Main DEX (perpDexIndex=0): Uses index directly (BTC=0, ETH=1, SOL=2, etc.)\n * - xyz DEX (perpDexIndex=1): 100000 + (1 × 10000) + index = 110000-110999\n * - abc DEX (perpDexIndex=2): 100000 + (2 × 10000) + index = 120000-120999\n *\n * Supports up to 10 HIP-3 DEXs with 10000 assets each.\n */\nexport const HIP3_ASSET_ID_CONFIG = {\n // Base offset for HIP-3 asset IDs (100000)\n // Ensures HIP-3 asset IDs don't conflict with main DEX indices\n BaseAssetId: 100000,\n\n // Multiplier for DEX index in asset ID calculation (10000)\n // Allocates 10000 asset ID slots per DEX (0-9999)\n DexMultiplier: 10000,\n} as const;\n\n/**\n * Basis points conversion constant\n * 1 basis point (bp) = 0.01% = 0.0001 as decimal\n * Used for fee discount calculations (e.g., 6500 bps = 65%)\n */\nexport const BASIS_POINTS_DIVISOR = 10000;\n\n/**\n * HIP-3 asset market type classifications (PRODUCTION DEFAULT)\n *\n * This is the production default configuration, can be overridden via feature flag\n * (remoteFeatureFlags.perpsAssetMarketTypes) for dynamic control.\n *\n * Maps asset symbols (e.g., \"xyz:TSLA\") to their market type for badge display.\n *\n * Market type determines the badge shown in the UI:\n * - 'equity': STOCK badge (stocks like TSLA, NVDA)\n * - 'commodity': COMMODITY badge (commodities like GOLD)\n * - 'forex': FOREX badge (forex pairs)\n * - undefined: No badge for crypto or unmapped assets\n *\n * Format: 'dex:SYMBOL' → MarketType\n * This allows flexible per-asset classification.\n * Assets not listed here will have no market type (undefined).\n */\nexport const HIP3_ASSET_MARKET_TYPES: Record<\n string,\n 'equity' | 'commodity' | 'forex' | 'crypto'\n> = {\n // xyz DEX - Equities\n 'xyz:TSLA': 'equity',\n 'xyz:NVDA': 'equity',\n 'xyz:XYZ100': 'equity',\n\n // xyz DEX - Commodities\n 'xyz:GOLD': 'commodity',\n 'xyz:SILVER': 'commodity',\n 'xyz:CL': 'commodity',\n 'xyz:COPPER': 'commodity',\n\n // Future asset mappings as xyz adds more markets\n} as const;\n\n/**\n * Testnet-specific HIP-3 DEX configuration\n *\n * On testnet, there are many HIP-3 DEXs (test deployments from various builders).\n * Subscribing to all of them causes connection/subscription overload and instability.\n * This configuration limits which DEXs are discovered and subscribed to on testnet.\n *\n * On mainnet, full DEX discovery continues unchanged.\n */\nexport const TESTNET_HIP3_CONFIG = {\n /**\n * Allowed DEX names for testnet\n * Empty array = main DEX only (no HIP-3 DEXs)\n * Add specific DEX names to test with particular HIP-3 DEXs: ['testdex1', 'testdex2']\n */\n EnabledDexs: ['xyz'] as string[],\n\n /**\n * Set to true to enable full HIP-3 discovery on testnet (not recommended)\n * When false, only DEXs in ENABLED_DEXS are used\n */\n AutoDiscoverAll: false,\n} as const;\n\n/**\n * HIP-3 margin management configuration\n * Controls margin buffers and auto-rebalance behavior for HIP-3 DEXes with isolated margin\n *\n * Background: HyperLiquid validates availableBalance >= totalRequiredMargin BEFORE reallocating\n * existing locked margin. This requires temporary over-funding when increasing positions,\n * followed by automatic cleanup to minimize locked capital.\n */\nexport const HIP3_MARGIN_CONFIG = {\n /**\n * Margin buffer multiplier for fees and slippage (0.3% = multiply by 1.003)\n * Covers HyperLiquid's max taker fee (0.035%) with comfortable margin\n */\n BufferMultiplier: 1.003,\n\n /**\n * Desired buffer to keep on HIP-3 DEX after auto-rebalance (USDC amount)\n * Small buffer allows quick follow-up orders without transfers\n */\n RebalanceDesiredBuffer: 0.1,\n\n /**\n * Minimum excess threshold to trigger auto-rebalance (USDC amount)\n * Prevents unnecessary transfers for tiny amounts\n */\n RebalanceMinThreshold: 0.1,\n} as const;\n\n/**\n * Configuration for USDH collateral handling on HIP-3 DEXs\n * Per HyperLiquid docs: USDH DEXs pull collateral from spot balance automatically\n *\n * USDH is HyperLiquid's native stablecoin pegged 1:1 to USDC\n */\nexport const USDH_CONFIG = {\n /** Token name for USDH collateral */\n TokenName: 'USDH',\n\n /**\n * Maximum slippage for USDC→USDH spot swap in basis points\n * USDH is pegged 1:1 to USDC so slippage should be minimal\n * 10 bps (0.1%) provides small buffer for spread\n */\n SwapSlippageBps: 10,\n} as const;\n\n// Progress bar constants\nexport const INITIAL_AMOUNT_UI_PROGRESS = 10;\nexport const WITHDRAWAL_PROGRESS_STAGES = [\n 25, 35, 45, 55, 65, 75, 85, 90, 95, 98,\n];\nexport const PROGRESS_BAR_COMPLETION_DELAY_MS = 500;\n"]}
|