@metamask-previews/perps-controller 0.0.0-preview-685dbf46b → 1.0.0-preview-bc00f2c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -2
- package/dist/PerpsController.cjs +3077 -65
- package/dist/PerpsController.cjs.map +1 -1
- package/dist/PerpsController.d.cts +969 -82
- package/dist/PerpsController.d.cts.map +1 -1
- package/dist/PerpsController.d.mts +969 -82
- package/dist/PerpsController.d.mts.map +1 -1
- package/dist/PerpsController.mjs +3073 -62
- package/dist/PerpsController.mjs.map +1 -1
- package/dist/aggregation/SubscriptionMultiplexer.cjs +441 -0
- package/dist/aggregation/SubscriptionMultiplexer.cjs.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.cts +171 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.mts +171 -0
- package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +1 -0
- package/dist/aggregation/SubscriptionMultiplexer.mjs +437 -0
- package/dist/aggregation/SubscriptionMultiplexer.mjs.map +1 -0
- package/dist/aggregation/index.cjs +9 -0
- package/dist/aggregation/index.cjs.map +1 -0
- package/dist/aggregation/index.d.cts +6 -0
- package/dist/aggregation/index.d.cts.map +1 -0
- package/dist/aggregation/index.d.mts +6 -0
- package/dist/aggregation/index.d.mts.map +1 -0
- package/dist/aggregation/index.mjs +5 -0
- package/dist/aggregation/index.mjs.map +1 -0
- package/dist/constants/chartConfig.cjs +227 -0
- package/dist/constants/chartConfig.cjs.map +1 -0
- package/dist/constants/chartConfig.d.cts +216 -0
- package/dist/constants/chartConfig.d.cts.map +1 -0
- package/dist/constants/chartConfig.d.mts +216 -0
- package/dist/constants/chartConfig.d.mts.map +1 -0
- package/dist/constants/chartConfig.mjs +221 -0
- package/dist/constants/chartConfig.mjs.map +1 -0
- package/dist/constants/eventNames.cjs +436 -0
- package/dist/constants/eventNames.cjs.map +1 -0
- package/dist/constants/eventNames.d.cts +387 -0
- package/dist/constants/eventNames.d.cts.map +1 -0
- package/dist/constants/eventNames.d.mts +387 -0
- package/dist/constants/eventNames.d.mts.map +1 -0
- package/dist/constants/eventNames.mjs +433 -0
- package/dist/constants/eventNames.mjs.map +1 -0
- package/dist/constants/hyperLiquidConfig.cjs +380 -0
- package/dist/constants/hyperLiquidConfig.cjs.map +1 -0
- package/dist/constants/hyperLiquidConfig.d.cts +236 -0
- package/dist/constants/hyperLiquidConfig.d.cts.map +1 -0
- package/dist/constants/hyperLiquidConfig.d.mts +236 -0
- package/dist/constants/hyperLiquidConfig.d.mts.map +1 -0
- package/dist/constants/hyperLiquidConfig.mjs +371 -0
- package/dist/constants/hyperLiquidConfig.mjs.map +1 -0
- package/dist/constants/index.cjs +28 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +12 -0
- package/dist/constants/index.d.cts.map +1 -0
- package/dist/constants/index.d.mts +12 -0
- package/dist/constants/index.d.mts.map +1 -0
- package/dist/constants/index.mjs +12 -0
- package/dist/constants/index.mjs.map +1 -0
- package/dist/constants/myxConfig.cjs +229 -0
- package/dist/constants/myxConfig.cjs.map +1 -0
- package/dist/constants/myxConfig.d.cts +106 -0
- package/dist/constants/myxConfig.d.cts.map +1 -0
- package/dist/constants/myxConfig.d.mts +106 -0
- package/dist/constants/myxConfig.d.mts.map +1 -0
- package/dist/constants/myxConfig.mjs +219 -0
- package/dist/constants/myxConfig.mjs.map +1 -0
- package/dist/constants/orderTypes.cjs +31 -0
- package/dist/constants/orderTypes.cjs.map +1 -0
- package/dist/constants/orderTypes.d.cts +19 -0
- package/dist/constants/orderTypes.d.cts.map +1 -0
- package/dist/constants/orderTypes.d.mts +19 -0
- package/dist/constants/orderTypes.d.mts.map +1 -0
- package/dist/constants/orderTypes.mjs +27 -0
- package/dist/constants/orderTypes.mjs.map +1 -0
- package/dist/constants/performanceMetrics.cjs +63 -0
- package/dist/constants/performanceMetrics.cjs.map +1 -0
- package/dist/constants/performanceMetrics.d.cts +46 -0
- package/dist/constants/performanceMetrics.d.cts.map +1 -0
- package/dist/constants/performanceMetrics.d.mts +46 -0
- package/dist/constants/performanceMetrics.d.mts.map +1 -0
- package/dist/constants/performanceMetrics.mjs +60 -0
- package/dist/constants/performanceMetrics.mjs.map +1 -0
- package/dist/constants/perpsConfig.cjs +295 -0
- package/dist/constants/perpsConfig.cjs.map +1 -0
- package/dist/constants/perpsConfig.d.cts +221 -0
- package/dist/constants/perpsConfig.d.cts.map +1 -0
- package/dist/constants/perpsConfig.d.mts +221 -0
- package/dist/constants/perpsConfig.d.mts.map +1 -0
- package/dist/constants/perpsConfig.mjs +292 -0
- package/dist/constants/perpsConfig.mjs.map +1 -0
- package/dist/constants/transactionsHistoryConfig.cjs +19 -0
- package/dist/constants/transactionsHistoryConfig.cjs.map +1 -0
- package/dist/constants/transactionsHistoryConfig.d.cts +16 -0
- package/dist/constants/transactionsHistoryConfig.d.cts.map +1 -0
- package/dist/constants/transactionsHistoryConfig.d.mts +16 -0
- package/dist/constants/transactionsHistoryConfig.d.mts.map +1 -0
- package/dist/constants/transactionsHistoryConfig.mjs +16 -0
- package/dist/constants/transactionsHistoryConfig.mjs.map +1 -0
- package/dist/index.cjs +63 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +38 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +46 -1
- package/dist/index.mjs.map +1 -1
- package/dist/perpsErrorCodes.cjs +80 -0
- package/dist/perpsErrorCodes.cjs.map +1 -0
- package/dist/perpsErrorCodes.d.cts +65 -0
- package/dist/perpsErrorCodes.d.cts.map +1 -0
- package/dist/perpsErrorCodes.d.mts +65 -0
- package/dist/perpsErrorCodes.d.mts.map +1 -0
- package/dist/perpsErrorCodes.mjs +77 -0
- package/dist/perpsErrorCodes.mjs.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.cjs +508 -0
- package/dist/providers/AggregatedPerpsProvider.cjs.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.d.cts +171 -0
- package/dist/providers/AggregatedPerpsProvider.d.cts.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.d.mts +171 -0
- package/dist/providers/AggregatedPerpsProvider.d.mts.map +1 -0
- package/dist/providers/AggregatedPerpsProvider.mjs +504 -0
- package/dist/providers/AggregatedPerpsProvider.mjs.map +1 -0
- package/dist/providers/HyperLiquidProvider.cjs +5679 -0
- package/dist/providers/HyperLiquidProvider.cjs.map +1 -0
- package/dist/providers/HyperLiquidProvider.d.cts +516 -0
- package/dist/providers/HyperLiquidProvider.d.cts.map +1 -0
- package/dist/providers/HyperLiquidProvider.d.mts +516 -0
- package/dist/providers/HyperLiquidProvider.d.mts.map +1 -0
- package/dist/providers/HyperLiquidProvider.mjs +5675 -0
- package/dist/providers/HyperLiquidProvider.mjs.map +1 -0
- package/dist/providers/MYXProvider.cjs +514 -0
- package/dist/providers/MYXProvider.cjs.map +1 -0
- package/dist/providers/MYXProvider.d.cts +105 -0
- package/dist/providers/MYXProvider.d.cts.map +1 -0
- package/dist/providers/MYXProvider.d.mts +105 -0
- package/dist/providers/MYXProvider.d.mts.map +1 -0
- package/dist/providers/MYXProvider.mjs +510 -0
- package/dist/providers/MYXProvider.mjs.map +1 -0
- package/dist/routing/ProviderRouter.cjs +154 -0
- package/dist/routing/ProviderRouter.cjs.map +1 -0
- package/dist/routing/ProviderRouter.d.cts +112 -0
- package/dist/routing/ProviderRouter.d.cts.map +1 -0
- package/dist/routing/ProviderRouter.d.mts +112 -0
- package/dist/routing/ProviderRouter.d.mts.map +1 -0
- package/dist/routing/ProviderRouter.mjs +150 -0
- package/dist/routing/ProviderRouter.mjs.map +1 -0
- package/dist/routing/index.cjs +9 -0
- package/dist/routing/index.cjs.map +1 -0
- package/dist/routing/index.d.cts +6 -0
- package/dist/routing/index.d.cts.map +1 -0
- package/dist/routing/index.d.mts +6 -0
- package/dist/routing/index.d.mts.map +1 -0
- package/dist/routing/index.mjs +5 -0
- package/dist/routing/index.mjs.map +1 -0
- package/dist/selectors.cjs +166 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +362 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +362 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/selectors.mjs +158 -0
- package/dist/selectors.mjs.map +1 -0
- package/dist/services/AccountService.cjs +324 -0
- package/dist/services/AccountService.cjs.map +1 -0
- package/dist/services/AccountService.d.cts +56 -0
- package/dist/services/AccountService.d.cts.map +1 -0
- package/dist/services/AccountService.d.mts +56 -0
- package/dist/services/AccountService.d.mts.map +1 -0
- package/dist/services/AccountService.mjs +320 -0
- package/dist/services/AccountService.mjs.map +1 -0
- package/dist/services/DataLakeService.cjs +233 -0
- package/dist/services/DataLakeService.cjs.map +1 -0
- package/dist/services/DataLakeService.d.cts +51 -0
- package/dist/services/DataLakeService.d.cts.map +1 -0
- package/dist/services/DataLakeService.d.mts +51 -0
- package/dist/services/DataLakeService.d.mts.map +1 -0
- package/dist/services/DataLakeService.mjs +229 -0
- package/dist/services/DataLakeService.mjs.map +1 -0
- package/dist/services/DepositService.cjs +98 -0
- package/dist/services/DepositService.cjs.map +1 -0
- package/dist/services/DepositService.d.cts +39 -0
- package/dist/services/DepositService.d.cts.map +1 -0
- package/dist/services/DepositService.d.mts +39 -0
- package/dist/services/DepositService.d.mts.map +1 -0
- package/dist/services/DepositService.mjs +94 -0
- package/dist/services/DepositService.mjs.map +1 -0
- package/dist/services/EligibilityService.cjs +173 -0
- package/dist/services/EligibilityService.cjs.map +1 -0
- package/dist/services/EligibilityService.d.cts +39 -0
- package/dist/services/EligibilityService.d.cts.map +1 -0
- package/dist/services/EligibilityService.d.mts +39 -0
- package/dist/services/EligibilityService.d.mts.map +1 -0
- package/dist/services/EligibilityService.mjs +169 -0
- package/dist/services/EligibilityService.mjs.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.cjs +257 -0
- package/dist/services/FeatureFlagConfigurationService.cjs.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.d.cts +73 -0
- package/dist/services/FeatureFlagConfigurationService.d.cts.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.d.mts +73 -0
- package/dist/services/FeatureFlagConfigurationService.d.mts.map +1 -0
- package/dist/services/FeatureFlagConfigurationService.mjs +253 -0
- package/dist/services/FeatureFlagConfigurationService.mjs.map +1 -0
- package/dist/services/HyperLiquidClientService.cjs +867 -0
- package/dist/services/HyperLiquidClientService.cjs.map +1 -0
- package/dist/services/HyperLiquidClientService.d.cts +214 -0
- package/dist/services/HyperLiquidClientService.d.cts.map +1 -0
- package/dist/services/HyperLiquidClientService.d.mts +214 -0
- package/dist/services/HyperLiquidClientService.d.mts.map +1 -0
- package/dist/services/HyperLiquidClientService.mjs +862 -0
- package/dist/services/HyperLiquidClientService.mjs.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.cjs +2199 -0
- package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.d.cts +187 -0
- package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.d.mts +187 -0
- package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -0
- package/dist/services/HyperLiquidSubscriptionService.mjs +2195 -0
- package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -0
- package/dist/services/HyperLiquidWalletService.cjs +163 -0
- package/dist/services/HyperLiquidWalletService.cjs.map +1 -0
- package/dist/services/HyperLiquidWalletService.d.cts +78 -0
- package/dist/services/HyperLiquidWalletService.d.cts.map +1 -0
- package/dist/services/HyperLiquidWalletService.d.mts +78 -0
- package/dist/services/HyperLiquidWalletService.d.mts.map +1 -0
- package/dist/services/HyperLiquidWalletService.mjs +159 -0
- package/dist/services/HyperLiquidWalletService.mjs.map +1 -0
- package/dist/services/MYXClientService.cjs +304 -0
- package/dist/services/MYXClientService.cjs.map +1 -0
- package/dist/services/MYXClientService.d.cts +81 -0
- package/dist/services/MYXClientService.d.cts.map +1 -0
- package/dist/services/MYXClientService.d.mts +81 -0
- package/dist/services/MYXClientService.d.mts.map +1 -0
- package/dist/services/MYXClientService.mjs +300 -0
- package/dist/services/MYXClientService.mjs.map +1 -0
- package/dist/services/MarketDataService.cjs +848 -0
- package/dist/services/MarketDataService.cjs.map +1 -0
- package/dist/services/MarketDataService.d.cts +291 -0
- package/dist/services/MarketDataService.d.cts.map +1 -0
- package/dist/services/MarketDataService.d.mts +291 -0
- package/dist/services/MarketDataService.d.mts.map +1 -0
- package/dist/services/MarketDataService.mjs +844 -0
- package/dist/services/MarketDataService.mjs.map +1 -0
- package/dist/services/RewardsIntegrationService.cjs +120 -0
- package/dist/services/RewardsIntegrationService.cjs.map +1 -0
- package/dist/services/RewardsIntegrationService.d.cts +28 -0
- package/dist/services/RewardsIntegrationService.d.cts.map +1 -0
- package/dist/services/RewardsIntegrationService.d.mts +28 -0
- package/dist/services/RewardsIntegrationService.d.mts.map +1 -0
- package/dist/services/RewardsIntegrationService.mjs +116 -0
- package/dist/services/RewardsIntegrationService.mjs.map +1 -0
- package/dist/services/ServiceContext.cjs +3 -0
- package/dist/services/ServiceContext.cjs.map +1 -0
- package/dist/services/ServiceContext.d.cts +86 -0
- package/dist/services/ServiceContext.d.cts.map +1 -0
- package/dist/services/ServiceContext.d.mts +86 -0
- package/dist/services/ServiceContext.d.mts.map +1 -0
- package/dist/services/ServiceContext.mjs +2 -0
- package/dist/services/ServiceContext.mjs.map +1 -0
- package/dist/services/TradingReadinessCache.cjs +288 -0
- package/dist/services/TradingReadinessCache.cjs.map +1 -0
- package/dist/services/TradingReadinessCache.d.cts +174 -0
- package/dist/services/TradingReadinessCache.d.cts.map +1 -0
- package/dist/services/TradingReadinessCache.d.mts +174 -0
- package/dist/services/TradingReadinessCache.d.mts.map +1 -0
- package/dist/services/TradingReadinessCache.mjs +285 -0
- package/dist/services/TradingReadinessCache.mjs.map +1 -0
- package/dist/services/TradingService.cjs +1457 -0
- package/dist/services/TradingService.cjs.map +1 -0
- package/dist/services/TradingService.d.cts +195 -0
- package/dist/services/TradingService.d.cts.map +1 -0
- package/dist/services/TradingService.d.mts +195 -0
- package/dist/services/TradingService.d.mts.map +1 -0
- package/dist/services/TradingService.mjs +1453 -0
- package/dist/services/TradingService.mjs.map +1 -0
- package/dist/types/config.cjs +3 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +49 -0
- package/dist/types/config.d.cts.map +1 -0
- package/dist/types/config.d.mts +49 -0
- package/dist/types/config.d.mts.map +1 -0
- package/dist/types/config.mjs +2 -0
- package/dist/types/config.mjs.map +1 -0
- package/dist/types/hyperliquid-types.cjs +3 -0
- package/dist/types/hyperliquid-types.cjs.map +1 -0
- package/dist/types/hyperliquid-types.d.cts +20 -0
- package/dist/types/hyperliquid-types.d.cts.map +1 -0
- package/dist/types/hyperliquid-types.d.mts +20 -0
- package/dist/types/hyperliquid-types.d.mts.map +1 -0
- package/dist/types/hyperliquid-types.mjs +2 -0
- package/dist/types/hyperliquid-types.mjs.map +1 -0
- package/dist/types/index.cjs +115 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +1262 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +1262 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +97 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/messenger.cjs +3 -0
- package/dist/types/messenger.cjs.map +1 -0
- package/dist/types/messenger.d.cts +27 -0
- package/dist/types/messenger.d.cts.map +1 -0
- package/dist/types/messenger.d.mts +27 -0
- package/dist/types/messenger.d.mts.map +1 -0
- package/dist/types/messenger.mjs +2 -0
- package/dist/types/messenger.mjs.map +1 -0
- package/dist/types/myx-types.cjs +25 -0
- package/dist/types/myx-types.cjs.map +1 -0
- package/dist/types/myx-types.d.cts +63 -0
- package/dist/types/myx-types.d.cts.map +1 -0
- package/dist/types/myx-types.d.mts +63 -0
- package/dist/types/myx-types.d.mts.map +1 -0
- package/dist/types/myx-types.mjs +22 -0
- package/dist/types/myx-types.mjs.map +1 -0
- package/dist/types/perps-types.cjs +4 -0
- package/dist/types/perps-types.cjs.map +1 -0
- package/dist/types/perps-types.d.cts +105 -0
- package/dist/types/perps-types.d.cts.map +1 -0
- package/dist/types/perps-types.d.mts +105 -0
- package/dist/types/perps-types.d.mts.map +1 -0
- package/dist/types/perps-types.mjs +2 -0
- package/dist/types/perps-types.mjs.map +1 -0
- package/dist/types/token.cjs +3 -0
- package/dist/types/token.cjs.map +1 -0
- package/dist/types/token.d.cts +25 -0
- package/dist/types/token.d.cts.map +1 -0
- package/dist/types/token.d.mts +25 -0
- package/dist/types/token.d.mts.map +1 -0
- package/dist/types/token.mjs +2 -0
- package/dist/types/token.mjs.map +1 -0
- package/dist/types/transactionTypes.cjs +28 -0
- package/dist/types/transactionTypes.cjs.map +1 -0
- package/dist/types/transactionTypes.d.cts +64 -0
- package/dist/types/transactionTypes.d.cts.map +1 -0
- package/dist/types/transactionTypes.d.mts +64 -0
- package/dist/types/transactionTypes.d.mts.map +1 -0
- package/dist/types/transactionTypes.mjs +23 -0
- package/dist/types/transactionTypes.mjs.map +1 -0
- package/dist/utils/accountUtils.cjs +100 -0
- package/dist/utils/accountUtils.cjs.map +1 -0
- package/dist/utils/accountUtils.d.cts +30 -0
- package/dist/utils/accountUtils.d.cts.map +1 -0
- package/dist/utils/accountUtils.d.mts +30 -0
- package/dist/utils/accountUtils.d.mts.map +1 -0
- package/dist/utils/accountUtils.mjs +92 -0
- package/dist/utils/accountUtils.mjs.map +1 -0
- package/dist/utils/errorUtils.cjs +35 -0
- package/dist/utils/errorUtils.cjs.map +1 -0
- package/dist/utils/errorUtils.d.cts +15 -0
- package/dist/utils/errorUtils.d.cts.map +1 -0
- package/dist/utils/errorUtils.d.mts +15 -0
- package/dist/utils/errorUtils.d.mts.map +1 -0
- package/dist/utils/errorUtils.mjs +31 -0
- package/dist/utils/errorUtils.mjs.map +1 -0
- package/dist/utils/hyperLiquidAdapter.cjs +331 -0
- package/dist/utils/hyperLiquidAdapter.cjs.map +1 -0
- package/dist/utils/hyperLiquidAdapter.d.cts +42 -0
- package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -0
- package/dist/utils/hyperLiquidAdapter.d.mts +42 -0
- package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -0
- package/dist/utils/hyperLiquidAdapter.mjs +316 -0
- package/dist/utils/hyperLiquidAdapter.mjs.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs +83 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +55 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +55 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +1 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs +78 -0
- package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +1 -0
- package/dist/utils/hyperLiquidValidation.cjs +426 -0
- package/dist/utils/hyperLiquidValidation.cjs.map +1 -0
- package/dist/utils/hyperLiquidValidation.d.cts +143 -0
- package/dist/utils/hyperLiquidValidation.d.cts.map +1 -0
- package/dist/utils/hyperLiquidValidation.d.mts +143 -0
- package/dist/utils/hyperLiquidValidation.d.mts.map +1 -0
- package/dist/utils/hyperLiquidValidation.mjs +413 -0
- package/dist/utils/hyperLiquidValidation.mjs.map +1 -0
- package/dist/utils/idUtils.cjs +18 -0
- package/dist/utils/idUtils.cjs.map +1 -0
- package/dist/utils/idUtils.d.cts +6 -0
- package/dist/utils/idUtils.d.cts.map +1 -0
- package/dist/utils/idUtils.d.mts +6 -0
- package/dist/utils/idUtils.d.mts.map +1 -0
- package/dist/utils/idUtils.mjs +10 -0
- package/dist/utils/idUtils.mjs.map +1 -0
- package/dist/utils/index.cjs +59 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +25 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +25 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +30 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/marketDataTransform.cjs +211 -0
- package/dist/utils/marketDataTransform.cjs.map +1 -0
- package/dist/utils/marketDataTransform.d.cts +40 -0
- package/dist/utils/marketDataTransform.d.cts.map +1 -0
- package/dist/utils/marketDataTransform.d.mts +40 -0
- package/dist/utils/marketDataTransform.d.mts.map +1 -0
- package/dist/utils/marketDataTransform.mjs +205 -0
- package/dist/utils/marketDataTransform.mjs.map +1 -0
- package/dist/utils/marketUtils.cjs +151 -0
- package/dist/utils/marketUtils.cjs.map +1 -0
- package/dist/utils/marketUtils.d.cts +30 -0
- package/dist/utils/marketUtils.d.cts.map +1 -0
- package/dist/utils/marketUtils.d.mts +30 -0
- package/dist/utils/marketUtils.d.mts.map +1 -0
- package/dist/utils/marketUtils.mjs +138 -0
- package/dist/utils/marketUtils.mjs.map +1 -0
- package/dist/utils/myxAdapter.cjs +224 -0
- package/dist/utils/myxAdapter.cjs.map +1 -0
- package/dist/utils/myxAdapter.d.cts +81 -0
- package/dist/utils/myxAdapter.d.cts.map +1 -0
- package/dist/utils/myxAdapter.d.mts +81 -0
- package/dist/utils/myxAdapter.d.mts.map +1 -0
- package/dist/utils/myxAdapter.mjs +213 -0
- package/dist/utils/myxAdapter.mjs.map +1 -0
- package/dist/utils/orderCalculations.cjs +283 -0
- package/dist/utils/orderCalculations.cjs.map +1 -0
- package/dist/utils/orderCalculations.d.cts +107 -0
- package/dist/utils/orderCalculations.d.cts.map +1 -0
- package/dist/utils/orderCalculations.d.mts +107 -0
- package/dist/utils/orderCalculations.d.mts.map +1 -0
- package/dist/utils/orderCalculations.mjs +274 -0
- package/dist/utils/orderCalculations.mjs.map +1 -0
- package/dist/utils/rewardsUtils.cjs +98 -0
- package/dist/utils/rewardsUtils.cjs.map +1 -0
- package/dist/utils/rewardsUtils.d.cts +33 -0
- package/dist/utils/rewardsUtils.d.cts.map +1 -0
- package/dist/utils/rewardsUtils.d.mts +33 -0
- package/dist/utils/rewardsUtils.d.mts.map +1 -0
- package/dist/utils/rewardsUtils.mjs +92 -0
- package/dist/utils/rewardsUtils.mjs.map +1 -0
- package/dist/utils/significantFigures.cjs +88 -0
- package/dist/utils/significantFigures.cjs.map +1 -0
- package/dist/utils/significantFigures.d.cts +25 -0
- package/dist/utils/significantFigures.d.cts.map +1 -0
- package/dist/utils/significantFigures.d.mts +25 -0
- package/dist/utils/significantFigures.d.mts.map +1 -0
- package/dist/utils/significantFigures.mjs +82 -0
- package/dist/utils/significantFigures.mjs.map +1 -0
- package/dist/utils/sortMarkets.cjs +93 -0
- package/dist/utils/sortMarkets.cjs.map +1 -0
- package/dist/utils/sortMarkets.d.cts +27 -0
- package/dist/utils/sortMarkets.d.cts.map +1 -0
- package/dist/utils/sortMarkets.d.mts +27 -0
- package/dist/utils/sortMarkets.d.mts.map +1 -0
- package/dist/utils/sortMarkets.mjs +88 -0
- package/dist/utils/sortMarkets.mjs.map +1 -0
- package/dist/utils/standaloneInfoClient.cjs +70 -0
- package/dist/utils/standaloneInfoClient.cjs.map +1 -0
- package/dist/utils/standaloneInfoClient.d.cts +37 -0
- package/dist/utils/standaloneInfoClient.d.cts.map +1 -0
- package/dist/utils/standaloneInfoClient.d.mts +37 -0
- package/dist/utils/standaloneInfoClient.d.mts.map +1 -0
- package/dist/utils/standaloneInfoClient.mjs +64 -0
- package/dist/utils/standaloneInfoClient.mjs.map +1 -0
- package/dist/utils/stringParseUtils.cjs +18 -0
- package/dist/utils/stringParseUtils.cjs.map +1 -0
- package/dist/utils/stringParseUtils.d.cts +3 -0
- package/dist/utils/stringParseUtils.d.cts.map +1 -0
- package/dist/utils/stringParseUtils.d.mts +3 -0
- package/dist/utils/stringParseUtils.d.mts.map +1 -0
- package/dist/utils/stringParseUtils.mjs +13 -0
- package/dist/utils/stringParseUtils.mjs.map +1 -0
- package/dist/utils/transferData.cjs +33 -0
- package/dist/utils/transferData.cjs.map +1 -0
- package/dist/utils/transferData.d.cts +9 -0
- package/dist/utils/transferData.d.cts.map +1 -0
- package/dist/utils/transferData.d.mts +9 -0
- package/dist/utils/transferData.d.mts.map +1 -0
- package/dist/utils/transferData.mjs +29 -0
- package/dist/utils/transferData.mjs.map +1 -0
- package/dist/utils/wait.cjs +6 -0
- package/dist/utils/wait.cjs.map +1 -0
- package/dist/utils/wait.d.cts +2 -0
- package/dist/utils/wait.d.cts.map +1 -0
- package/dist/utils/wait.d.mts +2 -0
- package/dist/utils/wait.d.mts.map +1 -0
- package/dist/utils/wait.mjs +2 -0
- package/dist/utils/wait.mjs.map +1 -0
- package/package.json +16 -2
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WITHDRAWAL_PROGRESS_STAGES = exports.INITIAL_AMOUNT_UI_PROGRESS = exports.USDH_CONFIG = exports.HIP3_MARGIN_CONFIG = exports.MAINNET_HIP3_CONFIG = exports.TESTNET_HIP3_CONFIG = exports.HIP3_ASSET_MARKET_TYPES = 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_MINUTES = exports.DEPOSIT_CONFIG = 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 = void 0;
|
|
5
|
+
// Network constants
|
|
6
|
+
exports.ARBITRUM_MAINNET_CHAIN_ID_HEX = '0xa4b1';
|
|
7
|
+
exports.ARBITRUM_MAINNET_CHAIN_ID = '42161';
|
|
8
|
+
exports.ARBITRUM_TESTNET_CHAIN_ID = '421614';
|
|
9
|
+
exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID = `eip155:${exports.ARBITRUM_MAINNET_CHAIN_ID}`;
|
|
10
|
+
exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID = `eip155:${exports.ARBITRUM_TESTNET_CHAIN_ID}`;
|
|
11
|
+
// Hyperliquid chain constants
|
|
12
|
+
exports.HYPERLIQUID_MAINNET_CHAIN_ID = '0x3e7'; // 999 in decimal
|
|
13
|
+
exports.HYPERLIQUID_TESTNET_CHAIN_ID = '0x3e6'; // 998 in decimal (assumed)
|
|
14
|
+
exports.HYPERLIQUID_MAINNET_CAIP_CHAIN_ID = 'eip155:999';
|
|
15
|
+
exports.HYPERLIQUID_TESTNET_CAIP_CHAIN_ID = 'eip155:998';
|
|
16
|
+
exports.HYPERLIQUID_NETWORK_NAME = 'Hyperliquid';
|
|
17
|
+
// Token constants
|
|
18
|
+
exports.USDC_SYMBOL = 'USDC';
|
|
19
|
+
exports.USDC_NAME = 'USD Coin';
|
|
20
|
+
exports.USDC_DECIMALS = 6;
|
|
21
|
+
exports.TOKEN_DECIMALS = 18;
|
|
22
|
+
exports.ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
23
|
+
exports.ZERO_BALANCE = '0x0';
|
|
24
|
+
// Network constants
|
|
25
|
+
exports.ARBITRUM_SEPOLIA_CHAIN_ID = '0x66eee'; // 421614 in decimal
|
|
26
|
+
// USDC token addresses
|
|
27
|
+
exports.USDC_ETHEREUM_MAINNET_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
|
|
28
|
+
exports.USDC_ARBITRUM_MAINNET_ADDRESS = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
|
|
29
|
+
exports.USDC_ARBITRUM_TESTNET_ADDRESS = '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d';
|
|
30
|
+
// USDC token icon URL using MetaMask's official Token Icons API
|
|
31
|
+
// Format: https://static.cx.metamask.io/api/v1/tokenIcons/{chainId}/{contractAddress}.png
|
|
32
|
+
// This URL follows the same pattern used throughout MetaMask (bridges, swaps, etc.)
|
|
33
|
+
exports.USDC_TOKEN_ICON_URL = `https://static.cx.metamask.io/api/v1/tokenIcons/1/${exports.USDC_ETHEREUM_MAINNET_ADDRESS}.png`;
|
|
34
|
+
// WebSocket endpoints
|
|
35
|
+
exports.HYPERLIQUID_ENDPOINTS = {
|
|
36
|
+
mainnet: 'wss://api.hyperliquid.xyz/ws',
|
|
37
|
+
testnet: 'wss://api.hyperliquid-testnet.xyz/ws',
|
|
38
|
+
};
|
|
39
|
+
// Asset icons base URL (HyperLiquid CDN - fallback source)
|
|
40
|
+
exports.HYPERLIQUID_ASSET_ICONS_BASE_URL = 'https://app.hyperliquid.xyz/coins/';
|
|
41
|
+
// MetaMask-hosted Perps asset icons (primary source)
|
|
42
|
+
// Assets uploaded to: https://github.com/MetaMask/contract-metadata/tree/master/icons/eip155:999
|
|
43
|
+
// HIP-3 assets use format: hip3:dex_SYMBOL.svg (e.g., hip3:xyz_AAPL.svg)
|
|
44
|
+
// Regular assets use format: SYMBOL.svg (e.g., BTC.svg)
|
|
45
|
+
exports.METAMASK_PERPS_ICONS_BASE_URL = 'https://raw.githubusercontent.com/MetaMask/contract-metadata/master/icons/eip155:999/';
|
|
46
|
+
// Asset configurations for multichain abstraction
|
|
47
|
+
exports.HYPERLIQUID_ASSET_CONFIGS = {
|
|
48
|
+
usdc: {
|
|
49
|
+
mainnet: `${exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID}/erc20:0xaf88d065e77c8cC2239327C5EDb3A432268e5831/default`,
|
|
50
|
+
testnet: `${exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID}/erc20:0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d/default`,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
// HyperLiquid bridge contract addresses for direct USDC deposits
|
|
54
|
+
// These are the official bridge contracts where USDC must be sent to credit user's HyperLiquid account
|
|
55
|
+
exports.HYPERLIQUID_BRIDGE_CONTRACTS = {
|
|
56
|
+
mainnet: {
|
|
57
|
+
chainId: exports.ARBITRUM_MAINNET_CAIP_CHAIN_ID,
|
|
58
|
+
contractAddress: '0x2df1c51e09aecf9cacb7bc98cb1742757f163df7',
|
|
59
|
+
},
|
|
60
|
+
testnet: {
|
|
61
|
+
chainId: exports.ARBITRUM_TESTNET_CAIP_CHAIN_ID,
|
|
62
|
+
contractAddress: '0x08cfc1B6b2dCF36A1480b99353A354AA8AC56f89',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
// SDK transport configuration
|
|
66
|
+
exports.HYPERLIQUID_TRANSPORT_CONFIG = {
|
|
67
|
+
timeout: 10000,
|
|
68
|
+
keepAlive: { interval: 30000 },
|
|
69
|
+
reconnect: {
|
|
70
|
+
maxRetries: 5,
|
|
71
|
+
connectionTimeout: 10000,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
// Trading configuration constants
|
|
75
|
+
exports.TRADING_DEFAULTS = {
|
|
76
|
+
leverage: 3, // 3x default leverage
|
|
77
|
+
marginPercent: 10, // 10% fixed margin default
|
|
78
|
+
takeProfitPercent: 0.3, // 30% take profit
|
|
79
|
+
stopLossPercent: 0.1, // 10% stop loss
|
|
80
|
+
amount: {
|
|
81
|
+
mainnet: 10, // $10 minimum order size
|
|
82
|
+
testnet: 10, // $10 minimum order size
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
// Fee configuration
|
|
86
|
+
// Note: These are base rates (Tier 0, no discounts)
|
|
87
|
+
// Actual fees will be calculated based on user's volume tier and staking
|
|
88
|
+
exports.FEE_RATES = {
|
|
89
|
+
taker: 0.00045, // 0.045% - Market orders and aggressive limit orders
|
|
90
|
+
maker: 0.00015, // 0.015% - Limit orders that add liquidity
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* HIP-3 dynamic fee calculation configuration
|
|
94
|
+
*
|
|
95
|
+
* HIP-3 (builder-deployed) perpetual markets have variable fees based on:
|
|
96
|
+
* 1. deployerFeeScale - Per-DEX fee multiplier (fetched from perpDexs API)
|
|
97
|
+
* 2. growthMode - Per-asset 90% fee reduction (fetched from meta API)
|
|
98
|
+
*
|
|
99
|
+
* Fee Formula (from HyperLiquid docs):
|
|
100
|
+
* - scaleIfHip3 = deployerFeeScale < 1 ? deployerFeeScale + 1 : deployerFeeScale * 2
|
|
101
|
+
* - growthModeScale = growthMode ? 0.1 : 1
|
|
102
|
+
* - finalRate = baseRate * scaleIfHip3 * growthModeScale
|
|
103
|
+
*
|
|
104
|
+
* Example: For xyz:TSLA with deployerFeeScale=1.0 and growthMode="enabled":
|
|
105
|
+
* - scaleIfHip3 = 1.0 * 2 = 2.0
|
|
106
|
+
* - growthModeScale = 0.1 (90% reduction)
|
|
107
|
+
* - Final multiplier = 2.0 * 0.1 = 0.2 (effectively 80% off standard 2x HIP-3 fees)
|
|
108
|
+
*
|
|
109
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
|
|
110
|
+
* @see parseAssetName() in HyperLiquidProvider for HIP-3 asset detection
|
|
111
|
+
*/
|
|
112
|
+
exports.HIP3_FEE_CONFIG = {
|
|
113
|
+
/**
|
|
114
|
+
* Growth Mode multiplier - 90% fee reduction for assets in growth phase
|
|
115
|
+
* This is a protocol constant from HyperLiquid's fee formula
|
|
116
|
+
*/
|
|
117
|
+
GrowthModeScale: 0.1,
|
|
118
|
+
/**
|
|
119
|
+
* Default deployerFeeScale when API is unavailable
|
|
120
|
+
* Most HIP-3 DEXs use 1.0, which results in 2x base fees
|
|
121
|
+
*/
|
|
122
|
+
DefaultDeployerFeeScale: 1.0,
|
|
123
|
+
/**
|
|
124
|
+
* Cache TTL for perpDexs data (5 minutes)
|
|
125
|
+
* Fee scales rarely change, so longer cache is acceptable
|
|
126
|
+
*/
|
|
127
|
+
PerpDexsCacheTtlMs: 5 * 60 * 1000,
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated Use dynamic calculation via calculateHip3FeeMultiplier()
|
|
130
|
+
* Kept for backwards compatibility during migration
|
|
131
|
+
*/
|
|
132
|
+
FeeMultiplier: 2,
|
|
133
|
+
};
|
|
134
|
+
const BUILDER_FEE_MAX_FEE_DECIMAL = 0.001;
|
|
135
|
+
// Builder fee configuration
|
|
136
|
+
exports.BUILDER_FEE_CONFIG = {
|
|
137
|
+
// Test builder wallet
|
|
138
|
+
TestnetBuilder: '0x724e57771ba749650875bd8adb2e29a85d0cacfa',
|
|
139
|
+
// Production builder wallet
|
|
140
|
+
MainnetBuilder: '0xe95a5e31904e005066614247d309e00d8ad753aa',
|
|
141
|
+
// Fee in decimal (10 bp = 0.1%)
|
|
142
|
+
MaxFeeDecimal: BUILDER_FEE_MAX_FEE_DECIMAL,
|
|
143
|
+
MaxFeeTenthsBps: BUILDER_FEE_MAX_FEE_DECIMAL * 100000,
|
|
144
|
+
MaxFeeRate: `${(BUILDER_FEE_MAX_FEE_DECIMAL * 100)
|
|
145
|
+
.toFixed(4)
|
|
146
|
+
.replace(/\.?0+$/u, '')}%`,
|
|
147
|
+
};
|
|
148
|
+
// Referral code configuration
|
|
149
|
+
exports.REFERRAL_CONFIG = {
|
|
150
|
+
// Production referral code
|
|
151
|
+
MainnetCode: 'MMCSI',
|
|
152
|
+
// Development/testnet referral code
|
|
153
|
+
TestnetCode: 'MMCSITEST',
|
|
154
|
+
};
|
|
155
|
+
// Deposit constants
|
|
156
|
+
exports.DEPOSIT_CONFIG = {
|
|
157
|
+
EstimatedGasLimit: 150000, // Estimated gas limit for bridge deposit
|
|
158
|
+
DefaultSlippage: 1, // 1% default slippage for bridge quotes
|
|
159
|
+
BridgeQuoteTimeout: 1000, // 1 second timeout for bridge quotes
|
|
160
|
+
RefreshRate: 30000, // 30 seconds quote refresh rate
|
|
161
|
+
EstimatedTime: {
|
|
162
|
+
DirectDeposit: '3-5 seconds', // Direct USDC deposit on Arbitrum
|
|
163
|
+
SameChainSwap: '30-60 seconds', // Swap on same chain before deposit
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
// Withdrawal constants (HyperLiquid-specific)
|
|
167
|
+
exports.HYPERLIQUID_WITHDRAWAL_MINUTES = 5; // HyperLiquid withdrawal processing time in minutes
|
|
168
|
+
// Configuration helpers
|
|
169
|
+
function getWebSocketEndpoint(isTestnet) {
|
|
170
|
+
return isTestnet
|
|
171
|
+
? exports.HYPERLIQUID_ENDPOINTS.testnet
|
|
172
|
+
: exports.HYPERLIQUID_ENDPOINTS.mainnet;
|
|
173
|
+
}
|
|
174
|
+
exports.getWebSocketEndpoint = getWebSocketEndpoint;
|
|
175
|
+
function getChainId(isTestnet) {
|
|
176
|
+
return isTestnet ? exports.ARBITRUM_TESTNET_CHAIN_ID : exports.ARBITRUM_MAINNET_CHAIN_ID;
|
|
177
|
+
}
|
|
178
|
+
exports.getChainId = getChainId;
|
|
179
|
+
function getCaipChainId(isTestnet) {
|
|
180
|
+
const network = isTestnet ? 'testnet' : 'mainnet';
|
|
181
|
+
return exports.HYPERLIQUID_BRIDGE_CONTRACTS[network].chainId;
|
|
182
|
+
}
|
|
183
|
+
exports.getCaipChainId = getCaipChainId;
|
|
184
|
+
function getBridgeInfo(isTestnet) {
|
|
185
|
+
const network = isTestnet ? 'testnet' : 'mainnet';
|
|
186
|
+
return exports.HYPERLIQUID_BRIDGE_CONTRACTS[network];
|
|
187
|
+
}
|
|
188
|
+
exports.getBridgeInfo = getBridgeInfo;
|
|
189
|
+
function getSupportedAssets(isTestnet) {
|
|
190
|
+
const network = isTestnet ? 'testnet' : 'mainnet';
|
|
191
|
+
return Object.values(exports.HYPERLIQUID_ASSET_CONFIGS).map((config) => config[network]);
|
|
192
|
+
}
|
|
193
|
+
exports.getSupportedAssets = getSupportedAssets;
|
|
194
|
+
// CAIP asset namespace constants
|
|
195
|
+
exports.CAIP_ASSET_NAMESPACES = {
|
|
196
|
+
Erc20: 'erc20',
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* HyperLiquid protocol-specific configuration
|
|
200
|
+
* Contains constants specific to HyperLiquid's perps exchange
|
|
201
|
+
*/
|
|
202
|
+
exports.HYPERLIQUID_CONFIG = {
|
|
203
|
+
// Exchange name used in predicted funding data
|
|
204
|
+
// HyperLiquid uses 'HlPerp' as their perps exchange identifier
|
|
205
|
+
ExchangeName: 'HlPerp',
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* HIP-3 multi-DEX asset ID calculation constants
|
|
209
|
+
* Per HIP-3-IMPLEMENTATION.md:
|
|
210
|
+
* - Main DEX: assetId = index (0, 1, 2, ...)
|
|
211
|
+
* - HIP-3 DEX: assetId = BASE_ASSET_ID + (perpDexIndex × DEX_MULTIPLIER) + index
|
|
212
|
+
*
|
|
213
|
+
* This formula enables proper order routing across multiple DEXs:
|
|
214
|
+
* - Main DEX (perpDexIndex=0): Uses index directly (BTC=0, ETH=1, SOL=2, etc.)
|
|
215
|
+
* - xyz DEX (perpDexIndex=1): 100000 + (1 × 10000) + index = 110000-110999
|
|
216
|
+
* - abc DEX (perpDexIndex=2): 100000 + (2 × 10000) + index = 120000-120999
|
|
217
|
+
*
|
|
218
|
+
* Supports up to 10 HIP-3 DEXs with 10000 assets each.
|
|
219
|
+
*/
|
|
220
|
+
exports.HIP3_ASSET_ID_CONFIG = {
|
|
221
|
+
// Base offset for HIP-3 asset IDs (100000)
|
|
222
|
+
// Ensures HIP-3 asset IDs don't conflict with main DEX indices
|
|
223
|
+
BaseAssetId: 100000,
|
|
224
|
+
// Multiplier for DEX index in asset ID calculation (10000)
|
|
225
|
+
// Allocates 10000 asset ID slots per DEX (0-9999)
|
|
226
|
+
DexMultiplier: 10000,
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Basis points conversion constant
|
|
230
|
+
* 1 basis point (bp) = 0.01% = 0.0001 as decimal
|
|
231
|
+
* Used for fee discount calculations (e.g., 6500 bps = 65%)
|
|
232
|
+
*/
|
|
233
|
+
exports.BASIS_POINTS_DIVISOR = 10000;
|
|
234
|
+
/**
|
|
235
|
+
* HIP-3 asset market type classifications (PRODUCTION DEFAULT)
|
|
236
|
+
*
|
|
237
|
+
* This is the production default configuration, can be overridden via feature flag
|
|
238
|
+
* (remoteFeatureFlags.perpsAssetMarketTypes) for dynamic control.
|
|
239
|
+
*
|
|
240
|
+
* Maps asset symbols (e.g., "xyz:TSLA") to their market type for badge display.
|
|
241
|
+
*
|
|
242
|
+
* Market type determines the badge shown in the UI:
|
|
243
|
+
* - 'equity': STOCK badge (stocks like TSLA, NVDA)
|
|
244
|
+
* - 'commodity': COMMODITY badge (commodities like GOLD)
|
|
245
|
+
* - 'forex': FOREX badge (forex pairs)
|
|
246
|
+
* - undefined: No badge for crypto or unmapped assets
|
|
247
|
+
*
|
|
248
|
+
* Format: 'dex:SYMBOL' → MarketType
|
|
249
|
+
* This allows flexible per-asset classification.
|
|
250
|
+
* Assets not listed here will have no market type (undefined).
|
|
251
|
+
*/
|
|
252
|
+
exports.HIP3_ASSET_MARKET_TYPES = {
|
|
253
|
+
// xyz DEX - Equities
|
|
254
|
+
'xyz:TSLA': 'equity',
|
|
255
|
+
'xyz:NVDA': 'equity',
|
|
256
|
+
'xyz:XYZ100': 'equity',
|
|
257
|
+
'xyz:INTC': 'equity',
|
|
258
|
+
'xyz:MU': 'equity',
|
|
259
|
+
'xyz:CRCL': 'equity',
|
|
260
|
+
'xyz:HOOD': 'equity',
|
|
261
|
+
'xyz:SNDK': 'equity',
|
|
262
|
+
'xyz:GOOGL': 'equity',
|
|
263
|
+
'xyz:COIN': 'equity',
|
|
264
|
+
'xyz:ORCL': 'equity',
|
|
265
|
+
'xyz:AMZN': 'equity',
|
|
266
|
+
'xyz:PLTR': 'equity',
|
|
267
|
+
'xyz:AAPL': 'equity',
|
|
268
|
+
'xyz:META': 'equity',
|
|
269
|
+
'xyz:AMD': 'equity',
|
|
270
|
+
'xyz:MSFT': 'equity',
|
|
271
|
+
'xyz:BABA': 'equity',
|
|
272
|
+
'xyz:RIVN': 'equity',
|
|
273
|
+
'xyz:NFLX': 'equity',
|
|
274
|
+
'xyz:COST': 'equity',
|
|
275
|
+
'xyz:LLY': 'equity',
|
|
276
|
+
'xyz:TSM': 'equity',
|
|
277
|
+
'xyz:SKHX': 'equity',
|
|
278
|
+
'xyz:MSTR': 'equity',
|
|
279
|
+
'xyz:CRWV': 'equity',
|
|
280
|
+
'xyz:SMSN': 'equity',
|
|
281
|
+
// xyz DEX - Commodities
|
|
282
|
+
'xyz:GOLD': 'commodity',
|
|
283
|
+
'xyz:SILVER': 'commodity',
|
|
284
|
+
'xyz:CL': 'commodity',
|
|
285
|
+
'xyz:COPPER': 'commodity',
|
|
286
|
+
'xyz:ALUMINIUM': 'commodity',
|
|
287
|
+
'xyz:URANIUM': 'commodity',
|
|
288
|
+
'xyz:USAR': 'commodity',
|
|
289
|
+
'xyz:NATGAS': 'commodity',
|
|
290
|
+
'xyz:PLATINUM': 'commodity',
|
|
291
|
+
// xyz DEX - Forex
|
|
292
|
+
'xyz:EUR': 'forex',
|
|
293
|
+
'xyz:JPY': 'forex',
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Testnet-specific HIP-3 DEX configuration
|
|
297
|
+
*
|
|
298
|
+
* On testnet, there are many HIP-3 DEXs (test deployments from various builders).
|
|
299
|
+
* Subscribing to all of them causes connection/subscription overload and instability.
|
|
300
|
+
* This configuration limits which DEXs are discovered and subscribed to on testnet.
|
|
301
|
+
*/
|
|
302
|
+
exports.TESTNET_HIP3_CONFIG = {
|
|
303
|
+
/**
|
|
304
|
+
* Allowed DEX names for testnet
|
|
305
|
+
* Empty array = main DEX only (no HIP-3 DEXs)
|
|
306
|
+
* Add specific DEX names to test with particular HIP-3 DEXs: ['testdex1', 'testdex2']
|
|
307
|
+
*/
|
|
308
|
+
EnabledDexs: ['xyz'],
|
|
309
|
+
/**
|
|
310
|
+
* Set to true to enable full HIP-3 discovery on testnet (not recommended)
|
|
311
|
+
* When false, only DEXs in ENABLED_DEXS are used
|
|
312
|
+
*/
|
|
313
|
+
AutoDiscoverAll: false,
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Mainnet-specific HIP-3 DEX configuration
|
|
317
|
+
*
|
|
318
|
+
* On mainnet, DEX filtering is dynamically determined from the allowlist markets
|
|
319
|
+
* feature flag. This avoids hardcoding DEX names and ensures consistency with
|
|
320
|
+
* the market filtering logic.
|
|
321
|
+
*
|
|
322
|
+
* When AutoDiscoverAll is false and no allowlist is provided, only the main DEX is used.
|
|
323
|
+
* When an allowlist is provided, DEXs are extracted from the allowlist patterns.
|
|
324
|
+
*/
|
|
325
|
+
exports.MAINNET_HIP3_CONFIG = {
|
|
326
|
+
/**
|
|
327
|
+
* Set to true to enable full HIP-3 discovery on mainnet
|
|
328
|
+
* When false, DEXs are filtered based on the allowlist markets feature flag
|
|
329
|
+
* (recommended for production to reduce subscription overhead)
|
|
330
|
+
*/
|
|
331
|
+
AutoDiscoverAll: false,
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* HIP-3 margin management configuration
|
|
335
|
+
* Controls margin buffers and auto-rebalance behavior for HIP-3 DEXes with isolated margin
|
|
336
|
+
*
|
|
337
|
+
* Background: HyperLiquid validates availableBalance >= totalRequiredMargin BEFORE reallocating
|
|
338
|
+
* existing locked margin. This requires temporary over-funding when increasing positions,
|
|
339
|
+
* followed by automatic cleanup to minimize locked capital.
|
|
340
|
+
*/
|
|
341
|
+
exports.HIP3_MARGIN_CONFIG = {
|
|
342
|
+
/**
|
|
343
|
+
* Margin buffer multiplier for fees and slippage (0.3% = multiply by 1.003)
|
|
344
|
+
* Covers HyperLiquid's max taker fee (0.035%) with comfortable margin
|
|
345
|
+
*/
|
|
346
|
+
BufferMultiplier: 1.003,
|
|
347
|
+
/**
|
|
348
|
+
* Desired buffer to keep on HIP-3 DEX after auto-rebalance (USDC amount)
|
|
349
|
+
* Small buffer allows quick follow-up orders without transfers
|
|
350
|
+
*/
|
|
351
|
+
RebalanceDesiredBuffer: 0.1,
|
|
352
|
+
/**
|
|
353
|
+
* Minimum excess threshold to trigger auto-rebalance (USDC amount)
|
|
354
|
+
* Prevents unnecessary transfers for tiny amounts
|
|
355
|
+
*/
|
|
356
|
+
RebalanceMinThreshold: 0.1,
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Configuration for USDH collateral handling on HIP-3 DEXs
|
|
360
|
+
* Per HyperLiquid docs: USDH DEXs pull collateral from spot balance automatically
|
|
361
|
+
*
|
|
362
|
+
* USDH is HyperLiquid's native stablecoin pegged 1:1 to USDC
|
|
363
|
+
*/
|
|
364
|
+
exports.USDH_CONFIG = {
|
|
365
|
+
/** Token name for USDH collateral */
|
|
366
|
+
TokenName: 'USDH',
|
|
367
|
+
/**
|
|
368
|
+
* Maximum slippage for USDC→USDH spot swap in basis points
|
|
369
|
+
* USDH is pegged 1:1 to USDC so slippage should be minimal
|
|
370
|
+
* 10 bps (0.1%) provides small buffer for spread
|
|
371
|
+
*/
|
|
372
|
+
SwapSlippageBps: 10,
|
|
373
|
+
};
|
|
374
|
+
// Progress bar constants
|
|
375
|
+
exports.INITIAL_AMOUNT_UI_PROGRESS = 10;
|
|
376
|
+
exports.WITHDRAWAL_PROGRESS_STAGES = [
|
|
377
|
+
25, 35, 45, 55, 65, 75, 85, 90, 95, 98,
|
|
378
|
+
];
|
|
379
|
+
exports.PROGRESS_BAR_COMPLETION_DELAY_MS = 500;
|
|
380
|
+
//# sourceMappingURL=hyperLiquidConfig.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperLiquidConfig.cjs","sourceRoot":"","sources":["../../src/constants/hyperLiquidConfig.ts"],"names":[],"mappings":";;;;AAaA,oBAAoB;AACP,QAAA,6BAA6B,GAAG,QAAQ,CAAC;AACzC,QAAA,yBAAyB,GAAG,OAAO,CAAC;AACpC,QAAA,yBAAyB,GAAG,QAAQ,CAAC;AACrC,QAAA,8BAA8B,GAAG,UAAU,iCAAyB,EAAE,CAAC;AACvE,QAAA,8BAA8B,GAAG,UAAU,iCAAyB,EAAE,CAAC;AAEpF,8BAA8B;AACjB,QAAA,4BAA4B,GAAG,OAAO,CAAC,CAAC,iBAAiB;AACzD,QAAA,4BAA4B,GAAG,OAAO,CAAC,CAAC,2BAA2B;AACnE,QAAA,iCAAiC,GAAG,YAA2B,CAAC;AAChE,QAAA,iCAAiC,GAAG,YAA2B,CAAC;AAChE,QAAA,wBAAwB,GAAG,aA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E,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\nimport type {\n HyperLiquidNetwork,\n HyperLiquidEndpoints,\n HyperLiquidAssetConfigs,\n BridgeContractConfig,\n HyperLiquidBridgeContracts,\n HyperLiquidTransportConfig,\n TradingDefaultsConfig,\n FeeRatesConfig,\n} from '../types/perps-types';\n\n// Network constants\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// Token constants\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// WebSocket endpoints\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// Asset configurations for multichain abstraction\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// SDK transport configuration\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// Trading configuration constants\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 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// 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\n\n// Type helpers\nexport type SupportedAsset = keyof typeof HYPERLIQUID_ASSET_CONFIGS;\n\n// Configuration helpers\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 'xyz:INTC': 'equity',\n 'xyz:MU': 'equity',\n 'xyz:CRCL': 'equity',\n 'xyz:HOOD': 'equity',\n 'xyz:SNDK': 'equity',\n 'xyz:GOOGL': 'equity',\n 'xyz:COIN': 'equity',\n 'xyz:ORCL': 'equity',\n 'xyz:AMZN': 'equity',\n 'xyz:PLTR': 'equity',\n 'xyz:AAPL': 'equity',\n 'xyz:META': 'equity',\n 'xyz:AMD': 'equity',\n 'xyz:MSFT': 'equity',\n 'xyz:BABA': 'equity',\n 'xyz:RIVN': 'equity',\n 'xyz:NFLX': 'equity',\n 'xyz:COST': 'equity',\n 'xyz:LLY': 'equity',\n 'xyz:TSM': 'equity',\n 'xyz:SKHX': 'equity',\n 'xyz:MSTR': 'equity',\n 'xyz:CRWV': 'equity',\n 'xyz:SMSN': 'equity',\n\n // xyz DEX - Commodities\n 'xyz:GOLD': 'commodity',\n 'xyz:SILVER': 'commodity',\n 'xyz:CL': 'commodity',\n 'xyz:COPPER': 'commodity',\n 'xyz:ALUMINIUM': 'commodity',\n 'xyz:URANIUM': 'commodity',\n 'xyz:USAR': 'commodity',\n 'xyz:NATGAS': 'commodity',\n 'xyz:PLATINUM': 'commodity',\n\n // xyz DEX - Forex\n 'xyz:EUR': 'forex',\n 'xyz:JPY': 'forex',\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 */\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 * Mainnet-specific HIP-3 DEX configuration\n *\n * On mainnet, DEX filtering is dynamically determined from the allowlist markets\n * feature flag. This avoids hardcoding DEX names and ensures consistency with\n * the market filtering logic.\n *\n * When AutoDiscoverAll is false and no allowlist is provided, only the main DEX is used.\n * When an allowlist is provided, DEXs are extracted from the allowlist patterns.\n */\nexport const MAINNET_HIP3_CONFIG = {\n /**\n * Set to true to enable full HIP-3 discovery on mainnet\n * When false, DEXs are filtered based on the allowlist markets feature flag\n * (recommended for production to reduce subscription overhead)\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"]}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { CaipAssetId, CaipChainId } from "@metamask/utils";
|
|
2
|
+
import type { HyperLiquidEndpoints, HyperLiquidAssetConfigs, BridgeContractConfig, HyperLiquidBridgeContracts, HyperLiquidTransportConfig, TradingDefaultsConfig, FeeRatesConfig } from "../types/perps-types.cjs";
|
|
3
|
+
export declare const ARBITRUM_MAINNET_CHAIN_ID_HEX = "0xa4b1";
|
|
4
|
+
export declare const ARBITRUM_MAINNET_CHAIN_ID = "42161";
|
|
5
|
+
export declare const ARBITRUM_TESTNET_CHAIN_ID = "421614";
|
|
6
|
+
export declare const ARBITRUM_MAINNET_CAIP_CHAIN_ID = "eip155:42161";
|
|
7
|
+
export declare const ARBITRUM_TESTNET_CAIP_CHAIN_ID = "eip155:421614";
|
|
8
|
+
export declare const HYPERLIQUID_MAINNET_CHAIN_ID = "0x3e7";
|
|
9
|
+
export declare const HYPERLIQUID_TESTNET_CHAIN_ID = "0x3e6";
|
|
10
|
+
export declare const HYPERLIQUID_MAINNET_CAIP_CHAIN_ID: `${string}:${string}`;
|
|
11
|
+
export declare const HYPERLIQUID_TESTNET_CAIP_CHAIN_ID: `${string}:${string}`;
|
|
12
|
+
export declare const HYPERLIQUID_NETWORK_NAME = "Hyperliquid";
|
|
13
|
+
export declare const USDC_SYMBOL = "USDC";
|
|
14
|
+
export declare const USDC_NAME = "USD Coin";
|
|
15
|
+
export declare const USDC_DECIMALS = 6;
|
|
16
|
+
export declare const TOKEN_DECIMALS = 18;
|
|
17
|
+
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
18
|
+
export declare const ZERO_BALANCE = "0x0";
|
|
19
|
+
export declare const ARBITRUM_SEPOLIA_CHAIN_ID = "0x66eee";
|
|
20
|
+
export declare const USDC_ETHEREUM_MAINNET_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48";
|
|
21
|
+
export declare const USDC_ARBITRUM_MAINNET_ADDRESS = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
|
|
22
|
+
export declare const USDC_ARBITRUM_TESTNET_ADDRESS = "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d";
|
|
23
|
+
export declare const USDC_TOKEN_ICON_URL = "https://static.cx.metamask.io/api/v1/tokenIcons/1/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png";
|
|
24
|
+
export declare const HYPERLIQUID_ENDPOINTS: HyperLiquidEndpoints;
|
|
25
|
+
export declare const HYPERLIQUID_ASSET_ICONS_BASE_URL = "https://app.hyperliquid.xyz/coins/";
|
|
26
|
+
export declare const METAMASK_PERPS_ICONS_BASE_URL = "https://raw.githubusercontent.com/MetaMask/contract-metadata/master/icons/eip155:999/";
|
|
27
|
+
export declare const HYPERLIQUID_ASSET_CONFIGS: HyperLiquidAssetConfigs;
|
|
28
|
+
export declare const HYPERLIQUID_BRIDGE_CONTRACTS: HyperLiquidBridgeContracts;
|
|
29
|
+
export declare const HYPERLIQUID_TRANSPORT_CONFIG: HyperLiquidTransportConfig;
|
|
30
|
+
export declare const TRADING_DEFAULTS: TradingDefaultsConfig;
|
|
31
|
+
export declare const FEE_RATES: FeeRatesConfig;
|
|
32
|
+
/**
|
|
33
|
+
* HIP-3 dynamic fee calculation configuration
|
|
34
|
+
*
|
|
35
|
+
* HIP-3 (builder-deployed) perpetual markets have variable fees based on:
|
|
36
|
+
* 1. deployerFeeScale - Per-DEX fee multiplier (fetched from perpDexs API)
|
|
37
|
+
* 2. growthMode - Per-asset 90% fee reduction (fetched from meta API)
|
|
38
|
+
*
|
|
39
|
+
* Fee Formula (from HyperLiquid docs):
|
|
40
|
+
* - scaleIfHip3 = deployerFeeScale < 1 ? deployerFeeScale + 1 : deployerFeeScale * 2
|
|
41
|
+
* - growthModeScale = growthMode ? 0.1 : 1
|
|
42
|
+
* - finalRate = baseRate * scaleIfHip3 * growthModeScale
|
|
43
|
+
*
|
|
44
|
+
* Example: For xyz:TSLA with deployerFeeScale=1.0 and growthMode="enabled":
|
|
45
|
+
* - scaleIfHip3 = 1.0 * 2 = 2.0
|
|
46
|
+
* - growthModeScale = 0.1 (90% reduction)
|
|
47
|
+
* - Final multiplier = 2.0 * 0.1 = 0.2 (effectively 80% off standard 2x HIP-3 fees)
|
|
48
|
+
*
|
|
49
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
|
|
50
|
+
* @see parseAssetName() in HyperLiquidProvider for HIP-3 asset detection
|
|
51
|
+
*/
|
|
52
|
+
export declare const HIP3_FEE_CONFIG: {
|
|
53
|
+
/**
|
|
54
|
+
* Growth Mode multiplier - 90% fee reduction for assets in growth phase
|
|
55
|
+
* This is a protocol constant from HyperLiquid's fee formula
|
|
56
|
+
*/
|
|
57
|
+
readonly GrowthModeScale: 0.1;
|
|
58
|
+
/**
|
|
59
|
+
* Default deployerFeeScale when API is unavailable
|
|
60
|
+
* Most HIP-3 DEXs use 1.0, which results in 2x base fees
|
|
61
|
+
*/
|
|
62
|
+
readonly DefaultDeployerFeeScale: 1;
|
|
63
|
+
/**
|
|
64
|
+
* Cache TTL for perpDexs data (5 minutes)
|
|
65
|
+
* Fee scales rarely change, so longer cache is acceptable
|
|
66
|
+
*/
|
|
67
|
+
readonly PerpDexsCacheTtlMs: number;
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Use dynamic calculation via calculateHip3FeeMultiplier()
|
|
70
|
+
* Kept for backwards compatibility during migration
|
|
71
|
+
*/
|
|
72
|
+
readonly FeeMultiplier: 2;
|
|
73
|
+
};
|
|
74
|
+
export declare const BUILDER_FEE_CONFIG: {
|
|
75
|
+
TestnetBuilder: `0x${string}`;
|
|
76
|
+
MainnetBuilder: `0x${string}`;
|
|
77
|
+
MaxFeeDecimal: number;
|
|
78
|
+
MaxFeeTenthsBps: number;
|
|
79
|
+
MaxFeeRate: string;
|
|
80
|
+
};
|
|
81
|
+
export declare const REFERRAL_CONFIG: {
|
|
82
|
+
MainnetCode: string;
|
|
83
|
+
TestnetCode: string;
|
|
84
|
+
};
|
|
85
|
+
export declare const DEPOSIT_CONFIG: {
|
|
86
|
+
EstimatedGasLimit: number;
|
|
87
|
+
DefaultSlippage: number;
|
|
88
|
+
BridgeQuoteTimeout: number;
|
|
89
|
+
RefreshRate: number;
|
|
90
|
+
EstimatedTime: {
|
|
91
|
+
DirectDeposit: string;
|
|
92
|
+
SameChainSwap: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export declare const HYPERLIQUID_WITHDRAWAL_MINUTES = 5;
|
|
96
|
+
export type SupportedAsset = keyof typeof HYPERLIQUID_ASSET_CONFIGS;
|
|
97
|
+
export declare function getWebSocketEndpoint(isTestnet: boolean): string;
|
|
98
|
+
export declare function getChainId(isTestnet: boolean): string;
|
|
99
|
+
export declare function getCaipChainId(isTestnet: boolean): CaipChainId;
|
|
100
|
+
export declare function getBridgeInfo(isTestnet: boolean): BridgeContractConfig;
|
|
101
|
+
export declare function getSupportedAssets(isTestnet?: boolean): CaipAssetId[];
|
|
102
|
+
export declare const CAIP_ASSET_NAMESPACES: {
|
|
103
|
+
readonly Erc20: "erc20";
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* HyperLiquid protocol-specific configuration
|
|
107
|
+
* Contains constants specific to HyperLiquid's perps exchange
|
|
108
|
+
*/
|
|
109
|
+
export declare const HYPERLIQUID_CONFIG: {
|
|
110
|
+
readonly ExchangeName: "HlPerp";
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* HIP-3 multi-DEX asset ID calculation constants
|
|
114
|
+
* Per HIP-3-IMPLEMENTATION.md:
|
|
115
|
+
* - Main DEX: assetId = index (0, 1, 2, ...)
|
|
116
|
+
* - HIP-3 DEX: assetId = BASE_ASSET_ID + (perpDexIndex × DEX_MULTIPLIER) + index
|
|
117
|
+
*
|
|
118
|
+
* This formula enables proper order routing across multiple DEXs:
|
|
119
|
+
* - Main DEX (perpDexIndex=0): Uses index directly (BTC=0, ETH=1, SOL=2, etc.)
|
|
120
|
+
* - xyz DEX (perpDexIndex=1): 100000 + (1 × 10000) + index = 110000-110999
|
|
121
|
+
* - abc DEX (perpDexIndex=2): 100000 + (2 × 10000) + index = 120000-120999
|
|
122
|
+
*
|
|
123
|
+
* Supports up to 10 HIP-3 DEXs with 10000 assets each.
|
|
124
|
+
*/
|
|
125
|
+
export declare const HIP3_ASSET_ID_CONFIG: {
|
|
126
|
+
readonly BaseAssetId: 100000;
|
|
127
|
+
readonly DexMultiplier: 10000;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Basis points conversion constant
|
|
131
|
+
* 1 basis point (bp) = 0.01% = 0.0001 as decimal
|
|
132
|
+
* Used for fee discount calculations (e.g., 6500 bps = 65%)
|
|
133
|
+
*/
|
|
134
|
+
export declare const BASIS_POINTS_DIVISOR = 10000;
|
|
135
|
+
/**
|
|
136
|
+
* HIP-3 asset market type classifications (PRODUCTION DEFAULT)
|
|
137
|
+
*
|
|
138
|
+
* This is the production default configuration, can be overridden via feature flag
|
|
139
|
+
* (remoteFeatureFlags.perpsAssetMarketTypes) for dynamic control.
|
|
140
|
+
*
|
|
141
|
+
* Maps asset symbols (e.g., "xyz:TSLA") to their market type for badge display.
|
|
142
|
+
*
|
|
143
|
+
* Market type determines the badge shown in the UI:
|
|
144
|
+
* - 'equity': STOCK badge (stocks like TSLA, NVDA)
|
|
145
|
+
* - 'commodity': COMMODITY badge (commodities like GOLD)
|
|
146
|
+
* - 'forex': FOREX badge (forex pairs)
|
|
147
|
+
* - undefined: No badge for crypto or unmapped assets
|
|
148
|
+
*
|
|
149
|
+
* Format: 'dex:SYMBOL' → MarketType
|
|
150
|
+
* This allows flexible per-asset classification.
|
|
151
|
+
* Assets not listed here will have no market type (undefined).
|
|
152
|
+
*/
|
|
153
|
+
export declare const HIP3_ASSET_MARKET_TYPES: Record<string, 'equity' | 'commodity' | 'forex' | 'crypto'>;
|
|
154
|
+
/**
|
|
155
|
+
* Testnet-specific HIP-3 DEX configuration
|
|
156
|
+
*
|
|
157
|
+
* On testnet, there are many HIP-3 DEXs (test deployments from various builders).
|
|
158
|
+
* Subscribing to all of them causes connection/subscription overload and instability.
|
|
159
|
+
* This configuration limits which DEXs are discovered and subscribed to on testnet.
|
|
160
|
+
*/
|
|
161
|
+
export declare const TESTNET_HIP3_CONFIG: {
|
|
162
|
+
/**
|
|
163
|
+
* Allowed DEX names for testnet
|
|
164
|
+
* Empty array = main DEX only (no HIP-3 DEXs)
|
|
165
|
+
* Add specific DEX names to test with particular HIP-3 DEXs: ['testdex1', 'testdex2']
|
|
166
|
+
*/
|
|
167
|
+
readonly EnabledDexs: string[];
|
|
168
|
+
/**
|
|
169
|
+
* Set to true to enable full HIP-3 discovery on testnet (not recommended)
|
|
170
|
+
* When false, only DEXs in ENABLED_DEXS are used
|
|
171
|
+
*/
|
|
172
|
+
readonly AutoDiscoverAll: false;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Mainnet-specific HIP-3 DEX configuration
|
|
176
|
+
*
|
|
177
|
+
* On mainnet, DEX filtering is dynamically determined from the allowlist markets
|
|
178
|
+
* feature flag. This avoids hardcoding DEX names and ensures consistency with
|
|
179
|
+
* the market filtering logic.
|
|
180
|
+
*
|
|
181
|
+
* When AutoDiscoverAll is false and no allowlist is provided, only the main DEX is used.
|
|
182
|
+
* When an allowlist is provided, DEXs are extracted from the allowlist patterns.
|
|
183
|
+
*/
|
|
184
|
+
export declare const MAINNET_HIP3_CONFIG: {
|
|
185
|
+
/**
|
|
186
|
+
* Set to true to enable full HIP-3 discovery on mainnet
|
|
187
|
+
* When false, DEXs are filtered based on the allowlist markets feature flag
|
|
188
|
+
* (recommended for production to reduce subscription overhead)
|
|
189
|
+
*/
|
|
190
|
+
readonly AutoDiscoverAll: false;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* HIP-3 margin management configuration
|
|
194
|
+
* Controls margin buffers and auto-rebalance behavior for HIP-3 DEXes with isolated margin
|
|
195
|
+
*
|
|
196
|
+
* Background: HyperLiquid validates availableBalance >= totalRequiredMargin BEFORE reallocating
|
|
197
|
+
* existing locked margin. This requires temporary over-funding when increasing positions,
|
|
198
|
+
* followed by automatic cleanup to minimize locked capital.
|
|
199
|
+
*/
|
|
200
|
+
export declare const HIP3_MARGIN_CONFIG: {
|
|
201
|
+
/**
|
|
202
|
+
* Margin buffer multiplier for fees and slippage (0.3% = multiply by 1.003)
|
|
203
|
+
* Covers HyperLiquid's max taker fee (0.035%) with comfortable margin
|
|
204
|
+
*/
|
|
205
|
+
readonly BufferMultiplier: 1.003;
|
|
206
|
+
/**
|
|
207
|
+
* Desired buffer to keep on HIP-3 DEX after auto-rebalance (USDC amount)
|
|
208
|
+
* Small buffer allows quick follow-up orders without transfers
|
|
209
|
+
*/
|
|
210
|
+
readonly RebalanceDesiredBuffer: 0.1;
|
|
211
|
+
/**
|
|
212
|
+
* Minimum excess threshold to trigger auto-rebalance (USDC amount)
|
|
213
|
+
* Prevents unnecessary transfers for tiny amounts
|
|
214
|
+
*/
|
|
215
|
+
readonly RebalanceMinThreshold: 0.1;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Configuration for USDH collateral handling on HIP-3 DEXs
|
|
219
|
+
* Per HyperLiquid docs: USDH DEXs pull collateral from spot balance automatically
|
|
220
|
+
*
|
|
221
|
+
* USDH is HyperLiquid's native stablecoin pegged 1:1 to USDC
|
|
222
|
+
*/
|
|
223
|
+
export declare const USDH_CONFIG: {
|
|
224
|
+
/** Token name for USDH collateral */
|
|
225
|
+
readonly TokenName: "USDH";
|
|
226
|
+
/**
|
|
227
|
+
* Maximum slippage for USDC→USDH spot swap in basis points
|
|
228
|
+
* USDH is pegged 1:1 to USDC so slippage should be minimal
|
|
229
|
+
* 10 bps (0.1%) provides small buffer for spread
|
|
230
|
+
*/
|
|
231
|
+
readonly SwapSlippageBps: 10;
|
|
232
|
+
};
|
|
233
|
+
export declare const INITIAL_AMOUNT_UI_PROGRESS = 10;
|
|
234
|
+
export declare const WITHDRAWAL_PROGRESS_STAGES: number[];
|
|
235
|
+
export declare const PROGRESS_BAR_COMPLETION_DELAY_MS = 500;
|
|
236
|
+
//# sourceMappingURL=hyperLiquidConfig.d.cts.map
|