@metamask-previews/perps-controller 0.0.0-preview-ce3ee897a → 0.0.0-preview-e4aa1532

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