@metamask-previews/perps-controller 0.0.0-preview-e4aa1532 → 0.0.0-preview-6dfa4aeba

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (498) hide show
  1. package/CHANGELOG.md +1 -11
  2. package/dist/PerpsController.cjs +66 -2224
  3. package/dist/PerpsController.cjs.map +1 -1
  4. package/dist/PerpsController.d.cts +79 -933
  5. package/dist/PerpsController.d.cts.map +1 -1
  6. package/dist/PerpsController.d.mts +79 -933
  7. package/dist/PerpsController.d.mts.map +1 -1
  8. package/dist/PerpsController.mjs +64 -2221
  9. package/dist/PerpsController.mjs.map +1 -1
  10. package/dist/index.cjs +1 -32
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +2 -6
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.mts +2 -6
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +1 -9
  17. package/dist/index.mjs.map +1 -1
  18. package/package.json +4 -19
  19. package/dist/__mocks__/hyperliquidMock.cjs +0 -68
  20. package/dist/__mocks__/hyperliquidMock.cjs.map +0 -1
  21. package/dist/__mocks__/hyperliquidMock.d.cts +0 -15
  22. package/dist/__mocks__/hyperliquidMock.d.cts.map +0 -1
  23. package/dist/__mocks__/hyperliquidMock.d.mts +0 -15
  24. package/dist/__mocks__/hyperliquidMock.d.mts.map +0 -1
  25. package/dist/__mocks__/hyperliquidMock.mjs +0 -65
  26. package/dist/__mocks__/hyperliquidMock.mjs.map +0 -1
  27. package/dist/__mocks__/providerMocks.cjs +0 -144
  28. package/dist/__mocks__/providerMocks.cjs.map +0 -1
  29. package/dist/__mocks__/providerMocks.d.cts +0 -44
  30. package/dist/__mocks__/providerMocks.d.cts.map +0 -1
  31. package/dist/__mocks__/providerMocks.d.mts +0 -44
  32. package/dist/__mocks__/providerMocks.d.mts.map +0 -1
  33. package/dist/__mocks__/providerMocks.mjs +0 -136
  34. package/dist/__mocks__/providerMocks.mjs.map +0 -1
  35. package/dist/__mocks__/serviceMocks.cjs +0 -187
  36. package/dist/__mocks__/serviceMocks.cjs.map +0 -1
  37. package/dist/__mocks__/serviceMocks.d.cts +0 -58
  38. package/dist/__mocks__/serviceMocks.d.cts.map +0 -1
  39. package/dist/__mocks__/serviceMocks.d.mts +0 -58
  40. package/dist/__mocks__/serviceMocks.d.mts.map +0 -1
  41. package/dist/__mocks__/serviceMocks.mjs +0 -180
  42. package/dist/__mocks__/serviceMocks.mjs.map +0 -1
  43. package/dist/aggregation/SubscriptionMultiplexer.cjs +0 -459
  44. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +0 -1
  45. package/dist/aggregation/SubscriptionMultiplexer.d.cts +0 -222
  46. package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +0 -1
  47. package/dist/aggregation/SubscriptionMultiplexer.d.mts +0 -222
  48. package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +0 -1
  49. package/dist/aggregation/SubscriptionMultiplexer.mjs +0 -455
  50. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +0 -1
  51. package/dist/aggregation/index.cjs +0 -9
  52. package/dist/aggregation/index.cjs.map +0 -1
  53. package/dist/aggregation/index.d.cts +0 -6
  54. package/dist/aggregation/index.d.cts.map +0 -1
  55. package/dist/aggregation/index.d.mts +0 -6
  56. package/dist/aggregation/index.d.mts.map +0 -1
  57. package/dist/aggregation/index.mjs +0 -5
  58. package/dist/aggregation/index.mjs.map +0 -1
  59. package/dist/constants/eventNames.cjs +0 -117
  60. package/dist/constants/eventNames.cjs.map +0 -1
  61. package/dist/constants/eventNames.d.cts +0 -106
  62. package/dist/constants/eventNames.d.cts.map +0 -1
  63. package/dist/constants/eventNames.d.mts +0 -106
  64. package/dist/constants/eventNames.d.mts.map +0 -1
  65. package/dist/constants/eventNames.mjs +0 -114
  66. package/dist/constants/eventNames.mjs.map +0 -1
  67. package/dist/constants/hyperLiquidConfig.cjs +0 -366
  68. package/dist/constants/hyperLiquidConfig.cjs.map +0 -1
  69. package/dist/constants/hyperLiquidConfig.d.cts +0 -276
  70. package/dist/constants/hyperLiquidConfig.d.cts.map +0 -1
  71. package/dist/constants/hyperLiquidConfig.d.mts +0 -276
  72. package/dist/constants/hyperLiquidConfig.d.mts.map +0 -1
  73. package/dist/constants/hyperLiquidConfig.mjs +0 -357
  74. package/dist/constants/hyperLiquidConfig.mjs.map +0 -1
  75. package/dist/constants/index.cjs +0 -23
  76. package/dist/constants/index.cjs.map +0 -1
  77. package/dist/constants/index.d.cts +0 -7
  78. package/dist/constants/index.d.cts.map +0 -1
  79. package/dist/constants/index.d.mts +0 -7
  80. package/dist/constants/index.d.mts.map +0 -1
  81. package/dist/constants/index.mjs +0 -7
  82. package/dist/constants/index.mjs.map +0 -1
  83. package/dist/constants/orderTypes.cjs +0 -31
  84. package/dist/constants/orderTypes.cjs.map +0 -1
  85. package/dist/constants/orderTypes.d.cts +0 -19
  86. package/dist/constants/orderTypes.d.cts.map +0 -1
  87. package/dist/constants/orderTypes.d.mts +0 -19
  88. package/dist/constants/orderTypes.d.mts.map +0 -1
  89. package/dist/constants/orderTypes.mjs +0 -27
  90. package/dist/constants/orderTypes.mjs.map +0 -1
  91. package/dist/constants/performanceMetrics.cjs +0 -61
  92. package/dist/constants/performanceMetrics.cjs.map +0 -1
  93. package/dist/constants/performanceMetrics.d.cts +0 -44
  94. package/dist/constants/performanceMetrics.d.cts.map +0 -1
  95. package/dist/constants/performanceMetrics.d.mts +0 -44
  96. package/dist/constants/performanceMetrics.d.mts.map +0 -1
  97. package/dist/constants/performanceMetrics.mjs +0 -58
  98. package/dist/constants/performanceMetrics.mjs.map +0 -1
  99. package/dist/constants/perpsConfig.cjs +0 -461
  100. package/dist/constants/perpsConfig.cjs.map +0 -1
  101. package/dist/constants/perpsConfig.d.cts +0 -343
  102. package/dist/constants/perpsConfig.d.cts.map +0 -1
  103. package/dist/constants/perpsConfig.d.mts +0 -343
  104. package/dist/constants/perpsConfig.d.mts.map +0 -1
  105. package/dist/constants/perpsConfig.mjs +0 -458
  106. package/dist/constants/perpsConfig.mjs.map +0 -1
  107. package/dist/constants/perpsErrorCodes.cjs +0 -79
  108. package/dist/constants/perpsErrorCodes.cjs.map +0 -1
  109. package/dist/constants/perpsErrorCodes.d.cts +0 -64
  110. package/dist/constants/perpsErrorCodes.d.cts.map +0 -1
  111. package/dist/constants/perpsErrorCodes.d.mts +0 -64
  112. package/dist/constants/perpsErrorCodes.d.mts.map +0 -1
  113. package/dist/constants/perpsErrorCodes.mjs +0 -76
  114. package/dist/constants/perpsErrorCodes.mjs.map +0 -1
  115. package/dist/platform-services/HyperLiquidClientService.cjs +0 -857
  116. package/dist/platform-services/HyperLiquidClientService.cjs.map +0 -1
  117. package/dist/platform-services/HyperLiquidClientService.d.cts +0 -263
  118. package/dist/platform-services/HyperLiquidClientService.d.cts.map +0 -1
  119. package/dist/platform-services/HyperLiquidClientService.d.mts +0 -263
  120. package/dist/platform-services/HyperLiquidClientService.d.mts.map +0 -1
  121. package/dist/platform-services/HyperLiquidClientService.mjs +0 -853
  122. package/dist/platform-services/HyperLiquidClientService.mjs.map +0 -1
  123. package/dist/platform-services/HyperLiquidSubscriptionService.cjs +0 -2170
  124. package/dist/platform-services/HyperLiquidSubscriptionService.cjs.map +0 -1
  125. package/dist/platform-services/HyperLiquidSubscriptionService.d.cts +0 -424
  126. package/dist/platform-services/HyperLiquidSubscriptionService.d.cts.map +0 -1
  127. package/dist/platform-services/HyperLiquidSubscriptionService.d.mts +0 -424
  128. package/dist/platform-services/HyperLiquidSubscriptionService.d.mts.map +0 -1
  129. package/dist/platform-services/HyperLiquidSubscriptionService.mjs +0 -2166
  130. package/dist/platform-services/HyperLiquidSubscriptionService.mjs.map +0 -1
  131. package/dist/platform-services/HyperLiquidWalletService.cjs +0 -140
  132. package/dist/platform-services/HyperLiquidWalletService.cjs.map +0 -1
  133. package/dist/platform-services/HyperLiquidWalletService.d.cts +0 -78
  134. package/dist/platform-services/HyperLiquidWalletService.d.cts.map +0 -1
  135. package/dist/platform-services/HyperLiquidWalletService.d.mts +0 -78
  136. package/dist/platform-services/HyperLiquidWalletService.d.mts.map +0 -1
  137. package/dist/platform-services/HyperLiquidWalletService.mjs +0 -136
  138. package/dist/platform-services/HyperLiquidWalletService.mjs.map +0 -1
  139. package/dist/providers/AggregatedPerpsProvider.cjs +0 -777
  140. package/dist/providers/AggregatedPerpsProvider.cjs.map +0 -1
  141. package/dist/providers/AggregatedPerpsProvider.d.cts +0 -466
  142. package/dist/providers/AggregatedPerpsProvider.d.cts.map +0 -1
  143. package/dist/providers/AggregatedPerpsProvider.d.mts +0 -466
  144. package/dist/providers/AggregatedPerpsProvider.d.mts.map +0 -1
  145. package/dist/providers/AggregatedPerpsProvider.mjs +0 -773
  146. package/dist/providers/AggregatedPerpsProvider.mjs.map +0 -1
  147. package/dist/providers/HyperLiquidProvider.cjs +0 -5172
  148. package/dist/providers/HyperLiquidProvider.cjs.map +0 -1
  149. package/dist/providers/HyperLiquidProvider.d.cts +0 -881
  150. package/dist/providers/HyperLiquidProvider.d.cts.map +0 -1
  151. package/dist/providers/HyperLiquidProvider.d.mts +0 -881
  152. package/dist/providers/HyperLiquidProvider.d.mts.map +0 -1
  153. package/dist/providers/HyperLiquidProvider.mjs +0 -5168
  154. package/dist/providers/HyperLiquidProvider.mjs.map +0 -1
  155. package/dist/providers/index.cjs +0 -11
  156. package/dist/providers/index.cjs.map +0 -1
  157. package/dist/providers/index.d.cts +0 -6
  158. package/dist/providers/index.d.cts.map +0 -1
  159. package/dist/providers/index.d.mts +0 -6
  160. package/dist/providers/index.d.mts.map +0 -1
  161. package/dist/providers/index.mjs +0 -6
  162. package/dist/providers/index.mjs.map +0 -1
  163. package/dist/routing/ProviderRouter.cjs +0 -148
  164. package/dist/routing/ProviderRouter.cjs.map +0 -1
  165. package/dist/routing/ProviderRouter.d.cts +0 -124
  166. package/dist/routing/ProviderRouter.d.cts.map +0 -1
  167. package/dist/routing/ProviderRouter.d.mts +0 -124
  168. package/dist/routing/ProviderRouter.d.mts.map +0 -1
  169. package/dist/routing/ProviderRouter.mjs +0 -144
  170. package/dist/routing/ProviderRouter.mjs.map +0 -1
  171. package/dist/routing/index.cjs +0 -9
  172. package/dist/routing/index.cjs.map +0 -1
  173. package/dist/routing/index.d.cts +0 -6
  174. package/dist/routing/index.d.cts.map +0 -1
  175. package/dist/routing/index.d.mts +0 -6
  176. package/dist/routing/index.d.mts.map +0 -1
  177. package/dist/routing/index.mjs +0 -5
  178. package/dist/routing/index.mjs.map +0 -1
  179. package/dist/selectors.cjs +0 -161
  180. package/dist/selectors.cjs.map +0 -1
  181. package/dist/selectors.d.cts +0 -345
  182. package/dist/selectors.d.cts.map +0 -1
  183. package/dist/selectors.d.mts +0 -345
  184. package/dist/selectors.d.mts.map +0 -1
  185. package/dist/selectors.mjs +0 -153
  186. package/dist/selectors.mjs.map +0 -1
  187. package/dist/services/AccountService.cjs +0 -313
  188. package/dist/services/AccountService.cjs.map +0 -1
  189. package/dist/services/AccountService.d.cts +0 -53
  190. package/dist/services/AccountService.d.cts.map +0 -1
  191. package/dist/services/AccountService.d.mts +0 -53
  192. package/dist/services/AccountService.d.mts.map +0 -1
  193. package/dist/services/AccountService.mjs +0 -309
  194. package/dist/services/AccountService.mjs.map +0 -1
  195. package/dist/services/DataLakeService.cjs +0 -219
  196. package/dist/services/DataLakeService.cjs.map +0 -1
  197. package/dist/services/DataLakeService.d.cts +0 -49
  198. package/dist/services/DataLakeService.d.cts.map +0 -1
  199. package/dist/services/DataLakeService.d.mts +0 -49
  200. package/dist/services/DataLakeService.d.mts.map +0 -1
  201. package/dist/services/DataLakeService.mjs +0 -215
  202. package/dist/services/DataLakeService.mjs.map +0 -1
  203. package/dist/services/DepositService.cjs +0 -96
  204. package/dist/services/DepositService.cjs.map +0 -1
  205. package/dist/services/DepositService.d.cts +0 -37
  206. package/dist/services/DepositService.d.cts.map +0 -1
  207. package/dist/services/DepositService.d.mts +0 -37
  208. package/dist/services/DepositService.d.mts.map +0 -1
  209. package/dist/services/DepositService.mjs +0 -92
  210. package/dist/services/DepositService.mjs.map +0 -1
  211. package/dist/services/EligibilityService.cjs +0 -156
  212. package/dist/services/EligibilityService.cjs.map +0 -1
  213. package/dist/services/EligibilityService.d.cts +0 -48
  214. package/dist/services/EligibilityService.d.cts.map +0 -1
  215. package/dist/services/EligibilityService.d.mts +0 -48
  216. package/dist/services/EligibilityService.d.mts.map +0 -1
  217. package/dist/services/EligibilityService.mjs +0 -152
  218. package/dist/services/EligibilityService.mjs.map +0 -1
  219. package/dist/services/FeatureFlagConfigurationService.cjs +0 -258
  220. package/dist/services/FeatureFlagConfigurationService.cjs.map +0 -1
  221. package/dist/services/FeatureFlagConfigurationService.d.cts +0 -100
  222. package/dist/services/FeatureFlagConfigurationService.d.cts.map +0 -1
  223. package/dist/services/FeatureFlagConfigurationService.d.mts +0 -100
  224. package/dist/services/FeatureFlagConfigurationService.d.mts.map +0 -1
  225. package/dist/services/FeatureFlagConfigurationService.mjs +0 -254
  226. package/dist/services/FeatureFlagConfigurationService.mjs.map +0 -1
  227. package/dist/services/MarketDataService.cjs +0 -875
  228. package/dist/services/MarketDataService.cjs.map +0 -1
  229. package/dist/services/MarketDataService.d.cts +0 -289
  230. package/dist/services/MarketDataService.d.cts.map +0 -1
  231. package/dist/services/MarketDataService.d.mts +0 -289
  232. package/dist/services/MarketDataService.d.mts.map +0 -1
  233. package/dist/services/MarketDataService.mjs +0 -871
  234. package/dist/services/MarketDataService.mjs.map +0 -1
  235. package/dist/services/RewardsIntegrationService.cjs +0 -94
  236. package/dist/services/RewardsIntegrationService.cjs.map +0 -1
  237. package/dist/services/RewardsIntegrationService.d.cts +0 -30
  238. package/dist/services/RewardsIntegrationService.d.cts.map +0 -1
  239. package/dist/services/RewardsIntegrationService.d.mts +0 -30
  240. package/dist/services/RewardsIntegrationService.d.mts.map +0 -1
  241. package/dist/services/RewardsIntegrationService.mjs +0 -90
  242. package/dist/services/RewardsIntegrationService.mjs.map +0 -1
  243. package/dist/services/ServiceContext.cjs +0 -3
  244. package/dist/services/ServiceContext.cjs.map +0 -1
  245. package/dist/services/ServiceContext.d.cts +0 -110
  246. package/dist/services/ServiceContext.d.cts.map +0 -1
  247. package/dist/services/ServiceContext.d.mts +0 -110
  248. package/dist/services/ServiceContext.d.mts.map +0 -1
  249. package/dist/services/ServiceContext.mjs +0 -2
  250. package/dist/services/ServiceContext.mjs.map +0 -1
  251. package/dist/services/TradingService.cjs +0 -1481
  252. package/dist/services/TradingService.cjs.map +0 -1
  253. package/dist/services/TradingService.d.cts +0 -308
  254. package/dist/services/TradingService.d.cts.map +0 -1
  255. package/dist/services/TradingService.d.mts +0 -308
  256. package/dist/services/TradingService.d.mts.map +0 -1
  257. package/dist/services/TradingService.mjs +0 -1477
  258. package/dist/services/TradingService.mjs.map +0 -1
  259. package/dist/services/index.cjs +0 -26
  260. package/dist/services/index.cjs.map +0 -1
  261. package/dist/services/index.d.cts +0 -11
  262. package/dist/services/index.d.cts.map +0 -1
  263. package/dist/services/index.d.mts +0 -11
  264. package/dist/services/index.d.mts.map +0 -1
  265. package/dist/services/index.mjs +0 -10
  266. package/dist/services/index.mjs.map +0 -1
  267. package/dist/services/utils.cjs +0 -16
  268. package/dist/services/utils.cjs.map +0 -1
  269. package/dist/services/utils.d.cts +0 -8
  270. package/dist/services/utils.d.cts.map +0 -1
  271. package/dist/services/utils.d.mts +0 -8
  272. package/dist/services/utils.d.mts.map +0 -1
  273. package/dist/services/utils.mjs +0 -12
  274. package/dist/services/utils.mjs.map +0 -1
  275. package/dist/types/chart.cjs +0 -42
  276. package/dist/types/chart.cjs.map +0 -1
  277. package/dist/types/chart.d.cts +0 -62
  278. package/dist/types/chart.d.cts.map +0 -1
  279. package/dist/types/chart.d.mts +0 -62
  280. package/dist/types/chart.d.mts.map +0 -1
  281. package/dist/types/chart.mjs +0 -39
  282. package/dist/types/chart.mjs.map +0 -1
  283. package/dist/types/hyperliquid-types.cjs +0 -3
  284. package/dist/types/hyperliquid-types.cjs.map +0 -1
  285. package/dist/types/hyperliquid-types.d.cts +0 -52
  286. package/dist/types/hyperliquid-types.d.cts.map +0 -1
  287. package/dist/types/hyperliquid-types.d.mts +0 -52
  288. package/dist/types/hyperliquid-types.d.mts.map +0 -1
  289. package/dist/types/hyperliquid-types.mjs +0 -2
  290. package/dist/types/hyperliquid-types.mjs.map +0 -1
  291. package/dist/types/index.cjs +0 -96
  292. package/dist/types/index.cjs.map +0 -1
  293. package/dist/types/index.d.cts +0 -1153
  294. package/dist/types/index.d.cts.map +0 -1
  295. package/dist/types/index.d.mts +0 -1153
  296. package/dist/types/index.d.mts.map +0 -1
  297. package/dist/types/index.mjs +0 -79
  298. package/dist/types/index.mjs.map +0 -1
  299. package/dist/types/transactionTypes.cjs +0 -28
  300. package/dist/types/transactionTypes.cjs.map +0 -1
  301. package/dist/types/transactionTypes.d.cts +0 -64
  302. package/dist/types/transactionTypes.d.cts.map +0 -1
  303. package/dist/types/transactionTypes.d.mts +0 -64
  304. package/dist/types/transactionTypes.d.mts.map +0 -1
  305. package/dist/types/transactionTypes.mjs +0 -23
  306. package/dist/types/transactionTypes.mjs.map +0 -1
  307. package/dist/utils/accountUtils.cjs +0 -65
  308. package/dist/utils/accountUtils.cjs.map +0 -1
  309. package/dist/utils/accountUtils.d.cts +0 -26
  310. package/dist/utils/accountUtils.d.cts.map +0 -1
  311. package/dist/utils/accountUtils.d.mts +0 -26
  312. package/dist/utils/accountUtils.d.mts.map +0 -1
  313. package/dist/utils/accountUtils.mjs +0 -61
  314. package/dist/utils/accountUtils.mjs.map +0 -1
  315. package/dist/utils/amountConversion.cjs +0 -61
  316. package/dist/utils/amountConversion.cjs.map +0 -1
  317. package/dist/utils/amountConversion.d.cts +0 -16
  318. package/dist/utils/amountConversion.d.cts.map +0 -1
  319. package/dist/utils/amountConversion.d.mts +0 -16
  320. package/dist/utils/amountConversion.d.mts.map +0 -1
  321. package/dist/utils/amountConversion.mjs +0 -54
  322. package/dist/utils/amountConversion.mjs.map +0 -1
  323. package/dist/utils/chartUtils.cjs +0 -98
  324. package/dist/utils/chartUtils.cjs.map +0 -1
  325. package/dist/utils/chartUtils.d.cts +0 -14
  326. package/dist/utils/chartUtils.d.cts.map +0 -1
  327. package/dist/utils/chartUtils.d.mts +0 -14
  328. package/dist/utils/chartUtils.d.mts.map +0 -1
  329. package/dist/utils/chartUtils.mjs +0 -94
  330. package/dist/utils/chartUtils.mjs.map +0 -1
  331. package/dist/utils/errorUtils.cjs +0 -22
  332. package/dist/utils/errorUtils.cjs.map +0 -1
  333. package/dist/utils/errorUtils.d.cts +0 -13
  334. package/dist/utils/errorUtils.d.cts.map +0 -1
  335. package/dist/utils/errorUtils.d.mts +0 -13
  336. package/dist/utils/errorUtils.d.mts.map +0 -1
  337. package/dist/utils/errorUtils.mjs +0 -18
  338. package/dist/utils/errorUtils.mjs.map +0 -1
  339. package/dist/utils/formatUtils.cjs +0 -987
  340. package/dist/utils/formatUtils.cjs.map +0 -1
  341. package/dist/utils/formatUtils.d.cts +0 -387
  342. package/dist/utils/formatUtils.d.cts.map +0 -1
  343. package/dist/utils/formatUtils.d.mts +0 -387
  344. package/dist/utils/formatUtils.d.mts.map +0 -1
  345. package/dist/utils/formatUtils.mjs +0 -966
  346. package/dist/utils/formatUtils.mjs.map +0 -1
  347. package/dist/utils/hyperLiquidAdapter.cjs +0 -454
  348. package/dist/utils/hyperLiquidAdapter.cjs.map +0 -1
  349. package/dist/utils/hyperLiquidAdapter.d.cts +0 -158
  350. package/dist/utils/hyperLiquidAdapter.d.cts.map +0 -1
  351. package/dist/utils/hyperLiquidAdapter.d.mts +0 -158
  352. package/dist/utils/hyperLiquidAdapter.d.mts.map +0 -1
  353. package/dist/utils/hyperLiquidAdapter.mjs +0 -439
  354. package/dist/utils/hyperLiquidAdapter.mjs.map +0 -1
  355. package/dist/utils/hyperLiquidOrderBookProcessor.cjs +0 -89
  356. package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +0 -1
  357. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +0 -58
  358. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +0 -1
  359. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +0 -58
  360. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +0 -1
  361. package/dist/utils/hyperLiquidOrderBookProcessor.mjs +0 -84
  362. package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +0 -1
  363. package/dist/utils/hyperLiquidValidation.cjs +0 -426
  364. package/dist/utils/hyperLiquidValidation.cjs.map +0 -1
  365. package/dist/utils/hyperLiquidValidation.d.cts +0 -143
  366. package/dist/utils/hyperLiquidValidation.d.cts.map +0 -1
  367. package/dist/utils/hyperLiquidValidation.d.mts +0 -143
  368. package/dist/utils/hyperLiquidValidation.d.mts.map +0 -1
  369. package/dist/utils/hyperLiquidValidation.mjs +0 -413
  370. package/dist/utils/hyperLiquidValidation.mjs.map +0 -1
  371. package/dist/utils/idUtils.cjs +0 -50
  372. package/dist/utils/idUtils.cjs.map +0 -1
  373. package/dist/utils/idUtils.d.cts +0 -38
  374. package/dist/utils/idUtils.d.cts.map +0 -1
  375. package/dist/utils/idUtils.d.mts +0 -38
  376. package/dist/utils/idUtils.d.mts.map +0 -1
  377. package/dist/utils/idUtils.mjs +0 -42
  378. package/dist/utils/idUtils.mjs.map +0 -1
  379. package/dist/utils/marginUtils.cjs +0 -137
  380. package/dist/utils/marginUtils.cjs.map +0 -1
  381. package/dist/utils/marginUtils.d.cts +0 -64
  382. package/dist/utils/marginUtils.d.cts.map +0 -1
  383. package/dist/utils/marginUtils.d.mts +0 -64
  384. package/dist/utils/marginUtils.d.mts.map +0 -1
  385. package/dist/utils/marginUtils.mjs +0 -131
  386. package/dist/utils/marginUtils.mjs.map +0 -1
  387. package/dist/utils/marketDataTransform.cjs +0 -227
  388. package/dist/utils/marketDataTransform.cjs.map +0 -1
  389. package/dist/utils/marketDataTransform.d.cts +0 -45
  390. package/dist/utils/marketDataTransform.d.cts.map +0 -1
  391. package/dist/utils/marketDataTransform.d.mts +0 -45
  392. package/dist/utils/marketDataTransform.d.mts.map +0 -1
  393. package/dist/utils/marketDataTransform.mjs +0 -220
  394. package/dist/utils/marketDataTransform.mjs.map +0 -1
  395. package/dist/utils/marketUtils.cjs +0 -420
  396. package/dist/utils/marketUtils.cjs.map +0 -1
  397. package/dist/utils/marketUtils.d.cts +0 -227
  398. package/dist/utils/marketUtils.d.cts.map +0 -1
  399. package/dist/utils/marketUtils.d.mts +0 -227
  400. package/dist/utils/marketUtils.d.mts.map +0 -1
  401. package/dist/utils/marketUtils.mjs +0 -404
  402. package/dist/utils/marketUtils.mjs.map +0 -1
  403. package/dist/utils/orderBookGrouping.cjs +0 -151
  404. package/dist/utils/orderBookGrouping.cjs.map +0 -1
  405. package/dist/utils/orderBookGrouping.d.cts +0 -76
  406. package/dist/utils/orderBookGrouping.d.cts.map +0 -1
  407. package/dist/utils/orderBookGrouping.d.mts +0 -76
  408. package/dist/utils/orderBookGrouping.d.mts.map +0 -1
  409. package/dist/utils/orderBookGrouping.mjs +0 -143
  410. package/dist/utils/orderBookGrouping.mjs.map +0 -1
  411. package/dist/utils/orderCalculations.cjs +0 -283
  412. package/dist/utils/orderCalculations.cjs.map +0 -1
  413. package/dist/utils/orderCalculations.d.cts +0 -107
  414. package/dist/utils/orderCalculations.d.cts.map +0 -1
  415. package/dist/utils/orderCalculations.d.mts +0 -107
  416. package/dist/utils/orderCalculations.d.mts.map +0 -1
  417. package/dist/utils/orderCalculations.mjs +0 -274
  418. package/dist/utils/orderCalculations.mjs.map +0 -1
  419. package/dist/utils/orderUtils.cjs +0 -159
  420. package/dist/utils/orderUtils.cjs.map +0 -1
  421. package/dist/utils/orderUtils.d.cts +0 -66
  422. package/dist/utils/orderUtils.d.cts.map +0 -1
  423. package/dist/utils/orderUtils.d.mts +0 -66
  424. package/dist/utils/orderUtils.d.mts.map +0 -1
  425. package/dist/utils/orderUtils.mjs +0 -151
  426. package/dist/utils/orderUtils.mjs.map +0 -1
  427. package/dist/utils/pnlCalculations.cjs +0 -107
  428. package/dist/utils/pnlCalculations.cjs.map +0 -1
  429. package/dist/utils/pnlCalculations.d.cts +0 -79
  430. package/dist/utils/pnlCalculations.d.cts.map +0 -1
  431. package/dist/utils/pnlCalculations.d.mts +0 -79
  432. package/dist/utils/pnlCalculations.d.mts.map +0 -1
  433. package/dist/utils/pnlCalculations.mjs +0 -97
  434. package/dist/utils/pnlCalculations.mjs.map +0 -1
  435. package/dist/utils/positionCalculations.cjs +0 -176
  436. package/dist/utils/positionCalculations.cjs.map +0 -1
  437. package/dist/utils/positionCalculations.d.cts +0 -85
  438. package/dist/utils/positionCalculations.d.cts.map +0 -1
  439. package/dist/utils/positionCalculations.d.mts +0 -85
  440. package/dist/utils/positionCalculations.d.mts.map +0 -1
  441. package/dist/utils/positionCalculations.mjs +0 -165
  442. package/dist/utils/positionCalculations.mjs.map +0 -1
  443. package/dist/utils/sortMarkets.cjs +0 -88
  444. package/dist/utils/sortMarkets.cjs.map +0 -1
  445. package/dist/utils/sortMarkets.d.cts +0 -21
  446. package/dist/utils/sortMarkets.d.cts.map +0 -1
  447. package/dist/utils/sortMarkets.d.mts +0 -21
  448. package/dist/utils/sortMarkets.d.mts.map +0 -1
  449. package/dist/utils/sortMarkets.mjs +0 -84
  450. package/dist/utils/sortMarkets.mjs.map +0 -1
  451. package/dist/utils/standaloneInfoClient.cjs +0 -34
  452. package/dist/utils/standaloneInfoClient.cjs.map +0 -1
  453. package/dist/utils/standaloneInfoClient.d.cts +0 -31
  454. package/dist/utils/standaloneInfoClient.d.cts.map +0 -1
  455. package/dist/utils/standaloneInfoClient.d.mts +0 -31
  456. package/dist/utils/standaloneInfoClient.d.mts.map +0 -1
  457. package/dist/utils/standaloneInfoClient.mjs +0 -30
  458. package/dist/utils/standaloneInfoClient.mjs.map +0 -1
  459. package/dist/utils/stringParseUtils.cjs +0 -49
  460. package/dist/utils/stringParseUtils.cjs.map +0 -1
  461. package/dist/utils/stringParseUtils.d.cts +0 -35
  462. package/dist/utils/stringParseUtils.d.cts.map +0 -1
  463. package/dist/utils/stringParseUtils.d.mts +0 -35
  464. package/dist/utils/stringParseUtils.d.mts.map +0 -1
  465. package/dist/utils/stringParseUtils.mjs +0 -44
  466. package/dist/utils/stringParseUtils.mjs.map +0 -1
  467. package/dist/utils/time.cjs +0 -37
  468. package/dist/utils/time.cjs.map +0 -1
  469. package/dist/utils/time.d.cts +0 -17
  470. package/dist/utils/time.d.cts.map +0 -1
  471. package/dist/utils/time.d.mts +0 -17
  472. package/dist/utils/time.d.mts.map +0 -1
  473. package/dist/utils/time.mjs +0 -33
  474. package/dist/utils/time.mjs.map +0 -1
  475. package/dist/utils/tpslValidation.cjs +0 -505
  476. package/dist/utils/tpslValidation.cjs.map +0 -1
  477. package/dist/utils/tpslValidation.d.cts +0 -182
  478. package/dist/utils/tpslValidation.d.cts.map +0 -1
  479. package/dist/utils/tpslValidation.d.mts +0 -182
  480. package/dist/utils/tpslValidation.d.mts.map +0 -1
  481. package/dist/utils/tpslValidation.mjs +0 -482
  482. package/dist/utils/tpslValidation.mjs.map +0 -1
  483. package/dist/utils/transactionUtils.cjs +0 -36
  484. package/dist/utils/transactionUtils.cjs.map +0 -1
  485. package/dist/utils/transactionUtils.d.cts +0 -17
  486. package/dist/utils/transactionUtils.d.cts.map +0 -1
  487. package/dist/utils/transactionUtils.d.mts +0 -17
  488. package/dist/utils/transactionUtils.d.mts.map +0 -1
  489. package/dist/utils/transactionUtils.mjs +0 -32
  490. package/dist/utils/transactionUtils.mjs.map +0 -1
  491. package/dist/utils/wait.cjs +0 -12
  492. package/dist/utils/wait.cjs.map +0 -1
  493. package/dist/utils/wait.d.cts +0 -8
  494. package/dist/utils/wait.d.cts.map +0 -1
  495. package/dist/utils/wait.d.mts +0 -8
  496. package/dist/utils/wait.d.mts.map +0 -1
  497. package/dist/utils/wait.mjs +0 -8
  498. package/dist/utils/wait.mjs.map +0 -1
@@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EAC1C,CAAC;QACD,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,0BAA0B;IAC1B,IACE,IAAI,CAAC,OAAO,EAAE,KAAK,SAAS,CAAC,OAAO,EAAE;QACtC,IAAI,CAAC,QAAQ,EAAE,KAAK,SAAS,CAAC,QAAQ,EAAE;QACxC,IAAI,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,WAAW,EAAE,EAC9C,CAAC;QACD,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,EAAE;QAC9C,KAAK,EAAE,OAAO;KACf,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,wBAAwB,CAAC,OAAO,EAAE;QAC5C,GAAG,EAAE,SAAS;KACf,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAE/B,OAAO,GAAG,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,WAAW;AACvC,CAAC,CAAC","sourcesContent":["/**\n * Shared formatting utilities for Perps components\n */\nimport { BigNumber } from 'bignumber.js';\n\nimport {\n FUNDING_RATE_CONFIG,\n PERPS_CONSTANTS,\n DECIMAL_PRECISION_CONFIG,\n} from '../constants/perpsConfig';\n\n/**\n * Price threshold constants for PRICE_RANGES_UNIVERSAL\n * These define the boundaries between different formatting ranges\n */\nexport const PRICE_THRESHOLD = {\n /** Very high values boundary (> $100k) */\n VERY_HIGH: 100_000,\n /** High values boundary (> $10k) */\n HIGH: 10_000,\n /** Large values boundary (> $1k) */\n LARGE: 1_000,\n /** Medium values boundary (> $100) */\n MEDIUM: 100,\n /** Medium-low values boundary (> $10) */\n MEDIUM_LOW: 10,\n /** Low values boundary (>= $0.01) */\n LOW: 0.01,\n /**\n * Very small values threshold (< $0.01)\n * This is the minimum value for formatWithThreshold and should align with\n * the 6 decimal maximum (0.000001 is the smallest representable value)\n */\n VERY_SMALL: 0.000001,\n} as const;\n\n/**\n * Configuration for a specific number range formatting\n */\nexport type FiatRangeConfig = {\n /**\n * The condition to match for this range (e.g., < 0.0001, < 1, >= 1000)\n * Function should return true if this config should be applied\n */\n condition: (value: number) => boolean;\n /** Minimum decimal places for this range */\n minimumDecimals: number;\n /** Maximum decimal places for this range */\n maximumDecimals: number;\n /** Optional threshold for formatWithThreshold (defaults to the range boundary) */\n threshold?: number;\n /** Optional significant digits for this range (overrides decimal places when set) */\n significantDigits?: number;\n /** Optional custom formatting logic for this range */\n customFormat?: (value: number, locale: string, currency: string) => string;\n /** Optional flag to strip trailing zeros for this range (overrides global stripTrailingZeros option) */\n stripTrailingZeros?: boolean;\n /**\n * Optional flag for fiat-style stripping (only strips .00, preserves meaningful decimals like .10, .40)\n * When true, \"$1,250.00\" becomes \"$1,250\" but \"$1,250.10\" stays \"$1,250.10\"\n * When false (default), strips all trailing zeros: \"$1,250.10\" becomes \"$1,250.1\"\n */\n fiatStyleStripping?: boolean;\n};\n\n/**\n * Creates an Intl.NumberFormat formatter with memoization\n *\n * @param locale - The locale for formatting\n * @param options - NumberFormat options\n * @returns Formatted number formatter\n */\nconst getIntlNumberFormatter = (\n locale: string,\n options: Intl.NumberFormatOptions,\n): Intl.NumberFormat => {\n return new Intl.NumberFormat(locale, options);\n};\n\n/**\n * Creates an Intl.DateTimeFormat formatter\n *\n * @param locale - The locale for formatting\n * @param options - DateTimeFormat options\n * @returns Formatted date/time formatter\n */\nconst getIntlDateTimeFormatter = (\n locale: string,\n options: Intl.DateTimeFormatOptions,\n): Intl.DateTimeFormat => {\n return new Intl.DateTimeFormat(locale, options);\n};\n\n/**\n * Formats a value with threshold handling (shows \"< threshold\" for small values)\n *\n * @param value - The value to format\n * @param threshold - The threshold for showing \"< threshold\"\n * @param locale - The locale for formatting\n * @param options - NumberFormat options\n * @returns Formatted string\n */\nconst formatWithThreshold = (\n value: number,\n threshold: number,\n locale: string,\n options: Intl.NumberFormatOptions,\n): string => {\n if (Math.abs(value) < threshold && value !== 0) {\n const formatter = getIntlNumberFormatter(locale, options);\n const formattedThreshold = formatter.format(threshold);\n return value < 0 ? `> -${formattedThreshold}` : `< ${formattedThreshold}`;\n }\n return getIntlNumberFormatter(locale, options).format(value);\n};\n\n/**\n * Formats a number to a specific number of significant digits\n * Strips trailing zeros unless minDecimals requires them\n *\n * @param value - The numeric value to format\n * @param significantDigits - Number of significant digits to maintain\n * @param minDecimals - Minimum decimal places to show (may add zeros)\n * @param maxDecimals - Maximum decimal places allowed\n * @returns Formatted number with appropriate precision, trailing zeros removed\n */\nexport function formatWithSignificantDigits(\n value: number,\n significantDigits: number,\n minDecimals?: number,\n maxDecimals?: number,\n): { value: number; decimals: number } {\n // Handle special cases\n if (value === 0) {\n // Return zero with no trailing decimals by default (matches stripTrailingZeros behavior)\n // Can be overridden by explicit minDecimals if needed\n return { value: 0, decimals: minDecimals ?? 0 };\n }\n\n const absValue = Math.abs(value);\n\n // For numbers >= 1, calculate decimals based on magnitude to achieve target significant figures\n // This ensures consistent precision across different price ranges:\n // Examples with 4 significant figures:\n // $123,456.78 -> $123,456.78 (>=1000: 2 decimals minimum, 8 sig figs)\n // $456.12 -> $456.12 (>=10: 2 decimals minimum, 5 sig figs)\n // $56.123 -> $56.123 (>=10: 2 decimals minimum, 5 sig figs)\n // $5.123 -> $5.123 ($1-$10: 3 decimals = 4 sig figs)\n // $2.801 -> $2.801 ($1-$10: 3 decimals = 4 sig figs)\n // $1.234 -> $1.234 ($1-$10: 3 decimals = 4 sig figs)\n if (absValue >= 1) {\n let targetDecimals: number;\n\n // Calculate decimals needed based on integer digits to achieve target significant figures\n // For $38.388 with 5 sig figs: 2 integer digits, need 3 decimals (3,8,3,8,8)\n // For $123.45 with 5 sig figs: 3 integer digits, need 2 decimals (1,2,3,4,5)\n const integerDigits = Math.floor(Math.log10(absValue)) + 1;\n const decimalsNeeded = significantDigits - integerDigits;\n targetDecimals = Math.max(decimalsNeeded, 0); // Can't have negative decimals\n\n // Apply explicit minimum decimals constraint if provided (for special cases)\n if (minDecimals !== undefined && targetDecimals < minDecimals) {\n targetDecimals = minDecimals;\n }\n\n // Apply maximum decimals constraint if specified\n const finalDecimals =\n maxDecimals === undefined\n ? targetDecimals\n : Math.min(targetDecimals, maxDecimals);\n\n // Round to prevent floating-point artifacts (e.g., 2.820000000000003 -> 2.82)\n const roundedValue = Number(value.toFixed(finalDecimals));\n\n return {\n value: roundedValue,\n decimals: finalDecimals,\n };\n }\n\n // For numbers < 1, use toPrecision to limit to significantDigits\n // Examples: 0.1234, 0.01234 should show exactly 4 sig figs\n const precisionStr = absValue.toPrecision(significantDigits);\n const precisionNum = parseFloat(precisionStr);\n\n // Convert to string to count actual decimals after trailing zeros are removed\n const valueStr = precisionNum.toString();\n const [, decPart = ''] = valueStr.split('.');\n let actualDecimals = decPart.length;\n\n // Apply min/max decimal constraints\n if (minDecimals !== undefined && actualDecimals < minDecimals) {\n actualDecimals = minDecimals; // Will add zeros if needed\n }\n if (maxDecimals !== undefined && actualDecimals > maxDecimals) {\n actualDecimals = maxDecimals;\n }\n\n // Return the value with sign restored and decimal count\n return {\n value: value < 0 ? -precisionNum : precisionNum,\n decimals: actualDecimals,\n };\n}\n\n/**\n * Counts the number of significant figures in a numeric string\n * This matches HyperLiquid's validation rules:\n * - Trailing decimal zeros are trimmed first (via parseFloat().toString())\n * - Count non-zero integer digits (without leading zeros)\n * - Count ALL decimal digits (including leading zeros after decimal point)\n *\n * @param priceString - The price value as a string (may include $ or ,)\n * @returns The count of significant figures\n *\n * @example\n * countSignificantFigures('123.45') // 5 (3 integer + 2 decimal)\n * countSignificantFigures('123.4500') // 5 (trailing zeros trimmed first)\n * countSignificantFigures('0.000123') // 6 (0 integer + 6 decimal)\n * countSignificantFigures('12.345') // 5 (2 integer + 3 decimal)\n * countSignificantFigures('12000') // 2 (trailing zeros in integer not counted)\n */\nexport const countSignificantFigures = (priceString: string): number => {\n if (!priceString) {\n return 0;\n }\n\n // Clean the string - remove currency symbols and commas\n const cleaned = priceString.replace(/[$,]/gu, '').trim();\n\n // Parse and convert back to string to trim trailing decimal zeros\n // This matches formatHyperLiquidPrice: parseFloat(formattedPrice).toString()\n const parsedValue = parseFloat(cleaned);\n if (isNaN(parsedValue) || parsedValue === 0) {\n return 0;\n }\n\n // Normalize to remove trailing zeros (e.g., \"123.4500\" -> \"123.45\")\n const normalized = parsedValue.toString();\n\n // Split into integer and decimal parts\n const [integerPart, decimalPart = ''] = normalized.split('.');\n\n // Remove leading zeros and negative sign from integer part\n const trimmedInteger = integerPart.replace(/^-?0*/u, '') || '';\n\n // For integers without decimal, trailing zeros are ambiguous\n // We treat them as not significant (matching HyperLiquid behavior)\n const effectiveIntegerLength = decimalPart\n ? trimmedInteger.length\n : trimmedInteger.replace(/0+$/u, '').length ||\n (trimmedInteger.length > 0 ? 1 : 0);\n\n // Count ALL decimal digits (including leading zeros like 0.000123)\n // This matches HyperLiquid's validation behavior\n return effectiveIntegerLength + decimalPart.length;\n};\n\n/**\n * Checks if a price will be rounded due to exceeding significant figures\n * Only applies when the price has decimals - integers are never rounded\n * This matches the behavior in formatHyperLiquidPrice\n *\n * @param priceString - The price value as a string\n * @param maxSigFigs - Maximum allowed significant figures (default: MAX_SIGNIFICANT_FIGURES from config)\n * @returns true if the price will be rounded, false otherwise\n */\nexport const hasExceededSignificantFigures = (\n priceString: string,\n maxSigFigs: number = DECIMAL_PRECISION_CONFIG.MaxSignificantFigures,\n): boolean => {\n if (!priceString || priceString.trim() === '') {\n return false;\n }\n\n // Clean the string and normalize (trim trailing zeros)\n const cleaned = priceString.replace(/[$,]/gu, '').trim();\n const parsedValue = parseFloat(cleaned);\n if (isNaN(parsedValue)) {\n return false;\n }\n\n // Normalize to check for decimal presence after trimming trailing zeros\n const normalized = parsedValue.toString();\n\n // If there's no decimal part after normalization, the price won't be rounded\n if (!normalized.includes('.')) {\n return false;\n }\n\n return countSignificantFigures(priceString) > maxSigFigs;\n};\n\n/**\n * Rounds a price string to the maximum allowed significant figures\n * Uses the same counting logic as countSignificantFigures:\n * - Count non-zero integer digits + ALL decimal digits (including leading zeros)\n *\n * @param priceString - The price value as a string\n * @param maxSigFigs - Maximum allowed significant figures (default: MAX_SIGNIFICANT_FIGURES from config)\n * @returns Price string rounded to max significant figures\n *\n * @example\n * roundToSignificantFigures('123.456') // '123.46' (3 int + 2 dec = 5)\n * roundToSignificantFigures('0.065242') // '0.06524' (0 int + 5 dec = 5)\n * roundToSignificantFigures('12345.67') // '12346' (5 int + 0 dec = 5)\n */\nexport const roundToSignificantFigures = (\n priceString: string,\n maxSigFigs: number = DECIMAL_PRECISION_CONFIG.MaxSignificantFigures,\n): string => {\n if (!priceString || priceString.trim() === '') {\n return priceString;\n }\n\n const cleaned = priceString.replace(/[$,]/gu, '').trim();\n const parsedValue = Number.parseFloat(cleaned);\n if (Number.isNaN(parsedValue) || parsedValue === 0) {\n return priceString;\n }\n\n // Normalize to remove trailing zeros\n const normalized = parsedValue.toString();\n const [integerPart, decimalPart = ''] = normalized.split('.');\n\n // Count integer significant digits (without leading zeros)\n const trimmedInteger = integerPart.replace(/^-?0*/u, '') || '';\n const integerSigFigs = trimmedInteger.length;\n\n // If no decimal, return as is (integers are fine)\n if (!decimalPart) {\n return normalized;\n }\n\n // Calculate how many decimal digits we can keep\n const allowedDecimalDigits = maxSigFigs - integerSigFigs;\n\n if (allowedDecimalDigits <= 0) {\n // Round to integer\n return Math.round(parsedValue).toString();\n }\n\n if (decimalPart.length <= allowedDecimalDigits) {\n // Already within limit\n return normalized;\n }\n\n // Round to the allowed number of decimal places\n const rounded = parsedValue.toFixed(allowedDecimalDigits);\n // Remove trailing zeros\n return Number.parseFloat(rounded).toString();\n};\n\n/**\n * Minimal view fiat range configuration\n * Uses fiat-style stripping for clean currency display\n * Strips only .00 to avoid partial decimals like $1,250.1\n */\nexport const PRICE_RANGES_MINIMAL_VIEW: FiatRangeConfig[] = [\n {\n // Large values (>= $1000): Strip .00 only ($5,000 not $5,000.00, but $5,000.10 stays)\n condition: (val: number) => Math.abs(val) >= PRICE_THRESHOLD.LARGE,\n minimumDecimals: 2,\n maximumDecimals: 2,\n threshold: PRICE_THRESHOLD.LARGE,\n stripTrailingZeros: true,\n fiatStyleStripping: true,\n },\n {\n // Small values (< $1000): Also use fiat-style stripping ($100 not $100.00, but $13.40 stays)\n condition: () => true,\n minimumDecimals: 2,\n maximumDecimals: 2,\n threshold: PRICE_THRESHOLD.LOW,\n stripTrailingZeros: true,\n fiatStyleStripping: true,\n },\n];\n\n/**\n * Formats a balance value as USD currency with appropriate decimal places\n *\n * @param balance - Raw numeric balance value (e.g., 1234.56, not token minimal denomination)\n * @param options - Optional formatting options\n * @param options.minimumDecimals - Global minimum decimal places (overrides range configs)\n * @param options.maximumDecimals - Global maximum decimal places (overrides range configs)\n * @param options.significantDigits - Global significant digits (overrides decimal settings when set)\n * @param options.ranges - Custom range configurations (defaults to PRICE_RANGES_MINIMAL_VIEW)\n * @param options.currency - Currency code (default: 'USD')\n * @param options.locale - Locale for formatting (default: 'en-US')\n * @param options.stripTrailingZeros - Strip trailing zeros from output (default: false via PRICE_RANGES_MINIMAL_VIEW). When true, overrides minimumDecimals constraint.\n * @returns Formatted currency string with variable decimals based on configured ranges\n * @example\n * // Using defaults (preserves trailing zeros for fiat)\n * formatPerpsFiat(1234.56) => \"$1,234.56\"\n * formatPerpsFiat(1250.00) => \"$1,250.00\" // Trailing zeros preserved\n * formatPerpsFiat(50000) => \"$50,000.00\" // Trailing zeros preserved\n *\n * // Stripping trailing zeros when needed (e.g., for crypto)\n * formatPerpsFiat(1250, { stripTrailingZeros: true }) => \"$1,250\"\n *\n * // With custom ranges\n * formatPerpsFiat(0.00001, {\n * ranges: [\n * { condition: (val) => val < 0.001, minimumDecimals: 6, maximumDecimals: 8 },\n * { condition: () => true, minimumDecimals: 2, maximumDecimals: 2 }\n * ]\n * }) => \"$0.00001\" // Trailing zero stripped\n *\n * // With significant digits\n * formatPerpsFiat(1234.56789, { significantDigits: 5 }) => \"$1,234.6\"\n * formatPerpsFiat(0.0001234, { significantDigits: 3 }) => \"$0.000123\"\n */\nexport const formatPerpsFiat = (\n balance: string | number,\n options?: {\n minimumDecimals?: number;\n maximumDecimals?: number;\n significantDigits?: number;\n ranges?: FiatRangeConfig[];\n currency?: string;\n locale?: string;\n stripTrailingZeros?: boolean;\n },\n): string => {\n const parsedValue =\n typeof balance === 'string' ? parseFloat(balance) : balance;\n const currency = options?.currency ?? 'USD';\n const locale = options?.locale ?? 'en-US';\n\n let formatted: string;\n\n if (isNaN(parsedValue)) {\n // Return placeholder for invalid values to avoid confusion with actual $0 values\n return PERPS_CONSTANTS.FallbackPriceDisplay;\n }\n\n // Use custom ranges or defaults\n const ranges = options?.ranges ?? PRICE_RANGES_MINIMAL_VIEW;\n\n // Find the first matching range configuration\n const rangeConfig = ranges.find((range) => range.condition(parsedValue));\n\n if (rangeConfig) {\n // Check for significant digits (global or range-specific)\n const sigDigits =\n options?.significantDigits ?? rangeConfig.significantDigits;\n\n // If significant digits are specified, use them\n if (sigDigits) {\n // Get min/max decimals (global overrides range, range overrides default)\n const minDecimals =\n options?.minimumDecimals ?? rangeConfig.minimumDecimals;\n const maxDecimals =\n options?.maximumDecimals ?? rangeConfig.maximumDecimals;\n\n // Calculate appropriate formatting based on significant digits\n const { value: formattedValue, decimals } = formatWithSignificantDigits(\n parsedValue,\n sigDigits,\n minDecimals,\n maxDecimals,\n );\n\n // Format with the calculated decimal places\n formatted = formatWithThreshold(\n formattedValue,\n rangeConfig.threshold ?? 0.01,\n locale,\n {\n style: 'currency',\n currency,\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n },\n );\n } else {\n // Standard decimal-based formatting (existing logic)\n const minDecimals =\n options?.minimumDecimals ?? rangeConfig.minimumDecimals;\n const maxDecimals =\n options?.maximumDecimals ?? rangeConfig.maximumDecimals;\n\n // Use custom formatting if provided\n if (rangeConfig.customFormat) {\n formatted = rangeConfig.customFormat(parsedValue, locale, currency);\n } else {\n // Use standard formatting with threshold\n formatted = formatWithThreshold(\n parsedValue,\n rangeConfig.threshold ?? 0.01,\n locale,\n {\n style: 'currency',\n currency,\n minimumFractionDigits: minDecimals,\n maximumFractionDigits: maxDecimals,\n },\n );\n }\n }\n } else {\n // Fallback if no range matches (shouldn't happen with proper default config)\n const fallbackMin = options?.minimumDecimals ?? 2;\n const fallbackMax = options?.maximumDecimals ?? 2;\n formatted = formatWithThreshold(parsedValue, 0.01, locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: fallbackMin,\n maximumFractionDigits: fallbackMax,\n });\n }\n\n // Post-process: strip trailing zeros unless explicitly disabled\n // Priority: explicit options.stripTrailingZeros false > rangeConfig > options default > true\n // If options.stripTrailingZeros is explicitly false, skip stripping entirely\n if (options?.stripTrailingZeros === false) {\n return formatted;\n }\n\n // Otherwise check range config or default to true\n const shouldStrip =\n rangeConfig?.stripTrailingZeros ?? options?.stripTrailingZeros ?? true;\n\n if (shouldStrip) {\n // Check if fiat-style stripping is enabled (only strips .00)\n const useFiatStyle = rangeConfig?.fiatStyleStripping ?? false;\n\n if (useFiatStyle) {\n // Fiat-style: Only strip .00 (no meaningful decimals), preserve 2-decimal format\n // Examples: $1,250.00 becomes $1,250 | $1,000.10 stays $1,000.10 | $13.40 stays $13.40\n return formatted.replace(/\\.00$/u, '');\n }\n // Standard: Strip all trailing zeros after decimal point\n // Examples: $1,250.00 becomes $1,250 | $100.0 becomes $100 | $10.5 stays $10.5 | $1.234 stays $1.234\n return formatted.replace(/(\\.\\d*?)0+$/u, '$1').replace(/\\.$/u, '');\n }\n\n return formatted;\n};\n\n/**\n * Formats a fee value as USD currency with appropriate decimal places\n *\n * @param fee - Raw numeric or string fee value (e.g., 1234.56, not token minimal denomination)\n * @returns Formatted currency string with variable decimals based on configured ranges\n * @example formatPositiveFiat(1234.56) => \"$1,234.56\"\n * @example formatPositiveFiat(0.005) => \"< $0.01\"\n * @example formatPositiveFiat(0) => \"$0\"\n */\nexport const formatPositiveFiat = (fee: number | string): string => {\n const smallFeeThreshold = 0.01;\n\n if (BigNumber(fee).isEqualTo(0)) {\n return '$0';\n }\n if (BigNumber(fee).isLessThan(smallFeeThreshold)) {\n return '< $0.01';\n }\n return formatPerpsFiat(fee);\n};\n\n/**\n * Default price range configurations\n * Applied in order - first matching condition wins\n */\nexport const DEFAULT_PRICE_RANGES: FiatRangeConfig[] = [\n {\n // Medium-large numbers (>= 1000)\n condition: (val: number) => Math.abs(val) >= 1000,\n minimumDecimals: 2,\n maximumDecimals: 4,\n threshold: 100,\n },\n {\n // Default range (1 <= val < 1000)\n condition: () => true,\n minimumDecimals: 2,\n maximumDecimals: 4,\n threshold: 0.0001,\n },\n];\n\n/**\n * Universal price range configuration following comprehensive rules from rules-decimals.md\n *\n * Rules:\n * - Max 6 decimals across all ranges (Hyperliquid limit)\n * - Strip trailing zeros by default\n * - Use |v| (absolute value) for conditions\n *\n * Significant digits by range:\n * - > $100,000: 6 sig digs\n * - $100,000 > x > $0.01: 5 sig digs\n * - < $0.01: 4 sig digs\n *\n * Decimal limits by price range:\n * - |v| > 10,000: min 0, max 0 decimals; 5 sig digs (6 if >100k)\n * - |v| > 1,000: min 0, max 1 decimal; 5 sig digs\n * - |v| > 100: min 0, max 2 decimals; 5 sig digs\n * - |v| > 10: min 0, max 4 decimals; 5 sig digs\n * - |v| >= 0.01: 5 sig digs, min 2, max 6 decimals\n * - |v| < 0.01: 4 sig digs, min 2, max 6 decimals\n *\n * Examples:\n * - $123,456.78 becomes $123,457 (>$10k: 0 decimals, 6 sig figs)\n * - $12,345.67 becomes $12,346 (>$10k: 0 decimals, 5 sig figs)\n * - $1,234.56 becomes $1,234.6 ($1k-$10k: 1 decimal, 5 sig figs)\n * - $123.456 becomes $123.46 ($100-$1k: 2 decimals, 5 sig figs)\n * - $12.34567 becomes $12.346 ($10-$100: 4 decimals, 5 sig figs)\n * - $1.3445555 becomes $1.3446 (>=$0.01: 5 sig figs)\n * - $0.333333 becomes $0.33333 (>=$0.01: 5 sig figs)\n * - $0.004236 stays $0.004236 (<$0.01: 4 sig figs, max 6 decimals)\n * - $0.0000006 becomes $0.000001 (<$0.01: 4 sig figs, rounds with max 6 decimals)\n */\nexport const PRICE_RANGES_UNIVERSAL: FiatRangeConfig[] = [\n {\n // Very high values (> $100,000): No decimals, 6 significant figures\n // Ex: $123,456.78 becomes $123,457\n condition: (val) => Math.abs(val) > PRICE_THRESHOLD.VERY_HIGH,\n minimumDecimals: 0,\n maximumDecimals: 0,\n significantDigits: 6,\n threshold: PRICE_THRESHOLD.VERY_HIGH,\n },\n {\n // High values ($10,000-$100,000]: No decimals, 5 significant figures\n // Ex: $12,345.67 becomes $12,346\n condition: (val) => Math.abs(val) > PRICE_THRESHOLD.HIGH,\n minimumDecimals: 0,\n maximumDecimals: 0,\n significantDigits: 5,\n threshold: PRICE_THRESHOLD.HIGH,\n },\n {\n // Large values ($1,000-$10,000]: Max 1 decimal, 5 significant figures\n // Ex: $1,234.56 becomes $1,234.6\n condition: (val) => Math.abs(val) > PRICE_THRESHOLD.LARGE,\n minimumDecimals: 0,\n maximumDecimals: 1,\n significantDigits: 5,\n threshold: PRICE_THRESHOLD.LARGE,\n },\n {\n // Medium values ($100-$1,000]: Max 2 decimals, 5 significant figures\n // Ex: $123.456 becomes $123.46\n condition: (val) => Math.abs(val) > PRICE_THRESHOLD.MEDIUM,\n minimumDecimals: 0,\n maximumDecimals: 2,\n significantDigits: 5,\n threshold: PRICE_THRESHOLD.MEDIUM,\n },\n {\n // Medium-low values ($10-$100]: Max 4 decimals, 5 significant figures\n // Ex: $12.34567 becomes $12.346\n condition: (val) => Math.abs(val) > PRICE_THRESHOLD.MEDIUM_LOW,\n minimumDecimals: 0,\n maximumDecimals: 4,\n significantDigits: 5,\n threshold: PRICE_THRESHOLD.MEDIUM_LOW,\n },\n {\n // Low values ($0.01-$10]: 5 significant figures, min 2 max MAX_PRICE_DECIMALS decimals\n // Ex: $1.3445555 becomes $1.3446 | $0.333333 becomes $0.33333\n condition: (val) => Math.abs(val) >= PRICE_THRESHOLD.LOW,\n significantDigits: 5,\n minimumDecimals: 2,\n maximumDecimals: DECIMAL_PRECISION_CONFIG.MaxPriceDecimals,\n threshold: PRICE_THRESHOLD.LOW,\n },\n {\n // Very small values (< $0.01): 4 significant figures, min 2 max MAX_PRICE_DECIMALS decimals\n // Ex: $0.004236 stays $0.004236 | $0.0000006 becomes $0.000001\n condition: () => true,\n significantDigits: 4,\n minimumDecimals: 2,\n maximumDecimals: DECIMAL_PRECISION_CONFIG.MaxPriceDecimals,\n threshold: PRICE_THRESHOLD.VERY_SMALL,\n },\n];\n\n/**\n * Formats a PnL (Profit and Loss) value with sign prefix\n *\n * @param pnl - Raw numeric PnL value (positive for profit, negative for loss)\n * @returns Format: \"+$X,XXX.XX\" or \"-$X,XXX.XX\" (always shows sign, 2 decimals)\n * @example formatPnl(1234.56) => \"+$1,234.56\"\n * @example formatPnl(-500) => \"-$500.00\"\n * @example formatPnl(0) => \"+$0.00\"\n */\nexport const formatPnl = (pnl: string | number): string => {\n const parsedValue = typeof pnl === 'string' ? parseFloat(pnl) : pnl;\n\n if (isNaN(parsedValue)) {\n return PERPS_CONSTANTS.ZeroAmountDetailedDisplay;\n }\n\n const formatted = getIntlNumberFormatter('en-US', {\n style: 'currency',\n currency: 'USD',\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }).format(Math.abs(parsedValue));\n\n return parsedValue >= 0 ? `+${formatted}` : `-${formatted}`;\n};\n\n/**\n * Formats a percentage value with sign prefix\n *\n * @param value - Raw percentage value (e.g., 5.25 for 5.25%, not 0.0525)\n * @param decimals - Number of decimal places to show (default: 2)\n * @returns Format: \"+X.XX%\" or \"-X.XX%\" (always shows sign, 2 decimals)\n * @example formatPercentage(5.25) => \"+5.25%\"\n * @example formatPercentage(-2.75) => \"-2.75%\"\n * @example formatPercentage(0) => \"+0.00%\"\n */\nexport const formatPercentage = (\n value: string | number,\n decimals: number = 2,\n): string => {\n const parsedValue = typeof value === 'string' ? parseFloat(value) : value;\n\n if (isNaN(parsedValue)) {\n return '0.00%';\n }\n\n return `${parsedValue >= 0 ? '+' : ''}${parsedValue.toFixed(decimals)}%`;\n};\n\n/**\n * Formats funding rate for display\n *\n * @param value - Raw funding rate value (decimal, not percentage)\n * @param options - Optional formatting options\n * @param options.showZero - Whether to return zero display value for zero/undefined (default: true)\n * @returns Formatted funding rate as percentage string\n * @example formatFundingRate(0.0005) => \"0.0500%\"\n * @example formatFundingRate(-0.0001) => \"-0.0100%\"\n * @example formatFundingRate(undefined) => \"0.0000%\"\n */\nexport const formatFundingRate = (\n value?: number | null,\n options?: { showZero?: boolean },\n): string => {\n const showZero = options?.showZero ?? true;\n\n if (value === undefined || value === null) {\n return showZero ? FUNDING_RATE_CONFIG.ZeroDisplay : '';\n }\n\n const percentage = value * FUNDING_RATE_CONFIG.PercentageMultiplier;\n const formatted = percentage.toFixed(FUNDING_RATE_CONFIG.Decimals);\n\n // Check if the result is effectively zero\n if (showZero && parseFloat(formatted) === 0) {\n return FUNDING_RATE_CONFIG.ZeroDisplay;\n }\n\n return `${formatted}%`;\n};\n\n/**\n * Configuration for large number range formatting\n */\nexport type LargeNumberRangeConfig = {\n /** The minimum value threshold for this range (inclusive). Use 0 to catch numbers below the lowest suffix threshold */\n threshold: number;\n /** The suffix to use for this range (e.g., 'T', 'B', 'M', 'K', or '' for no suffix) */\n suffix: string;\n /** Number of decimal places for this range */\n decimals: number;\n};\n\n/**\n * Default large number range configurations\n * Applied in order from largest to smallest\n */\nexport const DEFAULT_LARGE_NUMBER_RANGES: LargeNumberRangeConfig[] = [\n {\n threshold: 1000000000000, // >= 1T\n suffix: 'T',\n decimals: 0,\n },\n {\n threshold: 1000000000, // >= 1B\n suffix: 'B',\n decimals: 0,\n },\n {\n threshold: 1000000, // >= 1M\n suffix: 'M',\n decimals: 0,\n },\n {\n threshold: 1000, // >= 1K\n suffix: 'K',\n decimals: 0,\n },\n {\n threshold: 0, // < 1K (all remaining numbers)\n suffix: '',\n decimals: 2,\n },\n];\n\n/**\n * Preset for detailed large number formatting with more decimal precision\n * Useful for displaying precise statistics or detailed financial data\n */\nexport const LARGE_NUMBER_RANGES_DETAILED: LargeNumberRangeConfig[] = [\n {\n threshold: 1000000000000, // >= 1T\n suffix: 'T',\n decimals: 2,\n },\n {\n threshold: 1000000000, // >= 1B\n suffix: 'B',\n decimals: 2,\n },\n {\n threshold: 1000000, // >= 1M\n suffix: 'M',\n decimals: 2,\n },\n {\n threshold: 1000, // >= 1K\n suffix: 'K',\n decimals: 0,\n },\n {\n threshold: 0, // < 1K (all remaining numbers)\n suffix: '',\n decimals: 0,\n },\n];\n\n/**\n * Formats large numbers with magnitude suffixes (K, M, B, T)\n *\n * @param value - The number to format\n * @param options - Optional formatting options\n * @param options.decimals - Legacy: Number of decimal places for all suffixed values (overrides range configs)\n * @param options.rawDecimals - Legacy: Number of decimal places for numbers below all thresholds (overrides range config for threshold: 0)\n * @param options.ranges - Custom range configurations for fine-grained control over decimals per range\n * @returns Formatted string with appropriate suffix\n * @example\n * // Using defaults\n * formatLargeNumber(1500000) => \"2M\"\n * formatLargeNumber(1234) => \"1K\"\n * formatLargeNumber(999) => \"999.00\"\n *\n * // Legacy: same decimals for all ranges\n * formatLargeNumber(1500000, { decimals: 1 }) => \"1.5M\"\n * formatLargeNumber(1234, { decimals: 2 }) => \"1.23K\"\n *\n * // New: custom decimals per range (including all remaining numbers)\n * formatLargeNumber(1500000, {\n * ranges: [\n * { threshold: 1000000000000, suffix: 'T', decimals: 2 },\n * { threshold: 1000000000, suffix: 'B', decimals: 1 },\n * { threshold: 1000000, suffix: 'M', decimals: 1 },\n * { threshold: 1000, suffix: 'K', decimals: 0 },\n * { threshold: 0, suffix: '', decimals: 4 }, // < 1K (all remaining numbers)\n * ]\n * }) => \"1.5M\"\n */\nexport const formatLargeNumber = (\n value: string | number,\n options?: {\n decimals?: number; // Legacy: applies to all suffixed ranges\n rawDecimals?: number; // Legacy: applies to numbers below all thresholds\n ranges?: LargeNumberRangeConfig[]; // Custom range configurations\n },\n): string => {\n const parsedValue = typeof value === 'string' ? parseFloat(value) : value;\n const ranges = options?.ranges ?? DEFAULT_LARGE_NUMBER_RANGES;\n\n if (isNaN(parsedValue)) {\n return '0';\n }\n\n const absValue = Math.abs(parsedValue);\n const sign = parsedValue < 0 ? '-' : '';\n\n // Check each range in order\n for (const range of ranges) {\n if (absValue >= range.threshold) {\n // Calculate divisor based on threshold (or 1 for no scaling)\n const divisor = range.threshold > 0 ? range.threshold : 1;\n const scaledValue = absValue / divisor;\n\n // Determine decimals to use\n let decimalPlaces = range.decimals;\n\n // Legacy support: override with options.decimals for suffixed values\n if (options?.decimals !== undefined && range.suffix !== '') {\n decimalPlaces = options.decimals;\n }\n\n // Legacy support: override with options.rawDecimals for non-suffixed values\n if (options?.rawDecimals !== undefined && range.suffix === '') {\n decimalPlaces = options.rawDecimals;\n }\n\n return `${sign}${scaledValue.toFixed(decimalPlaces)}${range.suffix}`;\n }\n }\n\n // This should never be reached if ranges includes a threshold: 0 entry\n // But keep as fallback for safety\n return parsedValue.toFixed(options?.rawDecimals ?? 2);\n};\n\n/**\n * Formats volume with appropriate magnitude suffixes\n *\n * @param volume - Raw volume value\n * @param decimals - Number of decimal places to show (optional, auto-determined by default)\n * @returns Format: \"$XB\" / \"$X.XXM\" / \"$XK\" / \"$X.XX\"\n * @example formatVolume(1234567890) => \"$1.23B\"\n * @example formatVolume(12345678) => \"$12.35M\"\n * @example formatVolume(123456) => \"$123K\"\n */\nexport const formatVolume = (\n volume: string | number,\n decimals?: number,\n): string => {\n const parsedValue = typeof volume === 'string' ? parseFloat(volume) : volume;\n\n // Handle invalid inputs - return fallback display for NaN/Infinity\n if (isNaN(parsedValue) || !isFinite(parsedValue)) {\n return '$---';\n }\n\n const absValue = Math.abs(parsedValue);\n\n // Auto-determine decimals based on magnitude if not specified\n let autoDecimals;\n if (decimals === undefined) {\n if (absValue >= 1000000000) {\n // Billions: 2 decimals\n autoDecimals = 2;\n } else if (absValue >= 1000000) {\n // Millions: 2 decimals\n autoDecimals = 2;\n } else if (absValue >= 1000) {\n // Thousands: 0 decimals\n autoDecimals = 0;\n } else {\n // Under 1000: 2 decimals\n autoDecimals = 2;\n }\n } else {\n autoDecimals = decimals;\n }\n\n const formatted = formatLargeNumber(volume, {\n decimals: autoDecimals,\n rawDecimals: autoDecimals,\n });\n\n // Handle negative values - ensure dollar sign comes after negative sign\n if (formatted.startsWith('-')) {\n return `-$${formatted.slice(1)}`;\n }\n\n return `$${formatted}`;\n};\n\n/**\n * Formats position size with variable decimal precision based on magnitude or asset-specific decimals\n * Removes trailing zeros to match task requirements\n *\n * @param size - Raw position size value\n * @param szDecimals - Optional asset-specific decimal precision from Hyperliquid metadata (e.g., BTC=5, ETH=4, DOGE=1)\n * @returns Format varies by size or uses asset-specific decimals, with trailing zeros removed:\n * If szDecimals provided: Uses exact decimals (e.g., 0.00009 BTC with szDecimals=5 => \"0.00009\")\n * Otherwise falls back to magnitude-based logic:\n * - Size < 0.01: Up to 6 decimals (e.g., \"0.00009\" not \"0.000090\")\n * - Size < 1: Up to 4 decimals (e.g., \"0.0024\" not \"0.002400\")\n * - Size >= 1: Up to 2 decimals (e.g., \"44\" not \"44.00\")\n * @example formatPositionSize(0.00009, 5) => \"0.00009\" (uses szDecimals)\n * @example formatPositionSize(44.00, 1) => \"44\" (uses szDecimals, trailing zeros removed)\n * @example formatPositionSize(0.0024) => \"0.0024\" (no szDecimals, uses magnitude logic)\n * @example formatPositionSize(44.00) => \"44\" (no szDecimals, uses magnitude logic)\n */\nexport const formatPositionSize = (\n size: string | number,\n szDecimals?: number,\n): string => {\n const parsedValue = typeof size === 'string' ? parseFloat(size) : size;\n\n if (isNaN(parsedValue) || parsedValue === 0) {\n return '0';\n }\n\n // Use asset-specific decimals if provided (Hyperliquid metadata)\n if (szDecimals !== undefined) {\n return parsedValue.toFixed(szDecimals).replace(/\\.?0+$/u, '');\n }\n\n // Fallback: magnitude-based decimal logic for backwards compatibility\n const absValue = Math.abs(parsedValue);\n let formatted: string;\n\n if (absValue < 0.01) {\n // For very small numbers, use more decimal places\n formatted = parsedValue.toFixed(6);\n } else if (absValue < 1) {\n // For small numbers, use 4 decimal places\n formatted = parsedValue.toFixed(4);\n } else {\n // For normal numbers, use 2 decimal places\n formatted = parsedValue.toFixed(2);\n }\n\n // Remove trailing zeros and unnecessary decimal point\n return formatted.replace(/\\.?0+$/u, '');\n};\n\n/**\n * Formats leverage value with 'x' suffix\n *\n * @param leverage - Raw leverage multiplier value\n * @returns Format: \"X.Xx\" (1 decimal place with 'x' suffix)\n * @example formatLeverage(5) => \"5.0x\"\n * @example formatLeverage(10.5) => \"10.5x\"\n * @example formatLeverage(1) => \"1.0x\"\n */\nexport const formatLeverage = (leverage: string | number): string => {\n const parsedValue =\n typeof leverage === 'string' ? parseFloat(leverage) : leverage;\n\n if (isNaN(parsedValue)) {\n return '1x';\n }\n\n return `${parsedValue.toFixed(1)}x`;\n};\n\n/**\n * Parses formatted currency strings back to numeric values\n *\n * @param formattedValue - Formatted currency string (handles $, commas, negative values)\n * @returns Raw numeric value\n * @example parseCurrencyString(\"$1,234.56\") => 1234.56\n * @example parseCurrencyString(\"-$500.00\") => -500\n * @example parseCurrencyString(\"$-123.45\") => -123.45\n */\nexport const parseCurrencyString = (formattedValue: string): number => {\n if (!formattedValue) {\n return 0;\n }\n\n // Check for negative values (can be -$123.45 or $-123.45)\n const isNegative = formattedValue.includes('-');\n\n // Remove all non-numeric characters except dots\n // This regex removes currency symbols ($, etc.), commas, minus signs, and other formatting\n const cleanedValue = formattedValue\n .replace(/[^0-9.]/gu, '') // Remove everything except digits and dots\n .trim();\n\n // Handle multiple dots by keeping only the last one as decimal separator\n // NOTE: This assumes US format (comma for thousands, dot for decimal)\n // Numbers with dots as thousand separators (e.g., European format) will be parsed incorrectly\n const parts = cleanedValue.split('.');\n const integerPart = parts[0] || '0';\n const decimalPart = parts.length > 1 ? parts[parts.length - 1] : '';\n\n const finalValue = decimalPart\n ? `${integerPart}.${decimalPart}`\n : integerPart;\n const parsedResult = parseFloat(finalValue);\n\n if (isNaN(parsedResult)) {\n return 0;\n }\n\n return isNegative ? -parsedResult : parsedResult;\n};\n\n/**\n * Parses formatted percentage strings back to numeric values\n *\n * @param formattedValue - Formatted percentage string (handles %, +/- signs)\n * @returns Raw numeric percentage value\n * @example parsePercentageString(\"+2.50%\") => 2.5\n * @example parsePercentageString(\"-10.75%\") => -10.75\n * @example parsePercentageString(\"5%\") => 5\n */\nexport const parsePercentageString = (formattedValue: string): number => {\n if (!formattedValue) {\n return 0;\n }\n const cleanedValue = formattedValue\n .replace(/%/gu, '')\n .replace(/\\s/gu, '')\n .trim();\n const parsedResult = parseFloat(cleanedValue);\n return isNaN(parsedResult) ? 0 : parsedResult;\n};\n\n/**\n * Formats a timestamp for transaction detail views with time\n *\n * @param timestamp - Unix timestamp in milliseconds\n * @returns Formatted date string with time (e.g., \"July 24, 2025 at 2:30 PM\")\n * @example formatTransactionDate(1642492800000) => \"January 18, 2022 at 12:00 AM\"\n */\nexport const formatTransactionDate = (timestamp: number): string => {\n const date = new Date(timestamp);\n const dateStr = getIntlDateTimeFormatter('en-US', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n }).format(date);\n const timeStr = getIntlDateTimeFormatter('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n }).format(date);\n return `${dateStr} at ${timeStr}`;\n};\n\n/**\n * Formats a timestamp for order cards with time\n *\n * @param timestamp - Unix timestamp in milliseconds\n * @returns Formatted date string with time (e.g., \"Jan 18 at 2:30 PM\")\n * @example formatOrderCardDate(1642492800000) => \"Jan 18 at 12:00 AM\"\n */\nexport const formatOrderCardDate = (timestamp: number): string => {\n const date = new Date(timestamp);\n const dateStr = getIntlDateTimeFormatter('en-US', {\n month: 'short',\n day: 'numeric',\n }).format(date);\n const timeStr = getIntlDateTimeFormatter('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n }).format(date);\n return `${dateStr} at ${timeStr}`;\n};\n\n/**\n * Formats a timestamp for transaction section headers\n *\n * @param timestamp - Unix timestamp in milliseconds\n * @param labels - Localized labels for \"Today\" and \"Yesterday\"\n * @param labels.today - Label text for today\n * @param labels.yesterday - Label text for yesterday\n * @returns Formatted date section string (\"Today\", \"Yesterday\", or \"Month Day\")\n * @example formatDateSection(Date.now(), { today: 'Today', yesterday: 'Yesterday' }) => \"Today\"\n */\nexport const formatDateSection = (\n timestamp: number,\n labels: { today: string; yesterday: string } = {\n today: 'Today',\n yesterday: 'Yesterday',\n },\n): string => {\n const date = new Date(timestamp);\n const today = new Date();\n const yesterday = new Date(today);\n yesterday.setDate(yesterday.getDate() - 1);\n\n // Check if it's today\n if (\n date.getDate() === today.getDate() &&\n date.getMonth() === today.getMonth() &&\n date.getFullYear() === today.getFullYear()\n ) {\n return labels.today;\n }\n\n // Check if it's yesterday\n if (\n date.getDate() === yesterday.getDate() &&\n date.getMonth() === yesterday.getMonth() &&\n date.getFullYear() === yesterday.getFullYear()\n ) {\n return labels.yesterday;\n }\n\n const month = getIntlDateTimeFormatter('en-US', {\n month: 'short',\n }).format(new Date(timestamp));\n const day = getIntlDateTimeFormatter('en-US', {\n day: 'numeric',\n }).format(new Date(timestamp));\n\n return `${month} ${day}`; // 'Jul 26'\n};\n"]}
@@ -1,454 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.adaptHyperLiquidLedgerUpdateToUserHistoryItem = exports.parseAssetName = exports.calculateHip3AssetId = exports.calculatePositionSize = exports.formatHyperLiquidSize = exports.formatHyperLiquidPrice = exports.buildAssetMapping = exports.adaptAccountStateFromSDK = exports.adaptMarketFromSDK = exports.adaptOrderFromSDK = exports.adaptPositionFromSDK = exports.adaptOrderToSDK = void 0;
4
- const utils_1 = require("@metamask/utils");
5
- const formatUtils_1 = require("./formatUtils.cjs");
6
- const hyperLiquidConfig_1 = require("../constants/hyperLiquidConfig.cjs");
7
- const perpsConfig_1 = require("../constants/perpsConfig.cjs");
8
- /**
9
- * HyperLiquid SDK Adapter Utilities
10
- *
11
- * These functions transform between MetaMask Perps API types and HyperLiquid SDK types.
12
- * The SDK uses cryptic property names for efficiency, but our API uses descriptive names
13
- * to provide a consistent interface across different perps protocols.
14
- */
15
- /**
16
- * Transform MetaMask Perps API OrderParams to HyperLiquid SDK format
17
- *
18
- * @param order - MetaMask Perps order parameters
19
- * @param symbolToAssetId - Mapping from symbols to asset IDs
20
- * @returns HyperLiquid SDK-compatible order parameters
21
- */
22
- function adaptOrderToSDK(order, symbolToAssetId) {
23
- const assetId = symbolToAssetId.get(order.symbol);
24
- if (assetId === undefined) {
25
- // Extract available DEX names from asset map for helpful error message
26
- const availableDexs = new Set();
27
- symbolToAssetId.forEach((_, symbol) => {
28
- if (symbol.includes(':')) {
29
- const dex = symbol.split(':')[0];
30
- availableDexs.add(dex);
31
- }
32
- });
33
- const dexHint = availableDexs.size > 0
34
- ? ` Available HIP-3 DEXs: ${Array.from(availableDexs).join(', ')}`
35
- : ' No HIP-3 DEXs currently available.';
36
- throw new Error(`Asset ${order.symbol} not found in asset mapping.${dexHint} Check console logs for "HyperLiquidProvider: Asset mapping built" to see available assets.`);
37
- }
38
- return {
39
- a: assetId,
40
- b: order.isBuy,
41
- p: order.price ?? '0',
42
- s: order.size,
43
- r: order.reduceOnly ?? false,
44
- t: order.orderType === 'limit'
45
- ? {
46
- limit: { tif: 'Gtc' },
47
- }
48
- : {
49
- limit: { tif: 'FrontendMarket' }, // Market orders use FrontendMarket
50
- },
51
- c: order.clientOrderId && (0, utils_1.isHexString)(order.clientOrderId)
52
- ? order.clientOrderId
53
- : undefined,
54
- };
55
- }
56
- exports.adaptOrderToSDK = adaptOrderToSDK;
57
- /**
58
- * Transform SDK AssetPosition to MetaMask Perps API format
59
- *
60
- * @param assetPosition - AssetPosition data from HyperLiquid SDK
61
- * @returns MetaMask Perps API position object
62
- */
63
- function adaptPositionFromSDK(assetPosition) {
64
- const pos = assetPosition.position;
65
- return {
66
- symbol: pos.coin, // HyperLiquid API uses 'coin', we normalize to 'symbol'
67
- size: pos.szi,
68
- entryPrice: pos.entryPx,
69
- positionValue: pos.positionValue,
70
- unrealizedPnl: pos.unrealizedPnl,
71
- marginUsed: pos.marginUsed,
72
- leverage: {
73
- type: pos.leverage.type,
74
- value: pos.leverage.value,
75
- rawUsd: pos.leverage.type === 'isolated' ? pos.leverage.rawUsd : undefined,
76
- },
77
- liquidationPrice: pos.liquidationPx,
78
- maxLeverage: pos.maxLeverage,
79
- returnOnEquity: pos.returnOnEquity,
80
- cumulativeFunding: pos.cumFunding,
81
- takeProfitCount: 0, // Default value, will be updated by provider logic
82
- stopLossCount: 0, // Default value, will be updated by provider logic
83
- };
84
- }
85
- exports.adaptPositionFromSDK = adaptPositionFromSDK;
86
- /**
87
- * Transform HyperLiquid SDK order to MetaMask Perps API format
88
- * Handles both REST API responses (FrontendOrder) and WebSocket data formats
89
- *
90
- * @param rawOrder - Raw order data from HyperLiquid SDK (frontendOpenOrders or webData2)
91
- * @param position - Optional position for size calculation on position TP/SL orders
92
- * @returns MetaMask Perps API order object
93
- */
94
- function adaptOrderFromSDK(rawOrder, position) {
95
- // Extract basic fields with appropriate conversions
96
- const orderId = rawOrder.oid.toString();
97
- const symbol = rawOrder.coin;
98
- // Convert side: HyperLiquid uses 'B' for Buy and 'A' for Ask (Sell)
99
- const side = rawOrder.side === 'B' ? 'buy' : 'sell';
100
- // Get detailed order type from API
101
- const detailedOrderType = rawOrder.orderType;
102
- // Determine if this is a trigger order (TP/SL)
103
- const { isTrigger } = rawOrder;
104
- const { reduceOnly } = rawOrder;
105
- // Determine basic order type
106
- let orderType = 'market';
107
- if (detailedOrderType.toLowerCase().includes('limit') || rawOrder.limitPx) {
108
- orderType = 'limit';
109
- }
110
- // For trigger orders (TP/SL), use triggerPx as the price
111
- const price = rawOrder.limitPx ?? rawOrder.triggerPx ?? '0';
112
- // Sizes
113
- let size = rawOrder.sz;
114
- let originalSize = rawOrder.origSz ?? size;
115
- // Calculate filled and remaining size
116
- let currentSize = parseFloat(size);
117
- let origSize = parseFloat(originalSize);
118
- if (rawOrder.isPositionTpsl && origSize === 0 && position) {
119
- const absPositionSize = Math.abs(parseFloat(position.size));
120
- currentSize = absPositionSize;
121
- origSize = absPositionSize;
122
- size = absPositionSize.toString();
123
- originalSize = absPositionSize.toString();
124
- }
125
- const filledSize = origSize - currentSize;
126
- // Check for TP/SL in child orders (REST API feature)
127
- let takeProfitPrice;
128
- let stopLossPrice;
129
- let takeProfitOrderId;
130
- let stopLossOrderId;
131
- // TODO: We assume that there can only be 1 TP and 1 SL as children but there can be several TPSLs as children
132
- // We need to handle this properly in the future
133
- if (rawOrder.children && rawOrder.children.length > 0) {
134
- rawOrder.children.forEach((childUnknown) => {
135
- const child = childUnknown;
136
- if (child.isTrigger && child.orderType) {
137
- if (child.orderType.includes('Take Profit')) {
138
- takeProfitPrice = child.triggerPx ?? child.limitPx;
139
- takeProfitOrderId = child.oid.toString();
140
- }
141
- else if (child.orderType.includes('Stop')) {
142
- stopLossPrice = child.triggerPx ?? child.limitPx;
143
- stopLossOrderId = child.oid.toString();
144
- }
145
- }
146
- });
147
- }
148
- // Build the order object
149
- const order = {
150
- orderId,
151
- symbol,
152
- side,
153
- orderType,
154
- size,
155
- originalSize,
156
- price,
157
- filledSize: filledSize.toString(),
158
- remainingSize: size,
159
- status: 'open', // All orders from frontendOpenOrders/webData2 are open
160
- timestamp: rawOrder.timestamp,
161
- detailedOrderType,
162
- isTrigger,
163
- reduceOnly,
164
- };
165
- // Add optional fields if they exist
166
- if (takeProfitPrice) {
167
- order.takeProfitPrice = takeProfitPrice;
168
- order.takeProfitOrderId = takeProfitOrderId;
169
- }
170
- if (stopLossPrice) {
171
- order.stopLossPrice = stopLossPrice;
172
- order.stopLossOrderId = stopLossOrderId;
173
- }
174
- // Store trigger condition price for trigger orders (used for TP/SL display)
175
- if (rawOrder.triggerPx) {
176
- order.triggerPrice = rawOrder.triggerPx;
177
- }
178
- return order;
179
- }
180
- exports.adaptOrderFromSDK = adaptOrderFromSDK;
181
- /**
182
- * Transform SDK market info to MetaMask Perps API format
183
- *
184
- * @param sdkMarket - Market metadata from HyperLiquid SDK
185
- * @returns MetaMask Perps API market info object
186
- */
187
- function adaptMarketFromSDK(sdkMarket) {
188
- return {
189
- name: sdkMarket.name,
190
- szDecimals: sdkMarket.szDecimals,
191
- maxLeverage: sdkMarket.maxLeverage,
192
- marginTableId: sdkMarket.marginTableId,
193
- onlyIsolated: sdkMarket.onlyIsolated,
194
- isDelisted: sdkMarket.isDelisted,
195
- };
196
- }
197
- exports.adaptMarketFromSDK = adaptMarketFromSDK;
198
- /**
199
- * Transform SDK clearinghouse state to MetaMask Perps API AccountState
200
- *
201
- * @param perpsState - ClearinghouseState from HyperLiquid SDK
202
- * @param spotState - SpotClearinghouseState from HyperLiquid SDK (optional)
203
- * @returns MetaMask Perps API account state object
204
- */
205
- function adaptAccountStateFromSDK(perpsState, spotState) {
206
- // Calculate total unrealized PnL from all positions
207
- const { totalUnrealizedPnl, weightedReturnOnEquity } = perpsState.assetPositions.reduce((acc, assetPos) => {
208
- const unrealizedPnl = parseFloat(assetPos.position.unrealizedPnl || '0');
209
- const marginUsed = parseFloat(assetPos.position.marginUsed || '0');
210
- const returnOnEquity = parseFloat(assetPos.position.returnOnEquity || '0');
211
- acc.totalUnrealizedPnl += unrealizedPnl;
212
- acc.weightedReturnOnEquity += returnOnEquity * marginUsed;
213
- return acc;
214
- }, {
215
- totalUnrealizedPnl: 0,
216
- weightedReturnOnEquity: 0,
217
- });
218
- const totalMarginUsed = parseFloat(perpsState.marginSummary.totalMarginUsed || '0');
219
- const totalReturnOnEquityPercentage = totalMarginUsed > 0
220
- ? ((weightedReturnOnEquity / totalMarginUsed) * 100).toFixed(1)
221
- : '0.0';
222
- // marginSummary.accountValue includes both cross and isolated margin positions
223
- const perpsBalance = parseFloat(perpsState.marginSummary.accountValue);
224
- // Get Spot balance (if available)
225
- let spotBalance = 0;
226
- if (spotState?.balances && Array.isArray(spotState.balances)) {
227
- spotBalance = spotState.balances.reduce((sum, balance) => sum + parseFloat(balance.total ?? '0'), 0);
228
- }
229
- // Calculate total account value (Spot + Perps)
230
- const totalBalance = (spotBalance + perpsBalance).toString();
231
- const accountState = {
232
- availableBalance: perpsState.withdrawable || '0',
233
- totalBalance: totalBalance || '0',
234
- marginUsed: perpsState.marginSummary.totalMarginUsed || '0',
235
- unrealizedPnl: totalUnrealizedPnl.toString() || '0',
236
- returnOnEquity: totalReturnOnEquityPercentage || '0',
237
- };
238
- return accountState;
239
- }
240
- exports.adaptAccountStateFromSDK = adaptAccountStateFromSDK;
241
- /**
242
- * Build asset symbol to ID mapping from HyperLiquid meta response
243
- * The API returns asset names already properly formatted (prefixed for HIP-3, unprefixed for main DEX)
244
- *
245
- * @param params - Configuration for asset mapping
246
- * @param params.metaUniverse - Array of asset metadata from HyperLiquid
247
- * @param params.dex - DEX name (kept for backward compatibility, but not used in mapping)
248
- * @param params.perpDexIndex - DEX index from perpDexs() array (required for HIP-3)
249
- * @returns Maps for bidirectional symbol/ID lookup
250
- *
251
- * @example Main DEX
252
- * buildAssetMapping({ metaUniverse: [{ name: "BTC" }, { name: "ETH" }], perpDexIndex: 0 })
253
- * // Returns: Map<"BTC", 0>, Map<"ETH", 1>
254
- *
255
- * @example HIP-3 DEX
256
- * buildAssetMapping({ metaUniverse: [{ name: "xyz:XYZ100" }, { name: "xyz:XYZ200" }], dex: "xyz", perpDexIndex: 1 })
257
- * // Returns: Map<"xyz:XYZ100", 110000>, Map<"xyz:XYZ200", 110001>
258
- * // Note: Uses global HIP-3 asset IDs via calculateHip3AssetId()
259
- */
260
- function buildAssetMapping(params) {
261
- const { metaUniverse, perpDexIndex } = params;
262
- const symbolToAssetId = new Map();
263
- const assetIdToSymbol = new Map();
264
- metaUniverse.forEach((asset, index) => {
265
- // Calculate global asset ID using HIP-3 formula
266
- // Main DEX (perpDexIndex=0): returns index directly (0, 1, 2, ...)
267
- // HIP-3 DEX (perpDexIndex>0): returns 100000 + perpDexIndex*10000 + index
268
- const assetId = calculateHip3AssetId(perpDexIndex, index);
269
- // HyperLiquid API returns asset names already correctly formatted:
270
- // - Main DEX: asset.name = "BTC", "ETH", etc. (no prefix)
271
- // - HIP-3 DEX: asset.name = "xyz:XYZ100", "xyz:XYZ200", etc. (already prefixed!)
272
- // We use asset.name as-is - no manual prefixing needed
273
- symbolToAssetId.set(asset.name, assetId);
274
- assetIdToSymbol.set(assetId, asset.name);
275
- });
276
- return { symbolToAssetId, assetIdToSymbol };
277
- }
278
- exports.buildAssetMapping = buildAssetMapping;
279
- /**
280
- * Format price according to HyperLiquid validation rules.
281
- * - Max 5 significant figures (uses MAX_SIGNIFICANT_FIGURES from config)
282
- * - Max (MAX_PRICE_DECIMALS - szDecimals) decimal places for perps
283
- * - Integer prices always allowed
284
- *
285
- * @param params - Price formatting parameters
286
- * @param params.price - The price value to format
287
- * @param params.szDecimals - The size decimals for the asset
288
- * @returns Properly formatted price string
289
- */
290
- function formatHyperLiquidPrice(params) {
291
- const { price, szDecimals } = params;
292
- const priceNum = typeof price === 'string' ? parseFloat(price) : price;
293
- // Integer prices are always allowed
294
- if (Number.isInteger(priceNum)) {
295
- return priceNum.toString();
296
- }
297
- // Calculate max decimal places allowed
298
- const maxDecimalPlaces = perpsConfig_1.DECIMAL_PRECISION_CONFIG.MaxPriceDecimals - szDecimals;
299
- // Format with proper decimal places
300
- let formattedPrice = priceNum.toFixed(maxDecimalPlaces);
301
- // Remove trailing zeros
302
- formattedPrice = parseFloat(formattedPrice).toString();
303
- // Check and enforce max significant figures using shared utility
304
- const significantDigits = (0, formatUtils_1.countSignificantFigures)(formattedPrice);
305
- if (significantDigits > perpsConfig_1.DECIMAL_PRECISION_CONFIG.MaxSignificantFigures) {
306
- // Use shared utility to round to max significant figures
307
- formattedPrice = (0, formatUtils_1.roundToSignificantFigures)(formattedPrice);
308
- }
309
- return formattedPrice;
310
- }
311
- exports.formatHyperLiquidPrice = formatHyperLiquidPrice;
312
- /**
313
- * Format order size with asset-specific decimal precision.
314
- *
315
- * @param params - Size formatting parameters
316
- * @param params.size - The size value to format
317
- * @param params.szDecimals - The size decimals for the asset
318
- * @returns Properly formatted size string with trailing zeros removed
319
- */
320
- function formatHyperLiquidSize(params) {
321
- const { size, szDecimals } = params;
322
- const sizeNum = typeof size === 'string' ? parseFloat(size) : size;
323
- if (isNaN(sizeNum)) {
324
- return '0';
325
- }
326
- // Use asset-specific decimal precision and remove trailing zeros
327
- const formatted = sizeNum.toFixed(szDecimals);
328
- // Only strip trailing zeros after decimal point, not from integers
329
- // e.g., "10.000" -> "10", "10.5000" -> "10.5", but "10" stays "10"
330
- if (!formatted.includes('.')) {
331
- return formatted; // Integer, keep as-is
332
- }
333
- // Has decimal, strip trailing zeros and decimal if needed
334
- return formatted.replace(/\.?0+$/u, '');
335
- }
336
- exports.formatHyperLiquidSize = formatHyperLiquidSize;
337
- /**
338
- * Calculate position size for a given USD value and leverage.
339
- *
340
- * @param params - Position size calculation parameters
341
- * @param params.usdValue - The USD value to invest
342
- * @param params.leverage - The leverage multiplier
343
- * @param params.assetPrice - The current asset price
344
- * @returns Raw position size (before formatting)
345
- */
346
- function calculatePositionSize(params) {
347
- const { usdValue, leverage, assetPrice } = params;
348
- return (usdValue * leverage) / assetPrice;
349
- }
350
- exports.calculatePositionSize = calculatePositionSize;
351
- /**
352
- * Calculate HIP-3 asset ID from perpDexIndex and market index
353
- * Formula: BASE_ASSET_ID + (perpDexIndex * DEX_MULTIPLIER) + index_in_meta
354
- *
355
- * @param perpDexIndex - DEX index from perpDexs() array (0=main, 1=xyz, 2=abc, etc.)
356
- * @param indexInMeta - Market index within the DEX's meta universe
357
- * @returns Global asset ID for HIP-3 order routing
358
- *
359
- * @example Main DEX
360
- * calculateHip3AssetId(0, 5) // Returns: 5 (main DEX uses index directly)
361
- *
362
- * @example xyz DEX
363
- * calculateHip3AssetId(1, 0) // Returns: 110000 (xyz:XYZ100)
364
- */
365
- function calculateHip3AssetId(perpDexIndex, indexInMeta) {
366
- if (perpDexIndex === 0) {
367
- return indexInMeta;
368
- }
369
- return (hyperLiquidConfig_1.HIP3_ASSET_ID_CONFIG.BaseAssetId +
370
- perpDexIndex * hyperLiquidConfig_1.HIP3_ASSET_ID_CONFIG.DexMultiplier +
371
- indexInMeta);
372
- }
373
- exports.calculateHip3AssetId = calculateHip3AssetId;
374
- /**
375
- * Parse asset name to extract DEX and symbol
376
- * HIP-3 assets are prefixed with "dex:" (e.g., "xyz:XYZ100")
377
- * Main DEX assets have no prefix (e.g., "BTC")
378
- *
379
- * @param assetName - Asset name from HyperLiquid API
380
- * @returns Object with dex (null for main DEX) and symbol
381
- *
382
- * @example Main DEX
383
- * parseAssetName("BTC") // Returns: { dex: null, symbol: "BTC" }
384
- *
385
- * @example HIP-3 DEX
386
- * parseAssetName("xyz:XYZ100") // Returns: { dex: "xyz", symbol: "XYZ100" }
387
- */
388
- function parseAssetName(assetName) {
389
- const colonIndex = assetName.indexOf(':');
390
- if (colonIndex === -1) {
391
- return { dex: null, symbol: assetName };
392
- }
393
- return {
394
- dex: assetName.substring(0, colonIndex),
395
- symbol: assetName.substring(colonIndex + 1),
396
- };
397
- }
398
- exports.parseAssetName = parseAssetName;
399
- /**
400
- * Transform raw HyperLiquid ledger updates to UserHistoryItem format
401
- * Filters for deposits, withdrawals, and internal transfers only, extracting amount and asset information
402
- *
403
- * @param rawLedgerUpdates - Array of raw ledger updates from HyperLiquid SDK
404
- * @returns Array of UserHistoryItem objects
405
- */
406
- function adaptHyperLiquidLedgerUpdateToUserHistoryItem(rawLedgerUpdates) {
407
- return (rawLedgerUpdates || [])
408
- .filter((update) => {
409
- if (update.delta.type === 'deposit') {
410
- return true;
411
- }
412
- if (update.delta.type === 'withdraw') {
413
- return true;
414
- }
415
- if (update.delta.type === 'internalTransfer') {
416
- const usdc = Number.parseFloat(update.delta.usdc ?? '0');
417
- if (Number.isNaN(usdc)) {
418
- return false;
419
- }
420
- return usdc > 0;
421
- }
422
- return false;
423
- })
424
- .map((update) => {
425
- // Extract amount and asset based on delta type
426
- let amount = '0';
427
- let asset = 'USDC';
428
- if ('usdc' in update.delta && update.delta.usdc) {
429
- amount = Math.abs(parseFloat(update.delta.usdc)).toString();
430
- }
431
- if ('coin' in update.delta && typeof update.delta.coin === 'string') {
432
- asset = update.delta.coin;
433
- }
434
- return {
435
- id: `history-${update.hash}`,
436
- timestamp: update.time,
437
- amount,
438
- asset,
439
- txHash: update.hash,
440
- status: 'completed',
441
- type: update.delta.type === 'withdraw' ? 'withdrawal' : 'deposit',
442
- details: {
443
- source: '',
444
- bridgeContract: undefined,
445
- recipient: undefined,
446
- blockNumber: undefined,
447
- chainId: undefined,
448
- synthetic: undefined,
449
- },
450
- };
451
- });
452
- }
453
- exports.adaptHyperLiquidLedgerUpdateToUserHistoryItem = adaptHyperLiquidLedgerUpdateToUserHistoryItem;
454
- //# sourceMappingURL=hyperLiquidAdapter.cjs.map