@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,461 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PERPS_TRANSACTIONS_HISTORY_CONSTANTS = exports.STOP_LOSS_PROMPT_CONFIG = exports.PERPS_SUPPORT_ARTICLES_URLS = exports.FEEDBACK_CONFIG = exports.SUPPORT_CONFIG = exports.LEARN_MORE_CONFIG = exports.MARKET_SORTING_CONFIG = exports.HOME_SCREEN_CONFIG = exports.DEVELOPMENT_CONFIG = exports.DECIMAL_PRECISION_CONFIG = exports.FUNDING_RATE_CONFIG = exports.DATA_LAKE_API_CONFIG = exports.MARGIN_ADJUSTMENT_CONFIG = exports.CLOSE_POSITION_CONFIG = exports.HYPERLIQUID_ORDER_LIMITS = exports.LIMIT_PRICE_CONFIG = exports.TP_SL_VIEW_CONFIG = exports.TP_SL_CONFIG = exports.LEVERAGE_SLIDER_CONFIG = exports.PERFORMANCE_CONFIG = exports.ORDER_SLIPPAGE_CONFIG = exports.VALIDATION_THRESHOLDS = exports.PERPS_MIN_AGGREGATORS_FOR_TRUST = exports.METAMASK_FEE_CONFIG = exports.WITHDRAWAL_CONSTANTS = exports.PERPS_CONSTANTS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Perps feature constants
|
|
6
|
-
*/
|
|
7
|
-
exports.PERPS_CONSTANTS = {
|
|
8
|
-
FeatureFlagKey: 'perpsEnabled',
|
|
9
|
-
FeatureName: 'perps', // Constant for Sentry error filtering - enables "feature:perps" dashboard queries
|
|
10
|
-
WebsocketTimeout: 5000, // 5 seconds
|
|
11
|
-
WebsocketCleanupDelay: 1000, // 1 second
|
|
12
|
-
BackgroundDisconnectDelay: 20000, // 20 seconds delay before disconnecting when app is backgrounded or when user exits perps UX
|
|
13
|
-
ConnectionTimeoutMs: 10000, // 10 seconds timeout for connection and position loading states
|
|
14
|
-
DefaultMonitoringTimeoutMs: 10000, // 10 seconds default timeout for data monitoring operations
|
|
15
|
-
// Connection timing constants
|
|
16
|
-
ConnectionGracePeriodMs: 20000, // 20 seconds grace period before actual disconnection (same as BackgroundDisconnectDelay for semantic clarity)
|
|
17
|
-
ConnectionAttemptTimeoutMs: 30000, // 30 seconds timeout for connection attempts to prevent indefinite hanging
|
|
18
|
-
WebsocketPingTimeoutMs: 5000, // 5 seconds timeout for WebSocket health check ping
|
|
19
|
-
ReconnectionCleanupDelayMs: 500, // Platform-agnostic delay to ensure WebSocket is ready
|
|
20
|
-
ReconnectionDelayAndroidMs: 300, // Android-specific reconnection delay for better reliability on slower devices
|
|
21
|
-
ReconnectionDelayIosMs: 100, // iOS-specific reconnection delay for optimal performance
|
|
22
|
-
ReconnectionRetryDelayMs: 5000, // 5 seconds delay between reconnection attempts
|
|
23
|
-
// Connection manager timing constants
|
|
24
|
-
BalanceUpdateThrottleMs: 15000, // Update at most every 15 seconds to reduce state updates in PerpsConnectionManager
|
|
25
|
-
InitialDataDelayMs: 100, // Delay to allow initial data to load after connection establishment
|
|
26
|
-
DefaultAssetPreviewLimit: 5,
|
|
27
|
-
DefaultMaxLeverage: 3, // Default fallback max leverage when market data is unavailable - conservative default
|
|
28
|
-
FallbackPriceDisplay: '$---', // Display when price data is unavailable
|
|
29
|
-
FallbackPercentageDisplay: '--%', // Display when change data is unavailable
|
|
30
|
-
FallbackDataDisplay: '--', // Display when non-price data is unavailable
|
|
31
|
-
ZeroAmountDisplay: '$0', // Display for zero dollar amounts (e.g., no volume)
|
|
32
|
-
ZeroAmountDetailedDisplay: '$0.00', // Display for zero dollar amounts with decimals
|
|
33
|
-
RecentActivityLimit: 3,
|
|
34
|
-
// Historical data fetching constants
|
|
35
|
-
FillsLookbackMs: 90 * 24 * 60 * 60 * 1000, // 3 months in milliseconds - limits REST API fills fetch
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Withdrawal-specific constants (protocol-agnostic)
|
|
39
|
-
* Note: Protocol-specific values like estimated time should be defined in each protocol's config
|
|
40
|
-
*/
|
|
41
|
-
exports.WITHDRAWAL_CONSTANTS = {
|
|
42
|
-
DefaultMinAmount: '1.01', // Default minimum withdrawal amount in USDC
|
|
43
|
-
DefaultFeeAmount: 1, // Default withdrawal fee in USDC
|
|
44
|
-
DefaultFeeToken: 'USDC', // Default fee token
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* MetaMask fee configuration for Perps trading
|
|
48
|
-
* These fees are protocol-agnostic and apply on top of protocol fees
|
|
49
|
-
*/
|
|
50
|
-
exports.METAMASK_FEE_CONFIG = {
|
|
51
|
-
// Deposit/withdrawal fees
|
|
52
|
-
DepositFee: 0, // $0 currently
|
|
53
|
-
WithdrawalFee: 0, // $0 currently
|
|
54
|
-
// Future: Fee configuration will be fetched from API based on:
|
|
55
|
-
// - User tier/volume (for MetaMask fee discounts)
|
|
56
|
-
// - Promotional campaigns
|
|
57
|
-
// - Protocol-specific agreements
|
|
58
|
-
// - MetaMask points/rewards integration
|
|
59
|
-
// Note: Trading fees are now handled by each provider's calculateFees()
|
|
60
|
-
// which returns complete fee breakdown including MetaMask fees
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Minimum number of aggregators (exchanges) a token must be listed on
|
|
64
|
-
* to be considered trustworthy for showing the Perps Discovery Banner.
|
|
65
|
-
* Native tokens (ETH, BNB, etc.) bypass this check.
|
|
66
|
-
*/
|
|
67
|
-
exports.PERPS_MIN_AGGREGATORS_FOR_TRUST = 2;
|
|
68
|
-
/**
|
|
69
|
-
* Validation thresholds for UI warnings and checks
|
|
70
|
-
* These values control when warnings are shown to users
|
|
71
|
-
*/
|
|
72
|
-
exports.VALIDATION_THRESHOLDS = {
|
|
73
|
-
// Leverage threshold for warning users about high leverage
|
|
74
|
-
HighLeverageWarning: 20, // Show warning when leverage > 20x
|
|
75
|
-
// Limit price difference threshold (as decimal, 0.1 = 10%)
|
|
76
|
-
LimitPriceDifferenceWarning: 0.1, // Warn if limit price differs by >10% from current price
|
|
77
|
-
// Price deviation threshold (as decimal, 0.1 = 10%)
|
|
78
|
-
PriceDeviation: 0.1, // Warn if perps price deviates by >10% from spot price
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Order slippage configuration
|
|
82
|
-
* Controls default slippage tolerance for different order types
|
|
83
|
-
* Conservative defaults based on HyperLiquid platform interface
|
|
84
|
-
* See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md
|
|
85
|
-
*/
|
|
86
|
-
exports.ORDER_SLIPPAGE_CONFIG = {
|
|
87
|
-
// Market order slippage (basis points)
|
|
88
|
-
// 300 basis points = 3% = 0.03 decimal
|
|
89
|
-
// Conservative default for measured rollout, prevents most IOC failures
|
|
90
|
-
DefaultMarketSlippageBps: 300,
|
|
91
|
-
// TP/SL order slippage (basis points)
|
|
92
|
-
// 1000 basis points = 10% = 0.10 decimal
|
|
93
|
-
// Aligns with HyperLiquid platform default for triggered orders
|
|
94
|
-
DefaultTpslSlippageBps: 1000,
|
|
95
|
-
// Limit order slippage (basis points)
|
|
96
|
-
// 100 basis points = 1% = 0.01 decimal
|
|
97
|
-
// Kept conservative as limit orders rest on book (not IOC/immediate execution)
|
|
98
|
-
DefaultLimitSlippageBps: 100,
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Performance optimization constants
|
|
102
|
-
* These values control debouncing and throttling for better performance
|
|
103
|
-
*/
|
|
104
|
-
exports.PERFORMANCE_CONFIG = {
|
|
105
|
-
// Price updates debounce delay (milliseconds)
|
|
106
|
-
// Batches rapid WebSocket price updates to reduce re-renders
|
|
107
|
-
PriceUpdateDebounceMs: 1000,
|
|
108
|
-
// Order validation debounce delay (milliseconds)
|
|
109
|
-
// Prevents excessive validation calls during rapid form input changes
|
|
110
|
-
ValidationDebounceMs: 300,
|
|
111
|
-
// Liquidation price debounce delay (milliseconds)
|
|
112
|
-
// Prevents excessive liquidation price calls during rapid form input changes
|
|
113
|
-
LiquidationPriceDebounceMs: 500,
|
|
114
|
-
// Navigation params delay (milliseconds)
|
|
115
|
-
// Required for React Navigation to complete state transitions before setting params
|
|
116
|
-
// This ensures navigation context is available when programmatically selecting tabs
|
|
117
|
-
NavigationParamsDelayMs: 200,
|
|
118
|
-
// Tab control reset delay (milliseconds)
|
|
119
|
-
// Delay to reset programmatic tab control after tab switching to prevent render loops
|
|
120
|
-
TabControlResetDelayMs: 500,
|
|
121
|
-
// Market data cache duration (milliseconds)
|
|
122
|
-
// How long to cache market list data before fetching fresh data
|
|
123
|
-
MarketDataCacheDurationMs: 5 * 60 * 1000, // 5 minutes
|
|
124
|
-
// Asset metadata cache duration (milliseconds)
|
|
125
|
-
// How long to cache asset icon validation results
|
|
126
|
-
AssetMetadataCacheDurationMs: 60 * 60 * 1000, // 1 hour
|
|
127
|
-
// Max leverage cache duration (milliseconds)
|
|
128
|
-
// How long to cache max leverage values per asset (leverage rarely changes)
|
|
129
|
-
MaxLeverageCacheDurationMs: 60 * 60 * 1000, // 1 hour
|
|
130
|
-
// Rewards cache durations (milliseconds)
|
|
131
|
-
// How long to cache fee discount data from rewards API
|
|
132
|
-
FeeDiscountCacheDurationMs: 5 * 60 * 1000, // 5 minutes
|
|
133
|
-
// How long to cache points calculation parameters from rewards API
|
|
134
|
-
PointsCalculationCacheDurationMs: 5 * 60 * 1000, // 5 minutes
|
|
135
|
-
/**
|
|
136
|
-
* Performance logging markers for filtering logs during development and debugging
|
|
137
|
-
* These markers help isolate performance-related logs from general application logs
|
|
138
|
-
* Usage: Use in DevLogger calls to easily filter specific performance areas
|
|
139
|
-
* Impact: Development only (uses DevLogger) - zero production performance cost
|
|
140
|
-
*
|
|
141
|
-
* Examples:
|
|
142
|
-
* - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`
|
|
143
|
-
* - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`
|
|
144
|
-
* - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`
|
|
145
|
-
* - Filter all Perps performance: `adb logcat | grep PERPSMARK_`
|
|
146
|
-
*/
|
|
147
|
-
LoggingMarkers: {
|
|
148
|
-
// Sentry performance measurement logs (screen loads, bottom sheets, API timing)
|
|
149
|
-
SentryPerformance: 'PERPSMARK_SENTRY',
|
|
150
|
-
// MetaMetrics event tracking logs (user interactions, business analytics)
|
|
151
|
-
MetametricsEvents: 'PERPSMARK_METRICS',
|
|
152
|
-
// WebSocket performance logs (connection timing, data flow, reconnections)
|
|
153
|
-
WebsocketPerformance: 'PERPSMARK_SENTRY_WS',
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Leverage slider UI configuration
|
|
158
|
-
* Controls the visual and interactive aspects of the leverage slider
|
|
159
|
-
*/
|
|
160
|
-
exports.LEVERAGE_SLIDER_CONFIG = {
|
|
161
|
-
// Step sizes for tick marks based on max leverage
|
|
162
|
-
TickStepLow: 5, // Step size when max leverage <= 20
|
|
163
|
-
TickStepMedium: 10, // Step size when max leverage <= 50
|
|
164
|
-
TickStepHigh: 20, // Step size when max leverage > 50
|
|
165
|
-
// Thresholds for determining tick step size
|
|
166
|
-
MaxLeverageLowThreshold: 20,
|
|
167
|
-
MaxLeverageMediumThreshold: 50,
|
|
168
|
-
};
|
|
169
|
-
exports.TP_SL_CONFIG = {
|
|
170
|
-
UsePositionBoundTpsl: true,
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* TP/SL View UI configuration
|
|
174
|
-
* Controls the Take Profit / Stop Loss screen behavior and display options
|
|
175
|
-
*/
|
|
176
|
-
exports.TP_SL_VIEW_CONFIG = {
|
|
177
|
-
// Quick percentage button presets for Take Profit (positive RoE percentages)
|
|
178
|
-
TakeProfitRoePresets: [10, 25, 50, 100], // +10%, +25%, +50%, +100% RoE
|
|
179
|
-
// Quick percentage button presets for Stop Loss (negative RoE percentages)
|
|
180
|
-
StopLossRoePresets: [-5, -10, -25, -50], // -5%, -10%, -25%, -50% RoE
|
|
181
|
-
// WebSocket price update throttle delay (milliseconds)
|
|
182
|
-
// Reduces re-renders by batching price updates in the TP/SL screen
|
|
183
|
-
PriceThrottleMs: 1000,
|
|
184
|
-
// Maximum number of digits allowed in price/percentage input fields
|
|
185
|
-
// Prevents overflow and maintains reasonable input constraints
|
|
186
|
-
MaxInputDigits: 9,
|
|
187
|
-
// Keypad configuration for price inputs
|
|
188
|
-
// USD_PERPS is not a real currency - it's a custom configuration
|
|
189
|
-
// that allows 5 decimal places for crypto prices, overriding the
|
|
190
|
-
// default USD configuration which only allows 2 decimal places
|
|
191
|
-
KeypadCurrencyCode: 'USD_PERPS',
|
|
192
|
-
KeypadDecimals: 5,
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Limit price configuration
|
|
196
|
-
* Controls preset percentages and behavior for limit orders
|
|
197
|
-
*/
|
|
198
|
-
exports.LIMIT_PRICE_CONFIG = {
|
|
199
|
-
// Preset percentage options for quick selection
|
|
200
|
-
PresetPercentages: [1, 2], // Available as both positive and negative
|
|
201
|
-
// Modal opening delay when switching to limit order (milliseconds)
|
|
202
|
-
// Allows order type modal to close smoothly before opening limit price modal
|
|
203
|
-
ModalOpenDelay: 300,
|
|
204
|
-
// Direction-specific preset configurations (Mid/Bid/Ask buttons handled separately)
|
|
205
|
-
LongPresets: [-1, -2], // Buy below market for long orders
|
|
206
|
-
ShortPresets: [1, 2], // Sell above market for short orders
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* HyperLiquid order limits based on leverage
|
|
210
|
-
* From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications
|
|
211
|
-
*/
|
|
212
|
-
exports.HYPERLIQUID_ORDER_LIMITS = {
|
|
213
|
-
// Market orders
|
|
214
|
-
MarketOrderLimits: {
|
|
215
|
-
// $15,000,000 for max leverage >= 25
|
|
216
|
-
HighLeverage: 15000000,
|
|
217
|
-
// $5,000,000 for max leverage in [20, 25)
|
|
218
|
-
MediumHighLeverage: 5000000,
|
|
219
|
-
// $2,000,000 for max leverage in [10, 20)
|
|
220
|
-
MediumLeverage: 2000000,
|
|
221
|
-
// $500,000 for max leverage < 10
|
|
222
|
-
LowLeverage: 500000,
|
|
223
|
-
},
|
|
224
|
-
// Limit orders are 10x market order limits
|
|
225
|
-
LimitOrderMultiplier: 10,
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Close position configuration
|
|
229
|
-
* Controls behavior and constants specific to position closing
|
|
230
|
-
*/
|
|
231
|
-
exports.CLOSE_POSITION_CONFIG = {
|
|
232
|
-
// Decimal places for USD amount input display
|
|
233
|
-
UsdDecimalPlaces: 2,
|
|
234
|
-
// Default close percentage when opening the close position view
|
|
235
|
-
DefaultClosePercentage: 100,
|
|
236
|
-
// Precision for position size calculations to prevent rounding errors
|
|
237
|
-
AmountCalculationPrecision: 6,
|
|
238
|
-
// Throttle delay for real-time price updates during position closing
|
|
239
|
-
PriceThrottleMs: 3000,
|
|
240
|
-
// Fallback decimal places for tokens without metadata
|
|
241
|
-
FallbackTokenDecimals: 18,
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* Margin adjustment configuration
|
|
245
|
-
* Controls behavior for adding/removing margin from positions
|
|
246
|
-
*/
|
|
247
|
-
exports.MARGIN_ADJUSTMENT_CONFIG = {
|
|
248
|
-
// Risk thresholds for margin removal warnings
|
|
249
|
-
// Threshold values represent ratio of (price distance to liquidation) / (liquidation price)
|
|
250
|
-
// Values < 1.0 mean price is dangerously close to liquidation
|
|
251
|
-
LiquidationRiskThreshold: 1.2, // 20% buffer before liquidation - triggers danger state
|
|
252
|
-
LiquidationWarningThreshold: 1.5, // 50% buffer before liquidation - triggers warning state
|
|
253
|
-
// Minimum margin adjustment amount (USD)
|
|
254
|
-
// Prevents dust adjustments and ensures meaningful position changes
|
|
255
|
-
MinAdjustmentAmount: 1,
|
|
256
|
-
// Precision for margin calculations
|
|
257
|
-
// Ensures accurate decimal handling in margin/leverage calculations
|
|
258
|
-
CalculationPrecision: 6,
|
|
259
|
-
// Safety buffer for margin removal to account for HyperLiquid's transfer margin requirement
|
|
260
|
-
// HyperLiquid enforces: transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)
|
|
261
|
-
// See: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margin-and-pnl
|
|
262
|
-
MarginRemovalSafetyBuffer: 0.1,
|
|
263
|
-
// Fallback max leverage when market data is unavailable
|
|
264
|
-
// Conservative value to prevent over-removal of margin
|
|
265
|
-
// Most HyperLiquid assets support at least 50x leverage
|
|
266
|
-
FallbackMaxLeverage: 50,
|
|
267
|
-
};
|
|
268
|
-
/**
|
|
269
|
-
* Data Lake API configuration
|
|
270
|
-
* Endpoints for reporting perps trading activity for notifications
|
|
271
|
-
*/
|
|
272
|
-
exports.DATA_LAKE_API_CONFIG = {
|
|
273
|
-
// Order reporting endpoint - only used for mainnet perps trading
|
|
274
|
-
OrdersEndpoint: 'https://perps.api.cx.metamask.io/api/v1/orders',
|
|
275
|
-
};
|
|
276
|
-
/**
|
|
277
|
-
* Funding rate display configuration
|
|
278
|
-
* Controls how funding rates are formatted and displayed across the app
|
|
279
|
-
*/
|
|
280
|
-
exports.FUNDING_RATE_CONFIG = {
|
|
281
|
-
// Number of decimal places to display for funding rates
|
|
282
|
-
Decimals: 4,
|
|
283
|
-
// Default display value when funding rate is zero or unavailable
|
|
284
|
-
ZeroDisplay: '0.0000%',
|
|
285
|
-
// Multiplier to convert decimal funding rate to percentage
|
|
286
|
-
PercentageMultiplier: 100,
|
|
287
|
-
};
|
|
288
|
-
/**
|
|
289
|
-
* Decimal precision configuration
|
|
290
|
-
* Controls maximum decimal places for price and input validation
|
|
291
|
-
*/
|
|
292
|
-
exports.DECIMAL_PRECISION_CONFIG = {
|
|
293
|
-
// Maximum decimal places for price input (matches Hyperliquid limit)
|
|
294
|
-
// Used in TP/SL forms, limit price inputs, and price validation
|
|
295
|
-
MaxPriceDecimals: 6,
|
|
296
|
-
// Maximum significant figures allowed by HyperLiquid API
|
|
297
|
-
// Orders with more than 5 significant figures will be rejected
|
|
298
|
-
MaxSignificantFigures: 5,
|
|
299
|
-
// Defensive fallback for size decimals when market data fails to load
|
|
300
|
-
// Real szDecimals should always come from market data API (varies by asset)
|
|
301
|
-
// Using 6 as safe maximum to prevent crashes (covers most assets)
|
|
302
|
-
// NOTE: This is NOT semantically correct - just a defensive measure
|
|
303
|
-
FallbackSizeDecimals: 6,
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* Development-only configuration for testing and debugging
|
|
307
|
-
* These constants are only active when __DEV__ is true
|
|
308
|
-
*/
|
|
309
|
-
exports.DEVELOPMENT_CONFIG = {
|
|
310
|
-
// Magic number to simulate fee discount state (20% discount)
|
|
311
|
-
SimulateFeeDiscountAmount: 41,
|
|
312
|
-
// Magic number to simulate rewards error state (set order amount to this value)
|
|
313
|
-
SimulateRewardsErrorAmount: 42,
|
|
314
|
-
// Magic number to simulate rewards loading state
|
|
315
|
-
SimulateRewardsLoadingAmount: 43,
|
|
316
|
-
// Future: Add other development helpers as needed
|
|
317
|
-
};
|
|
318
|
-
/**
|
|
319
|
-
* Home screen configuration
|
|
320
|
-
* Controls carousel limits and display settings for the main Perps home screen
|
|
321
|
-
*/
|
|
322
|
-
exports.HOME_SCREEN_CONFIG = {
|
|
323
|
-
// Show action buttons (Add Funds / Withdraw) in header instead of fixed footer
|
|
324
|
-
// Can be controlled via feature flag in the future
|
|
325
|
-
ShowHeaderActionButtons: true,
|
|
326
|
-
// Maximum number of items to show in each carousel
|
|
327
|
-
PositionsCarouselLimit: 10,
|
|
328
|
-
OrdersCarouselLimit: 10,
|
|
329
|
-
TrendingMarketsLimit: 5,
|
|
330
|
-
RecentActivityLimit: 3,
|
|
331
|
-
// Carousel display behavior
|
|
332
|
-
CarouselSnapAlignment: 'start',
|
|
333
|
-
CarouselVisibleItems: 1.2, // Show 1 full item + 20% of next
|
|
334
|
-
// Icon sizes for consistent display across sections
|
|
335
|
-
DefaultIconSize: 40, // Default token icon size for cards and rows
|
|
336
|
-
};
|
|
337
|
-
/**
|
|
338
|
-
* Market sorting configuration
|
|
339
|
-
* Controls sorting behavior and presets for the trending markets view
|
|
340
|
-
*/
|
|
341
|
-
exports.MARKET_SORTING_CONFIG = {
|
|
342
|
-
// Default sort settings
|
|
343
|
-
DefaultSortOptionId: 'volume',
|
|
344
|
-
DefaultDirection: 'desc',
|
|
345
|
-
// Available sort fields (only includes fields supported by PerpsMarketData)
|
|
346
|
-
SortFields: {
|
|
347
|
-
Volume: 'volume',
|
|
348
|
-
PriceChange: 'priceChange',
|
|
349
|
-
OpenInterest: 'openInterest',
|
|
350
|
-
FundingRate: 'fundingRate',
|
|
351
|
-
},
|
|
352
|
-
// Sort button presets for filter chips (simplified buttons without direction)
|
|
353
|
-
SortButtonPresets: [
|
|
354
|
-
{ field: 'volume', labelKey: 'perps.sort.volume' },
|
|
355
|
-
{ field: 'priceChange', labelKey: 'perps.sort.price_change' },
|
|
356
|
-
{ field: 'fundingRate', labelKey: 'perps.sort.funding_rate' },
|
|
357
|
-
],
|
|
358
|
-
// Sort options for the bottom sheet
|
|
359
|
-
// Only Price Change can be toggled for direction (similar to trending tokens pattern)
|
|
360
|
-
// Other options (volume, open interest, funding rate) use descending sort only
|
|
361
|
-
SortOptions: [
|
|
362
|
-
{
|
|
363
|
-
id: 'volume',
|
|
364
|
-
labelKey: 'perps.sort.volume',
|
|
365
|
-
field: 'volume',
|
|
366
|
-
direction: 'desc',
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
id: 'priceChange',
|
|
370
|
-
labelKey: 'perps.sort.price_change',
|
|
371
|
-
field: 'priceChange',
|
|
372
|
-
direction: 'desc',
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
id: 'openInterest',
|
|
376
|
-
labelKey: 'perps.sort.open_interest',
|
|
377
|
-
field: 'openInterest',
|
|
378
|
-
direction: 'desc',
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
id: 'fundingRate',
|
|
382
|
-
labelKey: 'perps.sort.funding_rate',
|
|
383
|
-
field: 'fundingRate',
|
|
384
|
-
direction: 'desc',
|
|
385
|
-
},
|
|
386
|
-
],
|
|
387
|
-
};
|
|
388
|
-
/**
|
|
389
|
-
* Learn more card configuration
|
|
390
|
-
* External resources and content for Perps education
|
|
391
|
-
*/
|
|
392
|
-
exports.LEARN_MORE_CONFIG = {
|
|
393
|
-
ExternalUrl: 'https://metamask.io/perps',
|
|
394
|
-
TitleKey: 'perps.tutorial.card.title',
|
|
395
|
-
DescriptionKey: 'perps.learn_more.description',
|
|
396
|
-
CtaKey: 'perps.learn_more.cta',
|
|
397
|
-
};
|
|
398
|
-
/**
|
|
399
|
-
* Support configuration
|
|
400
|
-
* Contact support button configuration (matches Settings behavior)
|
|
401
|
-
*/
|
|
402
|
-
exports.SUPPORT_CONFIG = {
|
|
403
|
-
Url: 'https://support.metamask.io',
|
|
404
|
-
TitleKey: 'perps.support.title',
|
|
405
|
-
DescriptionKey: 'perps.support.description',
|
|
406
|
-
};
|
|
407
|
-
/**
|
|
408
|
-
* Feedback survey configuration
|
|
409
|
-
* External survey for collecting user feedback on Perps trading experience
|
|
410
|
-
*/
|
|
411
|
-
exports.FEEDBACK_CONFIG = {
|
|
412
|
-
Url: 'https://survey.alchemer.com/s3/8649911/MetaMask-Perps-Trading-Feedback',
|
|
413
|
-
TitleKey: 'perps.feedback.title',
|
|
414
|
-
};
|
|
415
|
-
/**
|
|
416
|
-
* Support article URLs
|
|
417
|
-
* Links to specific MetaMask support articles for Perps features
|
|
418
|
-
*/
|
|
419
|
-
exports.PERPS_SUPPORT_ARTICLES_URLS = {
|
|
420
|
-
AdlUrl: 'https://support.metamask.io/manage-crypto/trade/perps/leverage-and-liquidation/#what-is-auto-deleveraging-adl',
|
|
421
|
-
};
|
|
422
|
-
/**
|
|
423
|
-
* Stop loss prompt banner configuration
|
|
424
|
-
* Controls when and how the stop loss prompt banner is displayed
|
|
425
|
-
* Based on TAT-1693 specifications
|
|
426
|
-
*/
|
|
427
|
-
exports.STOP_LOSS_PROMPT_CONFIG = {
|
|
428
|
-
// Distance to liquidation threshold (percentage)
|
|
429
|
-
// Shows "Add margin" banner when position is within this % of liquidation
|
|
430
|
-
LiquidationDistanceThreshold: 3,
|
|
431
|
-
// ROE (Return on Equity) threshold (percentage)
|
|
432
|
-
// Shows "Set stop loss" banner when ROE drops below this value
|
|
433
|
-
RoeThreshold: -10,
|
|
434
|
-
// Minimum loss threshold to show ANY banner (percentage)
|
|
435
|
-
// No banner shown until ROE drops below this value
|
|
436
|
-
MinLossThreshold: -10,
|
|
437
|
-
// Debounce duration for ROE threshold (milliseconds)
|
|
438
|
-
// User must have ROE below threshold for this duration before showing banner
|
|
439
|
-
// Prevents banner from appearing during temporary price fluctuations
|
|
440
|
-
RoeDebounceMs: 60000, // 60 seconds
|
|
441
|
-
// Minimum position age before showing any banner (milliseconds)
|
|
442
|
-
// Prevents banner from appearing immediately after opening a position
|
|
443
|
-
PositionMinAgeMs: 60000, // 60 seconds
|
|
444
|
-
// Suggested stop loss ROE percentage
|
|
445
|
-
// When suggesting a stop loss, calculate price at this ROE from entry
|
|
446
|
-
SuggestedStopLossRoe: -50,
|
|
447
|
-
};
|
|
448
|
-
/**
|
|
449
|
-
* Transactions history configuration
|
|
450
|
-
* Controls history display and data fetching parameters
|
|
451
|
-
*/
|
|
452
|
-
exports.PERPS_TRANSACTIONS_HISTORY_CONSTANTS = {
|
|
453
|
-
/**
|
|
454
|
-
* Default number of days to look back for funding history.
|
|
455
|
-
* HyperLiquid API requires a startTime and returns max 500 records.
|
|
456
|
-
* Using 365 days ensures most users see their complete recent history.
|
|
457
|
-
* Can be increased if users need older funding data.
|
|
458
|
-
*/
|
|
459
|
-
DefaultFundingHistoryDays: 365,
|
|
460
|
-
};
|
|
461
|
-
//# sourceMappingURL=perpsConfig.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"perpsConfig.cjs","sourceRoot":"","sources":["../../src/constants/perpsConfig.ts"],"names":[],"mappings":";;;AAAA;;GAE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,EAAE,8BAA8B;IAC9C,MAAM,EAAE,sBAAsB;CACtB,CAAC;AAEX;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,GAAG,EAAE,6BAA6B;IAClC,QAAQ,EAAE,qBAAqB;IAC/B,cAAc,EAAE,2BAA2B;CACnC,CAAC;AAEX;;;GAGG;AACU,QAAA,eAAe,GAAG;IAC7B,GAAG,EAAE,wEAAwE;IAC7E,QAAQ,EAAE,sBAAsB;CACxB,CAAC;AAEX;;;GAGG;AACU,QAAA,2BAA2B,GAAG;IACzC,MAAM,EACJ,+GAA+G;CACzG,CAAC;AAEX;;;;GAIG;AACU,QAAA,uBAAuB,GAAG;IACrC,iDAAiD;IACjD,0EAA0E;IAC1E,4BAA4B,EAAE,CAAC;IAE/B,gDAAgD;IAChD,+DAA+D;IAC/D,YAAY,EAAE,CAAC,EAAE;IAEjB,yDAAyD;IACzD,mDAAmD;IACnD,gBAAgB,EAAE,CAAC,EAAE;IAErB,qDAAqD;IACrD,6EAA6E;IAC7E,qEAAqE;IACrE,aAAa,EAAE,KAAM,EAAE,aAAa;IAEpC,gEAAgE;IAChE,sEAAsE;IACtE,gBAAgB,EAAE,KAAM,EAAE,aAAa;IAEvC,qCAAqC;IACrC,sEAAsE;IACtE,oBAAoB,EAAE,CAAC,EAAE;CACjB,CAAC;AAEX;;;GAGG;AACU,QAAA,oCAAoC,GAAG;IAClD;;;;;OAKG;IACH,yBAAyB,EAAE,GAAG;CACtB,CAAC","sourcesContent":["/**\n * Perps feature constants\n */\nexport const PERPS_CONSTANTS = {\n FeatureFlagKey: 'perpsEnabled',\n FeatureName: 'perps', // Constant for Sentry error filtering - enables \"feature:perps\" dashboard queries\n WebsocketTimeout: 5000, // 5 seconds\n WebsocketCleanupDelay: 1000, // 1 second\n BackgroundDisconnectDelay: 20_000, // 20 seconds delay before disconnecting when app is backgrounded or when user exits perps UX\n ConnectionTimeoutMs: 10_000, // 10 seconds timeout for connection and position loading states\n DefaultMonitoringTimeoutMs: 10_000, // 10 seconds default timeout for data monitoring operations\n\n // Connection timing constants\n ConnectionGracePeriodMs: 20_000, // 20 seconds grace period before actual disconnection (same as BackgroundDisconnectDelay for semantic clarity)\n ConnectionAttemptTimeoutMs: 30_000, // 30 seconds timeout for connection attempts to prevent indefinite hanging\n WebsocketPingTimeoutMs: 5_000, // 5 seconds timeout for WebSocket health check ping\n ReconnectionCleanupDelayMs: 500, // Platform-agnostic delay to ensure WebSocket is ready\n ReconnectionDelayAndroidMs: 300, // Android-specific reconnection delay for better reliability on slower devices\n ReconnectionDelayIosMs: 100, // iOS-specific reconnection delay for optimal performance\n ReconnectionRetryDelayMs: 5_000, // 5 seconds delay between reconnection attempts\n\n // Connection manager timing constants\n BalanceUpdateThrottleMs: 15000, // Update at most every 15 seconds to reduce state updates in PerpsConnectionManager\n InitialDataDelayMs: 100, // Delay to allow initial data to load after connection establishment\n\n DefaultAssetPreviewLimit: 5,\n DefaultMaxLeverage: 3 as number, // Default fallback max leverage when market data is unavailable - conservative default\n FallbackPriceDisplay: '$---', // Display when price data is unavailable\n FallbackPercentageDisplay: '--%', // Display when change data is unavailable\n FallbackDataDisplay: '--', // Display when non-price data is unavailable\n ZeroAmountDisplay: '$0', // Display for zero dollar amounts (e.g., no volume)\n ZeroAmountDetailedDisplay: '$0.00', // Display for zero dollar amounts with decimals\n\n RecentActivityLimit: 3,\n\n // Historical data fetching constants\n FillsLookbackMs: 90 * 24 * 60 * 60 * 1000, // 3 months in milliseconds - limits REST API fills fetch\n} as const;\n\n/**\n * Withdrawal-specific constants (protocol-agnostic)\n * Note: Protocol-specific values like estimated time should be defined in each protocol's config\n */\nexport const WITHDRAWAL_CONSTANTS = {\n DefaultMinAmount: '1.01', // Default minimum withdrawal amount in USDC\n DefaultFeeAmount: 1, // Default withdrawal fee in USDC\n DefaultFeeToken: 'USDC', // Default fee token\n} as const;\n\n/**\n * MetaMask fee configuration for Perps trading\n * These fees are protocol-agnostic and apply on top of protocol fees\n */\nexport const METAMASK_FEE_CONFIG = {\n // Deposit/withdrawal fees\n DepositFee: 0, // $0 currently\n WithdrawalFee: 0, // $0 currently\n\n // Future: Fee configuration will be fetched from API based on:\n // - User tier/volume (for MetaMask fee discounts)\n // - Promotional campaigns\n // - Protocol-specific agreements\n // - MetaMask points/rewards integration\n // Note: Trading fees are now handled by each provider's calculateFees()\n // which returns complete fee breakdown including MetaMask fees\n} as const;\n\n/**\n * Minimum number of aggregators (exchanges) a token must be listed on\n * to be considered trustworthy for showing the Perps Discovery Banner.\n * Native tokens (ETH, BNB, etc.) bypass this check.\n */\nexport const PERPS_MIN_AGGREGATORS_FOR_TRUST = 2;\n\n/**\n * Validation thresholds for UI warnings and checks\n * These values control when warnings are shown to users\n */\nexport const VALIDATION_THRESHOLDS = {\n // Leverage threshold for warning users about high leverage\n HighLeverageWarning: 20, // Show warning when leverage > 20x\n\n // Limit price difference threshold (as decimal, 0.1 = 10%)\n LimitPriceDifferenceWarning: 0.1, // Warn if limit price differs by >10% from current price\n\n // Price deviation threshold (as decimal, 0.1 = 10%)\n PriceDeviation: 0.1, // Warn if perps price deviates by >10% from spot price\n} as const;\n\n/**\n * Order slippage configuration\n * Controls default slippage tolerance for different order types\n * Conservative defaults based on HyperLiquid platform interface\n * See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md\n */\nexport const ORDER_SLIPPAGE_CONFIG = {\n // Market order slippage (basis points)\n // 300 basis points = 3% = 0.03 decimal\n // Conservative default for measured rollout, prevents most IOC failures\n DefaultMarketSlippageBps: 300,\n\n // TP/SL order slippage (basis points)\n // 1000 basis points = 10% = 0.10 decimal\n // Aligns with HyperLiquid platform default for triggered orders\n DefaultTpslSlippageBps: 1000,\n\n // Limit order slippage (basis points)\n // 100 basis points = 1% = 0.01 decimal\n // Kept conservative as limit orders rest on book (not IOC/immediate execution)\n DefaultLimitSlippageBps: 100,\n} as const;\n\n/**\n * Performance optimization constants\n * These values control debouncing and throttling for better performance\n */\nexport const PERFORMANCE_CONFIG = {\n // Price updates debounce delay (milliseconds)\n // Batches rapid WebSocket price updates to reduce re-renders\n PriceUpdateDebounceMs: 1000,\n\n // Order validation debounce delay (milliseconds)\n // Prevents excessive validation calls during rapid form input changes\n ValidationDebounceMs: 300,\n\n // Liquidation price debounce delay (milliseconds)\n // Prevents excessive liquidation price calls during rapid form input changes\n LiquidationPriceDebounceMs: 500,\n\n // Navigation params delay (milliseconds)\n // Required for React Navigation to complete state transitions before setting params\n // This ensures navigation context is available when programmatically selecting tabs\n NavigationParamsDelayMs: 200,\n\n // Tab control reset delay (milliseconds)\n // Delay to reset programmatic tab control after tab switching to prevent render loops\n TabControlResetDelayMs: 500,\n\n // Market data cache duration (milliseconds)\n // How long to cache market list data before fetching fresh data\n MarketDataCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n // Asset metadata cache duration (milliseconds)\n // How long to cache asset icon validation results\n AssetMetadataCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Max leverage cache duration (milliseconds)\n // How long to cache max leverage values per asset (leverage rarely changes)\n MaxLeverageCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Rewards cache durations (milliseconds)\n // How long to cache fee discount data from rewards API\n FeeDiscountCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n // How long to cache points calculation parameters from rewards API\n PointsCalculationCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n /**\n * Performance logging markers for filtering logs during development and debugging\n * These markers help isolate performance-related logs from general application logs\n * Usage: Use in DevLogger calls to easily filter specific performance areas\n * Impact: Development only (uses DevLogger) - zero production performance cost\n *\n * Examples:\n * - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`\n * - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`\n * - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`\n * - Filter all Perps performance: `adb logcat | grep PERPSMARK_`\n */\n LoggingMarkers: {\n // Sentry performance measurement logs (screen loads, bottom sheets, API timing)\n SentryPerformance: 'PERPSMARK_SENTRY',\n\n // MetaMetrics event tracking logs (user interactions, business analytics)\n MetametricsEvents: 'PERPSMARK_METRICS',\n\n // WebSocket performance logs (connection timing, data flow, reconnections)\n WebsocketPerformance: 'PERPSMARK_SENTRY_WS',\n } as const,\n} as const;\n\n/**\n * Leverage slider UI configuration\n * Controls the visual and interactive aspects of the leverage slider\n */\nexport const LEVERAGE_SLIDER_CONFIG = {\n // Step sizes for tick marks based on max leverage\n TickStepLow: 5, // Step size when max leverage <= 20\n TickStepMedium: 10, // Step size when max leverage <= 50\n TickStepHigh: 20, // Step size when max leverage > 50\n\n // Thresholds for determining tick step size\n MaxLeverageLowThreshold: 20,\n MaxLeverageMediumThreshold: 50,\n} as const;\n\nexport const TP_SL_CONFIG = {\n UsePositionBoundTpsl: true,\n} as const;\n\n/**\n * TP/SL View UI configuration\n * Controls the Take Profit / Stop Loss screen behavior and display options\n */\nexport const TP_SL_VIEW_CONFIG = {\n // Quick percentage button presets for Take Profit (positive RoE percentages)\n TakeProfitRoePresets: [10, 25, 50, 100], // +10%, +25%, +50%, +100% RoE\n\n // Quick percentage button presets for Stop Loss (negative RoE percentages)\n StopLossRoePresets: [-5, -10, -25, -50], // -5%, -10%, -25%, -50% RoE\n\n // WebSocket price update throttle delay (milliseconds)\n // Reduces re-renders by batching price updates in the TP/SL screen\n PriceThrottleMs: 1000,\n\n // Maximum number of digits allowed in price/percentage input fields\n // Prevents overflow and maintains reasonable input constraints\n MaxInputDigits: 9,\n\n // Keypad configuration for price inputs\n // USD_PERPS is not a real currency - it's a custom configuration\n // that allows 5 decimal places for crypto prices, overriding the\n // default USD configuration which only allows 2 decimal places\n KeypadCurrencyCode: 'USD_PERPS' as const,\n KeypadDecimals: 5,\n} as const;\n\n/**\n * Limit price configuration\n * Controls preset percentages and behavior for limit orders\n */\nexport const LIMIT_PRICE_CONFIG = {\n // Preset percentage options for quick selection\n PresetPercentages: [1, 2], // Available as both positive and negative\n\n // Modal opening delay when switching to limit order (milliseconds)\n // Allows order type modal to close smoothly before opening limit price modal\n ModalOpenDelay: 300,\n\n // Direction-specific preset configurations (Mid/Bid/Ask buttons handled separately)\n LongPresets: [-1, -2], // Buy below market for long orders\n ShortPresets: [1, 2], // Sell above market for short orders\n} as const;\n\n/**\n * HyperLiquid order limits based on leverage\n * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications\n */\nexport const HYPERLIQUID_ORDER_LIMITS = {\n // Market orders\n MarketOrderLimits: {\n // $15,000,000 for max leverage >= 25\n HighLeverage: 15_000_000,\n // $5,000,000 for max leverage in [20, 25)\n MediumHighLeverage: 5_000_000,\n // $2,000,000 for max leverage in [10, 20)\n MediumLeverage: 2_000_000,\n // $500,000 for max leverage < 10\n LowLeverage: 500_000,\n },\n // Limit orders are 10x market order limits\n LimitOrderMultiplier: 10,\n} as const;\n\n/**\n * Close position configuration\n * Controls behavior and constants specific to position closing\n */\nexport const CLOSE_POSITION_CONFIG = {\n // Decimal places for USD amount input display\n UsdDecimalPlaces: 2,\n\n // Default close percentage when opening the close position view\n DefaultClosePercentage: 100,\n\n // Precision for position size calculations to prevent rounding errors\n AmountCalculationPrecision: 6,\n\n // Throttle delay for real-time price updates during position closing\n PriceThrottleMs: 3000,\n\n // Fallback decimal places for tokens without metadata\n FallbackTokenDecimals: 18,\n} as const;\n\n/**\n * Margin adjustment configuration\n * Controls behavior for adding/removing margin from positions\n */\nexport const MARGIN_ADJUSTMENT_CONFIG = {\n // Risk thresholds for margin removal warnings\n // Threshold values represent ratio of (price distance to liquidation) / (liquidation price)\n // Values < 1.0 mean price is dangerously close to liquidation\n LiquidationRiskThreshold: 1.2, // 20% buffer before liquidation - triggers danger state\n LiquidationWarningThreshold: 1.5, // 50% buffer before liquidation - triggers warning state\n\n // Minimum margin adjustment amount (USD)\n // Prevents dust adjustments and ensures meaningful position changes\n MinAdjustmentAmount: 1,\n\n // Precision for margin calculations\n // Ensures accurate decimal handling in margin/leverage calculations\n CalculationPrecision: 6,\n\n // Safety buffer for margin removal to account for HyperLiquid's transfer margin requirement\n // HyperLiquid enforces: transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)\n // See: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margin-and-pnl\n MarginRemovalSafetyBuffer: 0.1,\n\n // Fallback max leverage when market data is unavailable\n // Conservative value to prevent over-removal of margin\n // Most HyperLiquid assets support at least 50x leverage\n FallbackMaxLeverage: 50,\n} as const;\n\n/**\n * Data Lake API configuration\n * Endpoints for reporting perps trading activity for notifications\n */\nexport const DATA_LAKE_API_CONFIG = {\n // Order reporting endpoint - only used for mainnet perps trading\n OrdersEndpoint: 'https://perps.api.cx.metamask.io/api/v1/orders',\n} as const;\n\n/**\n * Funding rate display configuration\n * Controls how funding rates are formatted and displayed across the app\n */\nexport const FUNDING_RATE_CONFIG = {\n // Number of decimal places to display for funding rates\n Decimals: 4,\n // Default display value when funding rate is zero or unavailable\n ZeroDisplay: '0.0000%',\n // Multiplier to convert decimal funding rate to percentage\n PercentageMultiplier: 100,\n} as const;\n\n/**\n * Decimal precision configuration\n * Controls maximum decimal places for price and input validation\n */\nexport const DECIMAL_PRECISION_CONFIG = {\n // Maximum decimal places for price input (matches Hyperliquid limit)\n // Used in TP/SL forms, limit price inputs, and price validation\n MaxPriceDecimals: 6,\n // Maximum significant figures allowed by HyperLiquid API\n // Orders with more than 5 significant figures will be rejected\n MaxSignificantFigures: 5,\n // Defensive fallback for size decimals when market data fails to load\n // Real szDecimals should always come from market data API (varies by asset)\n // Using 6 as safe maximum to prevent crashes (covers most assets)\n // NOTE: This is NOT semantically correct - just a defensive measure\n FallbackSizeDecimals: 6,\n} as const;\n\n/**\n * Development-only configuration for testing and debugging\n * These constants are only active when __DEV__ is true\n */\nexport const DEVELOPMENT_CONFIG = {\n // Magic number to simulate fee discount state (20% discount)\n SimulateFeeDiscountAmount: 41,\n\n // Magic number to simulate rewards error state (set order amount to this value)\n SimulateRewardsErrorAmount: 42,\n\n // Magic number to simulate rewards loading state\n SimulateRewardsLoadingAmount: 43,\n\n // Future: Add other development helpers as needed\n} as const;\n\n/**\n * Home screen configuration\n * Controls carousel limits and display settings for the main Perps home screen\n */\nexport const HOME_SCREEN_CONFIG = {\n // Show action buttons (Add Funds / Withdraw) in header instead of fixed footer\n // Can be controlled via feature flag in the future\n ShowHeaderActionButtons: true,\n\n // Maximum number of items to show in each carousel\n PositionsCarouselLimit: 10,\n OrdersCarouselLimit: 10,\n TrendingMarketsLimit: 5,\n RecentActivityLimit: 3,\n\n // Carousel display behavior\n CarouselSnapAlignment: 'start' as const,\n CarouselVisibleItems: 1.2, // Show 1 full item + 20% of next\n\n // Icon sizes for consistent display across sections\n DefaultIconSize: 40, // Default token icon size for cards and rows\n} as const;\n\n/**\n * Market sorting configuration\n * Controls sorting behavior and presets for the trending markets view\n */\nexport const MARKET_SORTING_CONFIG = {\n // Default sort settings\n DefaultSortOptionId: 'volume' as const,\n DefaultDirection: 'desc' as const,\n\n // Available sort fields (only includes fields supported by PerpsMarketData)\n SortFields: {\n Volume: 'volume',\n PriceChange: 'priceChange',\n OpenInterest: 'openInterest',\n FundingRate: 'fundingRate',\n } as const,\n\n // Sort button presets for filter chips (simplified buttons without direction)\n SortButtonPresets: [\n { field: 'volume', labelKey: 'perps.sort.volume' },\n { field: 'priceChange', labelKey: 'perps.sort.price_change' },\n { field: 'fundingRate', labelKey: 'perps.sort.funding_rate' },\n ] as const,\n\n // Sort options for the bottom sheet\n // Only Price Change can be toggled for direction (similar to trending tokens pattern)\n // Other options (volume, open interest, funding rate) use descending sort only\n SortOptions: [\n {\n id: 'volume',\n labelKey: 'perps.sort.volume',\n field: 'volume',\n direction: 'desc',\n },\n {\n id: 'priceChange',\n labelKey: 'perps.sort.price_change',\n field: 'priceChange',\n direction: 'desc',\n },\n {\n id: 'openInterest',\n labelKey: 'perps.sort.open_interest',\n field: 'openInterest',\n direction: 'desc',\n },\n {\n id: 'fundingRate',\n labelKey: 'perps.sort.funding_rate',\n field: 'fundingRate',\n direction: 'desc',\n },\n ] as const,\n} as const;\n\n/**\n * Type for valid sort option IDs\n * Derived from SORT_OPTIONS to ensure type safety\n * Valid values: 'volume' | 'priceChange' | 'openInterest' | 'fundingRate'\n */\nexport type SortOptionId =\n (typeof MARKET_SORTING_CONFIG.SortOptions)[number]['id'];\n\n/**\n * Type for sort button presets (filter chips)\n * Derived from SORT_BUTTON_PRESETS to ensure type safety\n */\nexport type SortButtonPreset =\n (typeof MARKET_SORTING_CONFIG.SortButtonPresets)[number];\n\n/**\n * Learn more card configuration\n * External resources and content for Perps education\n */\nexport const LEARN_MORE_CONFIG = {\n ExternalUrl: 'https://metamask.io/perps',\n TitleKey: 'perps.tutorial.card.title',\n DescriptionKey: 'perps.learn_more.description',\n CtaKey: 'perps.learn_more.cta',\n} as const;\n\n/**\n * Support configuration\n * Contact support button configuration (matches Settings behavior)\n */\nexport const SUPPORT_CONFIG = {\n Url: 'https://support.metamask.io',\n TitleKey: 'perps.support.title',\n DescriptionKey: 'perps.support.description',\n} as const;\n\n/**\n * Feedback survey configuration\n * External survey for collecting user feedback on Perps trading experience\n */\nexport const FEEDBACK_CONFIG = {\n Url: 'https://survey.alchemer.com/s3/8649911/MetaMask-Perps-Trading-Feedback',\n TitleKey: 'perps.feedback.title',\n} as const;\n\n/**\n * Support article URLs\n * Links to specific MetaMask support articles for Perps features\n */\nexport const PERPS_SUPPORT_ARTICLES_URLS = {\n AdlUrl:\n 'https://support.metamask.io/manage-crypto/trade/perps/leverage-and-liquidation/#what-is-auto-deleveraging-adl',\n} as const;\n\n/**\n * Stop loss prompt banner configuration\n * Controls when and how the stop loss prompt banner is displayed\n * Based on TAT-1693 specifications\n */\nexport const STOP_LOSS_PROMPT_CONFIG = {\n // Distance to liquidation threshold (percentage)\n // Shows \"Add margin\" banner when position is within this % of liquidation\n LiquidationDistanceThreshold: 3,\n\n // ROE (Return on Equity) threshold (percentage)\n // Shows \"Set stop loss\" banner when ROE drops below this value\n RoeThreshold: -10,\n\n // Minimum loss threshold to show ANY banner (percentage)\n // No banner shown until ROE drops below this value\n MinLossThreshold: -10,\n\n // Debounce duration for ROE threshold (milliseconds)\n // User must have ROE below threshold for this duration before showing banner\n // Prevents banner from appearing during temporary price fluctuations\n RoeDebounceMs: 60_000, // 60 seconds\n\n // Minimum position age before showing any banner (milliseconds)\n // Prevents banner from appearing immediately after opening a position\n PositionMinAgeMs: 60_000, // 60 seconds\n\n // Suggested stop loss ROE percentage\n // When suggesting a stop loss, calculate price at this ROE from entry\n SuggestedStopLossRoe: -50,\n} as const;\n\n/**\n * Transactions history configuration\n * Controls history display and data fetching parameters\n */\nexport const PERPS_TRANSACTIONS_HISTORY_CONSTANTS = {\n /**\n * Default number of days to look back for funding history.\n * HyperLiquid API requires a startTime and returns max 500 records.\n * Using 365 days ensures most users see their complete recent history.\n * Can be increased if users need older funding data.\n */\n DefaultFundingHistoryDays: 365,\n} as const;\n"]}
|