@metamask-previews/perps-controller 13.1.0-preview-8c2a2eeb2 → 13.1.0-preview-4f4c98e

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 (716) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/{PerpsController-method-action-types.d.mts → PerpsController-method-action-types.d.ts} +2 -2
  3. package/dist/PerpsController-method-action-types.d.ts.map +1 -0
  4. package/dist/{PerpsController-method-action-types.mjs → PerpsController-method-action-types.js} +1 -1
  5. package/dist/PerpsController-method-action-types.js.map +1 -0
  6. package/dist/{PerpsController.d.mts → PerpsController.d.ts} +17 -17
  7. package/dist/PerpsController.d.ts.map +1 -0
  8. package/dist/{PerpsController.mjs → PerpsController.js} +33 -31
  9. package/dist/PerpsController.js.map +1 -0
  10. package/dist/aggregation/{SubscriptionMultiplexer.d.cts → SubscriptionMultiplexer.d.ts} +2 -2
  11. package/dist/aggregation/SubscriptionMultiplexer.d.ts.map +1 -0
  12. package/dist/aggregation/{SubscriptionMultiplexer.mjs → SubscriptionMultiplexer.js} +3 -3
  13. package/dist/aggregation/SubscriptionMultiplexer.js.map +1 -0
  14. package/dist/aggregation/index.d.ts +6 -0
  15. package/dist/aggregation/index.d.ts.map +1 -0
  16. package/dist/aggregation/index.js +5 -0
  17. package/dist/aggregation/index.js.map +1 -0
  18. package/dist/constants/{chartConfig.d.mts → chartConfig.d.ts} +34 -34
  19. package/dist/constants/chartConfig.d.ts.map +1 -0
  20. package/dist/constants/{chartConfig.mjs → chartConfig.js} +1 -1
  21. package/dist/constants/chartConfig.js.map +1 -0
  22. package/dist/constants/eventNames.d.ts +555 -0
  23. package/dist/constants/eventNames.d.ts.map +1 -0
  24. package/dist/constants/{eventNames.mjs → eventNames.js} +1 -1
  25. package/dist/constants/eventNames.js.map +1 -0
  26. package/dist/constants/{hyperLiquidConfig.d.cts → hyperLiquidConfig.d.ts} +12 -12
  27. package/dist/constants/hyperLiquidConfig.d.ts.map +1 -0
  28. package/dist/constants/{hyperLiquidConfig.mjs → hyperLiquidConfig.js} +4 -4
  29. package/dist/constants/hyperLiquidConfig.js.map +1 -0
  30. package/dist/constants/index.d.ts +12 -0
  31. package/dist/constants/index.d.ts.map +1 -0
  32. package/dist/constants/index.js +12 -0
  33. package/dist/constants/index.js.map +1 -0
  34. package/dist/constants/{myxConfig.d.mts → myxConfig.d.ts} +9 -8
  35. package/dist/constants/myxConfig.d.ts.map +1 -0
  36. package/dist/constants/{myxConfig.mjs → myxConfig.js} +2 -2
  37. package/dist/constants/myxConfig.js.map +1 -0
  38. package/dist/constants/{orderTypes.d.cts → orderTypes.d.ts} +7 -7
  39. package/dist/constants/orderTypes.d.ts.map +1 -0
  40. package/dist/constants/{orderTypes.mjs → orderTypes.js} +1 -1
  41. package/dist/constants/orderTypes.js.map +1 -0
  42. package/dist/constants/{performanceMetrics.d.cts → performanceMetrics.d.ts} +1 -1
  43. package/dist/constants/performanceMetrics.d.ts.map +1 -0
  44. package/dist/constants/{performanceMetrics.mjs → performanceMetrics.js} +1 -1
  45. package/dist/constants/performanceMetrics.js.map +1 -0
  46. package/dist/constants/{perpsConfig.d.mts → perpsConfig.d.ts} +56 -56
  47. package/dist/constants/perpsConfig.d.ts.map +1 -0
  48. package/dist/constants/{perpsConfig.mjs → perpsConfig.js} +1 -1
  49. package/dist/constants/perpsConfig.js.map +1 -0
  50. package/dist/constants/{transactionsHistoryConfig.d.cts → transactionsHistoryConfig.d.ts} +1 -1
  51. package/dist/constants/transactionsHistoryConfig.d.ts.map +1 -0
  52. package/dist/constants/{transactionsHistoryConfig.mjs → transactionsHistoryConfig.js} +1 -1
  53. package/dist/constants/transactionsHistoryConfig.js.map +1 -0
  54. package/dist/{index.d.mts → index.d.ts} +64 -64
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/{index.mjs → index.js} +41 -41
  57. package/dist/index.js.map +1 -0
  58. package/dist/perpsErrorCodes.d.ts +104 -0
  59. package/dist/perpsErrorCodes.d.ts.map +1 -0
  60. package/dist/{perpsErrorCodes.mjs → perpsErrorCodes.js} +1 -1
  61. package/dist/perpsErrorCodes.js.map +1 -0
  62. package/dist/providers/{AggregatedPerpsProvider.d.cts → AggregatedPerpsProvider.d.ts} +5 -5
  63. package/dist/providers/AggregatedPerpsProvider.d.ts.map +1 -0
  64. package/dist/providers/{AggregatedPerpsProvider.mjs → AggregatedPerpsProvider.js} +5 -5
  65. package/dist/providers/AggregatedPerpsProvider.js.map +1 -0
  66. package/dist/providers/{HyperLiquidProvider.d.mts → HyperLiquidProvider.d.ts} +7 -7
  67. package/dist/providers/HyperLiquidProvider.d.ts.map +1 -0
  68. package/dist/providers/{HyperLiquidProvider.mjs → HyperLiquidProvider.js} +48 -50
  69. package/dist/providers/HyperLiquidProvider.js.map +1 -0
  70. package/dist/routing/{ProviderRouter.d.mts → ProviderRouter.d.ts} +2 -2
  71. package/dist/routing/ProviderRouter.d.ts.map +1 -0
  72. package/dist/routing/{ProviderRouter.mjs → ProviderRouter.js} +1 -1
  73. package/dist/routing/ProviderRouter.js.map +1 -0
  74. package/dist/routing/index.d.ts +6 -0
  75. package/dist/routing/index.d.ts.map +1 -0
  76. package/dist/routing/index.js +5 -0
  77. package/dist/routing/index.js.map +1 -0
  78. package/dist/{selectors.d.mts → selectors.d.ts} +97 -97
  79. package/dist/selectors.d.ts.map +1 -0
  80. package/dist/{selectors.mjs → selectors.js} +4 -4
  81. package/dist/selectors.js.map +1 -0
  82. package/dist/services/{AccountService.d.cts → AccountService.d.ts} +4 -4
  83. package/dist/services/AccountService.d.ts.map +1 -0
  84. package/dist/services/{AccountService.mjs → AccountService.js} +9 -9
  85. package/dist/services/AccountService.js.map +1 -0
  86. package/dist/services/{AggregatedOrderBookConnection.d.cts → AggregatedOrderBookConnection.d.ts} +2 -2
  87. package/dist/services/AggregatedOrderBookConnection.d.ts.map +1 -0
  88. package/dist/services/{AggregatedOrderBookConnection.mjs → AggregatedOrderBookConnection.js} +3 -3
  89. package/dist/services/AggregatedOrderBookConnection.js.map +1 -0
  90. package/dist/services/{DataLakeService.d.cts → DataLakeService.d.ts} +4 -4
  91. package/dist/services/DataLakeService.d.ts.map +1 -0
  92. package/dist/services/{DataLakeService.mjs → DataLakeService.js} +7 -7
  93. package/dist/services/DataLakeService.js.map +1 -0
  94. package/dist/services/{DepositService.d.cts → DepositService.d.ts} +4 -4
  95. package/dist/services/DepositService.d.ts.map +1 -0
  96. package/dist/services/{DepositService.mjs → DepositService.js} +7 -7
  97. package/dist/services/DepositService.js.map +1 -0
  98. package/dist/services/{DexDiscoveryCacheManager.d.cts → DexDiscoveryCacheManager.d.ts} +2 -2
  99. package/dist/services/DexDiscoveryCacheManager.d.ts.map +1 -0
  100. package/dist/services/{DexDiscoveryCacheManager.mjs → DexDiscoveryCacheManager.js} +2 -2
  101. package/dist/services/DexDiscoveryCacheManager.js.map +1 -0
  102. package/dist/services/{EligibilityService.d.cts → EligibilityService.d.ts} +2 -2
  103. package/dist/services/EligibilityService.d.ts.map +1 -0
  104. package/dist/services/{EligibilityService.mjs → EligibilityService.js} +3 -3
  105. package/dist/services/EligibilityService.js.map +1 -0
  106. package/dist/services/{FeatureFlagConfigurationService.d.cts → FeatureFlagConfigurationService.d.ts} +3 -3
  107. package/dist/services/FeatureFlagConfigurationService.d.ts.map +1 -0
  108. package/dist/services/{FeatureFlagConfigurationService.mjs → FeatureFlagConfigurationService.js} +7 -7
  109. package/dist/services/FeatureFlagConfigurationService.js.map +1 -0
  110. package/dist/services/{HyperLiquidClientService.d.cts → HyperLiquidClientService.d.ts} +10 -10
  111. package/dist/services/HyperLiquidClientService.d.ts.map +1 -0
  112. package/dist/services/{HyperLiquidClientService.mjs → HyperLiquidClientService.js} +11 -11
  113. package/dist/services/HyperLiquidClientService.js.map +1 -0
  114. package/dist/services/{HyperLiquidSubscriptionService.d.cts → HyperLiquidSubscriptionService.d.ts} +6 -6
  115. package/dist/services/HyperLiquidSubscriptionService.d.ts.map +1 -0
  116. package/dist/services/{HyperLiquidSubscriptionService.mjs → HyperLiquidSubscriptionService.js} +12 -12
  117. package/dist/services/HyperLiquidSubscriptionService.js.map +1 -0
  118. package/dist/services/{HyperLiquidWalletService.d.cts → HyperLiquidWalletService.d.ts} +4 -4
  119. package/dist/services/HyperLiquidWalletService.d.ts.map +1 -0
  120. package/dist/services/{HyperLiquidWalletService.mjs → HyperLiquidWalletService.js} +5 -5
  121. package/dist/services/HyperLiquidWalletService.js.map +1 -0
  122. package/dist/services/{MarketDataService.d.cts → MarketDataService.d.ts} +5 -5
  123. package/dist/services/MarketDataService.d.ts.map +1 -0
  124. package/dist/services/{MarketDataService.mjs → MarketDataService.js} +9 -9
  125. package/dist/services/MarketDataService.js.map +1 -0
  126. package/dist/services/{RewardsIntegrationService.d.cts → RewardsIntegrationService.d.ts} +3 -3
  127. package/dist/services/RewardsIntegrationService.d.ts.map +1 -0
  128. package/dist/services/{RewardsIntegrationService.mjs → RewardsIntegrationService.js} +6 -6
  129. package/dist/services/RewardsIntegrationService.js.map +1 -0
  130. package/dist/services/{ServiceContext.d.cts → ServiceContext.d.ts} +3 -3
  131. package/dist/services/ServiceContext.d.ts.map +1 -0
  132. package/dist/services/ServiceContext.js +2 -0
  133. package/dist/services/ServiceContext.js.map +1 -0
  134. package/dist/services/{TerminalMarketService.d.cts → TerminalMarketService.d.ts} +2 -2
  135. package/dist/services/TerminalMarketService.d.ts.map +1 -0
  136. package/dist/services/{TerminalMarketService.mjs → TerminalMarketService.js} +9 -9
  137. package/dist/services/TerminalMarketService.js.map +1 -0
  138. package/dist/services/{TradingReadinessCache.d.mts → TradingReadinessCache.d.ts} +1 -1
  139. package/dist/services/TradingReadinessCache.d.ts.map +1 -0
  140. package/dist/services/{TradingReadinessCache.mjs → TradingReadinessCache.js} +1 -1
  141. package/dist/services/TradingReadinessCache.js.map +1 -0
  142. package/dist/services/{TradingService.d.cts → TradingService.d.ts} +4 -4
  143. package/dist/services/TradingService.d.ts.map +1 -0
  144. package/dist/services/{TradingService.mjs → TradingService.js} +10 -10
  145. package/dist/services/TradingService.js.map +1 -0
  146. package/dist/types/{config.d.cts → config.d.ts} +2 -2
  147. package/dist/types/config.d.ts.map +1 -0
  148. package/dist/types/config.js +2 -0
  149. package/dist/types/config.js.map +1 -0
  150. package/dist/types/{hyperliquid-types.d.cts → hyperliquid-types.d.ts} +6 -6
  151. package/dist/types/hyperliquid-types.d.ts.map +1 -0
  152. package/dist/types/{hyperliquid-types.mjs → hyperliquid-types.js} +1 -1
  153. package/dist/types/hyperliquid-types.js.map +1 -0
  154. package/dist/types/{index.d.cts → index.d.ts} +41 -41
  155. package/dist/types/index.d.ts.map +1 -0
  156. package/dist/types/{index.mjs → index.js} +3 -3
  157. package/dist/types/index.js.map +1 -0
  158. package/dist/types/{messenger.d.mts → messenger.d.ts} +11 -11
  159. package/dist/types/messenger.d.ts.map +1 -0
  160. package/dist/types/messenger.js +2 -0
  161. package/dist/types/messenger.js.map +1 -0
  162. package/dist/types/{myx-types.d.mts → myx-types.d.ts} +16 -16
  163. package/dist/types/myx-types.d.ts.map +1 -0
  164. package/dist/types/{myx-types.mjs → myx-types.js} +3 -3
  165. package/dist/types/myx-types.js.map +1 -0
  166. package/dist/types/{perps-types.d.cts → perps-types.d.ts} +4 -4
  167. package/dist/types/perps-types.d.ts.map +1 -0
  168. package/dist/types/perps-types.js +2 -0
  169. package/dist/types/perps-types.js.map +1 -0
  170. package/dist/types/{token.d.cts → token.d.ts} +2 -2
  171. package/dist/types/token.d.ts.map +1 -0
  172. package/dist/types/token.js +2 -0
  173. package/dist/types/token.js.map +1 -0
  174. package/dist/types/{transactionTypes.d.cts → transactionTypes.d.ts} +1 -1
  175. package/dist/types/transactionTypes.d.ts.map +1 -0
  176. package/dist/types/{transactionTypes.mjs → transactionTypes.js} +2 -2
  177. package/dist/types/transactionTypes.js.map +1 -0
  178. package/dist/utils/{accountUtils.d.cts → accountUtils.d.ts} +4 -4
  179. package/dist/utils/accountUtils.d.ts.map +1 -0
  180. package/dist/utils/{accountUtils.mjs → accountUtils.js} +2 -2
  181. package/dist/utils/accountUtils.js.map +1 -0
  182. package/dist/utils/{capabilitySymbols.d.mts → capabilitySymbols.d.ts} +1 -1
  183. package/dist/utils/capabilitySymbols.d.ts.map +1 -0
  184. package/dist/utils/{capabilitySymbols.mjs → capabilitySymbols.js} +1 -1
  185. package/dist/utils/capabilitySymbols.js.map +1 -0
  186. package/dist/utils/{coalescePerpsRestRequest.d.cts → coalescePerpsRestRequest.d.ts} +1 -1
  187. package/dist/utils/coalescePerpsRestRequest.d.ts.map +1 -0
  188. package/dist/utils/{coalescePerpsRestRequest.mjs → coalescePerpsRestRequest.js} +2 -2
  189. package/dist/utils/coalescePerpsRestRequest.js.map +1 -0
  190. package/dist/utils/{errorUtils.d.mts → errorUtils.d.ts} +1 -1
  191. package/dist/utils/errorUtils.d.ts.map +1 -0
  192. package/dist/utils/{errorUtils.mjs → errorUtils.js} +3 -3
  193. package/dist/utils/errorUtils.js.map +1 -0
  194. package/dist/utils/{hyperLiquidAbstraction.d.cts → hyperLiquidAbstraction.d.ts} +2 -2
  195. package/dist/utils/hyperLiquidAbstraction.d.ts.map +1 -0
  196. package/dist/utils/{hyperLiquidAbstraction.mjs → hyperLiquidAbstraction.js} +1 -1
  197. package/dist/utils/hyperLiquidAbstraction.js.map +1 -0
  198. package/dist/utils/{hyperLiquidAdapter.d.cts → hyperLiquidAdapter.d.ts} +4 -4
  199. package/dist/utils/hyperLiquidAdapter.d.ts.map +1 -0
  200. package/dist/utils/{hyperLiquidAdapter.mjs → hyperLiquidAdapter.js} +9 -9
  201. package/dist/utils/hyperLiquidAdapter.js.map +1 -0
  202. package/dist/utils/{hyperLiquidOrderBookProcessor.d.mts → hyperLiquidOrderBookProcessor.d.ts} +3 -3
  203. package/dist/utils/hyperLiquidOrderBookProcessor.d.ts.map +1 -0
  204. package/dist/utils/{hyperLiquidOrderBookProcessor.mjs → hyperLiquidOrderBookProcessor.js} +1 -1
  205. package/dist/utils/hyperLiquidOrderBookProcessor.js.map +1 -0
  206. package/dist/utils/{hyperLiquidValidation.d.cts → hyperLiquidValidation.d.ts} +4 -4
  207. package/dist/utils/hyperLiquidValidation.d.ts.map +1 -0
  208. package/dist/utils/{hyperLiquidValidation.mjs → hyperLiquidValidation.js} +6 -6
  209. package/dist/utils/hyperLiquidValidation.js.map +1 -0
  210. package/dist/utils/{idUtils.d.cts → idUtils.d.ts} +1 -1
  211. package/dist/utils/idUtils.d.ts.map +1 -0
  212. package/dist/utils/{idUtils.mjs → idUtils.js} +2 -2
  213. package/dist/utils/idUtils.js.map +1 -0
  214. package/dist/utils/index.d.ts +28 -0
  215. package/dist/utils/index.d.ts.map +1 -0
  216. package/dist/utils/{index.mjs → index.js} +21 -21
  217. package/dist/utils/index.js.map +1 -0
  218. package/dist/utils/{marketDataTransform.d.cts → marketDataTransform.d.ts} +3 -3
  219. package/dist/utils/marketDataTransform.d.ts.map +1 -0
  220. package/dist/utils/{marketDataTransform.mjs → marketDataTransform.js} +5 -5
  221. package/dist/utils/marketDataTransform.js.map +1 -0
  222. package/dist/utils/{marketSearch.d.cts → marketSearch.d.ts} +2 -2
  223. package/dist/utils/marketSearch.d.ts.map +1 -0
  224. package/dist/utils/{marketSearch.mjs → marketSearch.js} +1 -1
  225. package/dist/utils/marketSearch.js.map +1 -0
  226. package/dist/utils/{marketUtils.d.cts → marketUtils.d.ts} +3 -3
  227. package/dist/utils/marketUtils.d.ts.map +1 -0
  228. package/dist/utils/{marketUtils.mjs → marketUtils.js} +2 -2
  229. package/dist/utils/marketUtils.js.map +1 -0
  230. package/dist/utils/{myxAdapter.d.cts → myxAdapter.d.ts} +3 -3
  231. package/dist/utils/myxAdapter.d.ts.map +1 -0
  232. package/dist/utils/{myxAdapter.mjs → myxAdapter.js} +3 -3
  233. package/dist/utils/myxAdapter.js.map +1 -0
  234. package/dist/utils/{orderCalculations.d.cts → orderCalculations.d.ts} +4 -4
  235. package/dist/utils/orderCalculations.d.ts.map +1 -0
  236. package/dist/utils/{orderCalculations.mjs → orderCalculations.js} +6 -6
  237. package/dist/utils/orderCalculations.js.map +1 -0
  238. package/dist/utils/{orderTypes.d.mts → orderTypes.d.ts} +3 -3
  239. package/dist/utils/orderTypes.d.ts.map +1 -0
  240. package/dist/utils/{orderTypes.mjs → orderTypes.js} +1 -1
  241. package/dist/utils/orderTypes.js.map +1 -0
  242. package/dist/utils/{perpsConnectionAttemptContext.d.mts → perpsConnectionAttemptContext.d.ts} +1 -1
  243. package/dist/utils/perpsConnectionAttemptContext.d.ts.map +1 -0
  244. package/dist/utils/{perpsConnectionAttemptContext.mjs → perpsConnectionAttemptContext.js} +1 -1
  245. package/dist/utils/perpsConnectionAttemptContext.js.map +1 -0
  246. package/dist/utils/{perpsDiskPersistence.d.cts → perpsDiskPersistence.d.ts} +2 -2
  247. package/dist/utils/perpsDiskPersistence.d.ts.map +1 -0
  248. package/dist/utils/{perpsDiskPersistence.mjs → perpsDiskPersistence.js} +2 -2
  249. package/dist/utils/perpsDiskPersistence.js.map +1 -0
  250. package/dist/utils/{perpsFormatters.d.cts → perpsFormatters.d.ts} +1 -1
  251. package/dist/utils/perpsFormatters.d.ts.map +1 -0
  252. package/dist/utils/{perpsFormatters.mjs → perpsFormatters.js} +2 -2
  253. package/dist/utils/perpsFormatters.js.map +1 -0
  254. package/dist/utils/{rewardsUtils.d.cts → rewardsUtils.d.ts} +4 -4
  255. package/dist/utils/rewardsUtils.d.ts.map +1 -0
  256. package/dist/utils/{rewardsUtils.mjs → rewardsUtils.js} +4 -4
  257. package/dist/utils/rewardsUtils.js.map +1 -0
  258. package/dist/utils/{significantFigures.d.cts → significantFigures.d.ts} +1 -1
  259. package/dist/utils/significantFigures.d.ts.map +1 -0
  260. package/dist/utils/{significantFigures.mjs → significantFigures.js} +2 -2
  261. package/dist/utils/significantFigures.js.map +1 -0
  262. package/dist/utils/{sortMarkets.d.cts → sortMarkets.d.ts} +2 -2
  263. package/dist/utils/sortMarkets.d.ts.map +1 -0
  264. package/dist/utils/{sortMarkets.mjs → sortMarkets.js} +2 -2
  265. package/dist/utils/sortMarkets.js.map +1 -0
  266. package/dist/utils/{standaloneInfoClient.d.cts → standaloneInfoClient.d.ts} +3 -3
  267. package/dist/utils/standaloneInfoClient.d.ts.map +1 -0
  268. package/dist/utils/{standaloneInfoClient.mjs → standaloneInfoClient.js} +3 -3
  269. package/dist/utils/standaloneInfoClient.js.map +1 -0
  270. package/dist/utils/{stringParseUtils.d.cts → stringParseUtils.d.ts} +1 -1
  271. package/dist/utils/stringParseUtils.d.ts.map +1 -0
  272. package/dist/utils/{stringParseUtils.mjs → stringParseUtils.js} +1 -1
  273. package/dist/utils/stringParseUtils.js.map +1 -0
  274. package/dist/utils/{transferData.d.cts → transferData.d.ts} +1 -1
  275. package/dist/utils/transferData.d.ts.map +1 -0
  276. package/dist/utils/{transferData.mjs → transferData.js} +3 -3
  277. package/dist/utils/transferData.js.map +1 -0
  278. package/dist/utils/{wait.d.cts → wait.d.ts} +1 -1
  279. package/dist/utils/wait.d.ts.map +1 -0
  280. package/dist/utils/{wait.mjs → wait.js} +1 -1
  281. package/dist/utils/wait.js.map +1 -0
  282. package/package.json +20 -48
  283. package/dist/PerpsController-method-action-types.cjs +0 -7
  284. package/dist/PerpsController-method-action-types.cjs.map +0 -1
  285. package/dist/PerpsController-method-action-types.d.cts +0 -1163
  286. package/dist/PerpsController-method-action-types.d.cts.map +0 -1
  287. package/dist/PerpsController-method-action-types.d.mts.map +0 -1
  288. package/dist/PerpsController-method-action-types.mjs.map +0 -1
  289. package/dist/PerpsController.cjs +0 -5063
  290. package/dist/PerpsController.cjs.map +0 -1
  291. package/dist/PerpsController.d.cts +0 -1274
  292. package/dist/PerpsController.d.cts.map +0 -1
  293. package/dist/PerpsController.d.mts.map +0 -1
  294. package/dist/PerpsController.mjs.map +0 -1
  295. package/dist/aggregation/SubscriptionMultiplexer.cjs +0 -441
  296. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +0 -1
  297. package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +0 -1
  298. package/dist/aggregation/SubscriptionMultiplexer.d.mts +0 -171
  299. package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +0 -1
  300. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +0 -1
  301. package/dist/aggregation/index.cjs +0 -9
  302. package/dist/aggregation/index.cjs.map +0 -1
  303. package/dist/aggregation/index.d.cts +0 -6
  304. package/dist/aggregation/index.d.cts.map +0 -1
  305. package/dist/aggregation/index.d.mts +0 -6
  306. package/dist/aggregation/index.d.mts.map +0 -1
  307. package/dist/aggregation/index.mjs +0 -5
  308. package/dist/aggregation/index.mjs.map +0 -1
  309. package/dist/constants/chartConfig.cjs +0 -239
  310. package/dist/constants/chartConfig.cjs.map +0 -1
  311. package/dist/constants/chartConfig.d.cts +0 -228
  312. package/dist/constants/chartConfig.d.cts.map +0 -1
  313. package/dist/constants/chartConfig.d.mts.map +0 -1
  314. package/dist/constants/chartConfig.mjs.map +0 -1
  315. package/dist/constants/eventNames.cjs +0 -650
  316. package/dist/constants/eventNames.cjs.map +0 -1
  317. package/dist/constants/eventNames.d.cts +0 -555
  318. package/dist/constants/eventNames.d.cts.map +0 -1
  319. package/dist/constants/eventNames.d.mts +0 -555
  320. package/dist/constants/eventNames.d.mts.map +0 -1
  321. package/dist/constants/eventNames.mjs.map +0 -1
  322. package/dist/constants/hyperLiquidConfig.cjs +0 -607
  323. package/dist/constants/hyperLiquidConfig.cjs.map +0 -1
  324. package/dist/constants/hyperLiquidConfig.d.cts.map +0 -1
  325. package/dist/constants/hyperLiquidConfig.d.mts +0 -280
  326. package/dist/constants/hyperLiquidConfig.d.mts.map +0 -1
  327. package/dist/constants/hyperLiquidConfig.mjs.map +0 -1
  328. package/dist/constants/index.cjs +0 -28
  329. package/dist/constants/index.cjs.map +0 -1
  330. package/dist/constants/index.d.cts +0 -12
  331. package/dist/constants/index.d.cts.map +0 -1
  332. package/dist/constants/index.d.mts +0 -12
  333. package/dist/constants/index.d.mts.map +0 -1
  334. package/dist/constants/index.mjs +0 -12
  335. package/dist/constants/index.mjs.map +0 -1
  336. package/dist/constants/myxConfig.cjs +0 -253
  337. package/dist/constants/myxConfig.cjs.map +0 -1
  338. package/dist/constants/myxConfig.d.cts +0 -145
  339. package/dist/constants/myxConfig.d.cts.map +0 -1
  340. package/dist/constants/myxConfig.d.mts.map +0 -1
  341. package/dist/constants/myxConfig.mjs.map +0 -1
  342. package/dist/constants/orderTypes.cjs +0 -31
  343. package/dist/constants/orderTypes.cjs.map +0 -1
  344. package/dist/constants/orderTypes.d.cts.map +0 -1
  345. package/dist/constants/orderTypes.d.mts +0 -19
  346. package/dist/constants/orderTypes.d.mts.map +0 -1
  347. package/dist/constants/orderTypes.mjs.map +0 -1
  348. package/dist/constants/performanceMetrics.cjs +0 -63
  349. package/dist/constants/performanceMetrics.cjs.map +0 -1
  350. package/dist/constants/performanceMetrics.d.cts.map +0 -1
  351. package/dist/constants/performanceMetrics.d.mts +0 -46
  352. package/dist/constants/performanceMetrics.d.mts.map +0 -1
  353. package/dist/constants/performanceMetrics.mjs.map +0 -1
  354. package/dist/constants/perpsConfig.cjs +0 -553
  355. package/dist/constants/perpsConfig.cjs.map +0 -1
  356. package/dist/constants/perpsConfig.d.cts +0 -474
  357. package/dist/constants/perpsConfig.d.cts.map +0 -1
  358. package/dist/constants/perpsConfig.d.mts.map +0 -1
  359. package/dist/constants/perpsConfig.mjs.map +0 -1
  360. package/dist/constants/transactionsHistoryConfig.cjs +0 -38
  361. package/dist/constants/transactionsHistoryConfig.cjs.map +0 -1
  362. package/dist/constants/transactionsHistoryConfig.d.cts.map +0 -1
  363. package/dist/constants/transactionsHistoryConfig.d.mts +0 -35
  364. package/dist/constants/transactionsHistoryConfig.d.mts.map +0 -1
  365. package/dist/constants/transactionsHistoryConfig.mjs.map +0 -1
  366. package/dist/index.cjs +0 -344
  367. package/dist/index.cjs.map +0 -1
  368. package/dist/index.d.cts +0 -92
  369. package/dist/index.d.cts.map +0 -1
  370. package/dist/index.d.mts.map +0 -1
  371. package/dist/index.mjs.map +0 -1
  372. package/dist/perpsErrorCodes.cjs +0 -127
  373. package/dist/perpsErrorCodes.cjs.map +0 -1
  374. package/dist/perpsErrorCodes.d.cts +0 -104
  375. package/dist/perpsErrorCodes.d.cts.map +0 -1
  376. package/dist/perpsErrorCodes.d.mts +0 -104
  377. package/dist/perpsErrorCodes.d.mts.map +0 -1
  378. package/dist/perpsErrorCodes.mjs.map +0 -1
  379. package/dist/providers/AggregatedPerpsProvider.cjs +0 -689
  380. package/dist/providers/AggregatedPerpsProvider.cjs.map +0 -1
  381. package/dist/providers/AggregatedPerpsProvider.d.cts.map +0 -1
  382. package/dist/providers/AggregatedPerpsProvider.d.mts +0 -232
  383. package/dist/providers/AggregatedPerpsProvider.d.mts.map +0 -1
  384. package/dist/providers/AggregatedPerpsProvider.mjs.map +0 -1
  385. package/dist/providers/HyperLiquidProvider.cjs +0 -10416
  386. package/dist/providers/HyperLiquidProvider.cjs.map +0 -1
  387. package/dist/providers/HyperLiquidProvider.d.cts +0 -625
  388. package/dist/providers/HyperLiquidProvider.d.cts.map +0 -1
  389. package/dist/providers/HyperLiquidProvider.d.mts.map +0 -1
  390. package/dist/providers/HyperLiquidProvider.mjs.map +0 -1
  391. package/dist/routing/ProviderRouter.cjs +0 -154
  392. package/dist/routing/ProviderRouter.cjs.map +0 -1
  393. package/dist/routing/ProviderRouter.d.cts +0 -112
  394. package/dist/routing/ProviderRouter.d.cts.map +0 -1
  395. package/dist/routing/ProviderRouter.d.mts.map +0 -1
  396. package/dist/routing/ProviderRouter.mjs.map +0 -1
  397. package/dist/routing/index.cjs +0 -9
  398. package/dist/routing/index.cjs.map +0 -1
  399. package/dist/routing/index.d.cts +0 -6
  400. package/dist/routing/index.d.cts.map +0 -1
  401. package/dist/routing/index.d.mts +0 -6
  402. package/dist/routing/index.d.mts.map +0 -1
  403. package/dist/routing/index.mjs +0 -5
  404. package/dist/routing/index.mjs.map +0 -1
  405. package/dist/selectors.cjs +0 -264
  406. package/dist/selectors.cjs.map +0 -1
  407. package/dist/selectors.d.cts +0 -336
  408. package/dist/selectors.d.cts.map +0 -1
  409. package/dist/selectors.d.mts.map +0 -1
  410. package/dist/selectors.mjs.map +0 -1
  411. package/dist/services/AccountService.cjs +0 -324
  412. package/dist/services/AccountService.cjs.map +0 -1
  413. package/dist/services/AccountService.d.cts.map +0 -1
  414. package/dist/services/AccountService.d.mts +0 -56
  415. package/dist/services/AccountService.d.mts.map +0 -1
  416. package/dist/services/AccountService.mjs.map +0 -1
  417. package/dist/services/AggregatedOrderBookConnection.cjs +0 -405
  418. package/dist/services/AggregatedOrderBookConnection.cjs.map +0 -1
  419. package/dist/services/AggregatedOrderBookConnection.d.cts.map +0 -1
  420. package/dist/services/AggregatedOrderBookConnection.d.mts +0 -106
  421. package/dist/services/AggregatedOrderBookConnection.d.mts.map +0 -1
  422. package/dist/services/AggregatedOrderBookConnection.mjs.map +0 -1
  423. package/dist/services/DataLakeService.cjs +0 -233
  424. package/dist/services/DataLakeService.cjs.map +0 -1
  425. package/dist/services/DataLakeService.d.cts.map +0 -1
  426. package/dist/services/DataLakeService.d.mts +0 -51
  427. package/dist/services/DataLakeService.d.mts.map +0 -1
  428. package/dist/services/DataLakeService.mjs.map +0 -1
  429. package/dist/services/DepositService.cjs +0 -99
  430. package/dist/services/DepositService.cjs.map +0 -1
  431. package/dist/services/DepositService.d.cts.map +0 -1
  432. package/dist/services/DepositService.d.mts +0 -39
  433. package/dist/services/DepositService.d.mts.map +0 -1
  434. package/dist/services/DepositService.mjs.map +0 -1
  435. package/dist/services/DexDiscoveryCacheManager.cjs +0 -147
  436. package/dist/services/DexDiscoveryCacheManager.cjs.map +0 -1
  437. package/dist/services/DexDiscoveryCacheManager.d.cts.map +0 -1
  438. package/dist/services/DexDiscoveryCacheManager.d.mts +0 -52
  439. package/dist/services/DexDiscoveryCacheManager.d.mts.map +0 -1
  440. package/dist/services/DexDiscoveryCacheManager.mjs.map +0 -1
  441. package/dist/services/EligibilityService.cjs +0 -78
  442. package/dist/services/EligibilityService.cjs.map +0 -1
  443. package/dist/services/EligibilityService.d.cts.map +0 -1
  444. package/dist/services/EligibilityService.d.mts +0 -28
  445. package/dist/services/EligibilityService.d.mts.map +0 -1
  446. package/dist/services/EligibilityService.mjs.map +0 -1
  447. package/dist/services/FeatureFlagConfigurationService.cjs +0 -257
  448. package/dist/services/FeatureFlagConfigurationService.cjs.map +0 -1
  449. package/dist/services/FeatureFlagConfigurationService.d.cts.map +0 -1
  450. package/dist/services/FeatureFlagConfigurationService.d.mts +0 -73
  451. package/dist/services/FeatureFlagConfigurationService.d.mts.map +0 -1
  452. package/dist/services/FeatureFlagConfigurationService.mjs.map +0 -1
  453. package/dist/services/HyperLiquidClientService.cjs +0 -1045
  454. package/dist/services/HyperLiquidClientService.cjs.map +0 -1
  455. package/dist/services/HyperLiquidClientService.d.cts.map +0 -1
  456. package/dist/services/HyperLiquidClientService.d.mts +0 -239
  457. package/dist/services/HyperLiquidClientService.d.mts.map +0 -1
  458. package/dist/services/HyperLiquidClientService.mjs.map +0 -1
  459. package/dist/services/HyperLiquidSubscriptionService.cjs +0 -3196
  460. package/dist/services/HyperLiquidSubscriptionService.cjs.map +0 -1
  461. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +0 -1
  462. package/dist/services/HyperLiquidSubscriptionService.d.mts +0 -227
  463. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +0 -1
  464. package/dist/services/HyperLiquidSubscriptionService.mjs.map +0 -1
  465. package/dist/services/HyperLiquidWalletService.cjs +0 -186
  466. package/dist/services/HyperLiquidWalletService.cjs.map +0 -1
  467. package/dist/services/HyperLiquidWalletService.d.cts.map +0 -1
  468. package/dist/services/HyperLiquidWalletService.d.mts +0 -84
  469. package/dist/services/HyperLiquidWalletService.d.mts.map +0 -1
  470. package/dist/services/HyperLiquidWalletService.mjs.map +0 -1
  471. package/dist/services/MarketDataService.cjs +0 -1138
  472. package/dist/services/MarketDataService.cjs.map +0 -1
  473. package/dist/services/MarketDataService.d.cts.map +0 -1
  474. package/dist/services/MarketDataService.d.mts +0 -334
  475. package/dist/services/MarketDataService.d.mts.map +0 -1
  476. package/dist/services/MarketDataService.mjs.map +0 -1
  477. package/dist/services/RewardsIntegrationService.cjs +0 -391
  478. package/dist/services/RewardsIntegrationService.cjs.map +0 -1
  479. package/dist/services/RewardsIntegrationService.d.cts.map +0 -1
  480. package/dist/services/RewardsIntegrationService.d.mts +0 -84
  481. package/dist/services/RewardsIntegrationService.d.mts.map +0 -1
  482. package/dist/services/RewardsIntegrationService.mjs.map +0 -1
  483. package/dist/services/ServiceContext.cjs +0 -3
  484. package/dist/services/ServiceContext.cjs.map +0 -1
  485. package/dist/services/ServiceContext.d.cts.map +0 -1
  486. package/dist/services/ServiceContext.d.mts +0 -102
  487. package/dist/services/ServiceContext.d.mts.map +0 -1
  488. package/dist/services/ServiceContext.mjs +0 -2
  489. package/dist/services/ServiceContext.mjs.map +0 -1
  490. package/dist/services/TerminalMarketService.cjs +0 -623
  491. package/dist/services/TerminalMarketService.cjs.map +0 -1
  492. package/dist/services/TerminalMarketService.d.cts.map +0 -1
  493. package/dist/services/TerminalMarketService.d.mts +0 -45
  494. package/dist/services/TerminalMarketService.d.mts.map +0 -1
  495. package/dist/services/TerminalMarketService.mjs.map +0 -1
  496. package/dist/services/TradingReadinessCache.cjs +0 -329
  497. package/dist/services/TradingReadinessCache.cjs.map +0 -1
  498. package/dist/services/TradingReadinessCache.d.cts +0 -204
  499. package/dist/services/TradingReadinessCache.d.cts.map +0 -1
  500. package/dist/services/TradingReadinessCache.d.mts.map +0 -1
  501. package/dist/services/TradingReadinessCache.mjs.map +0 -1
  502. package/dist/services/TradingService.cjs +0 -1865
  503. package/dist/services/TradingService.cjs.map +0 -1
  504. package/dist/services/TradingService.d.cts.map +0 -1
  505. package/dist/services/TradingService.d.mts +0 -201
  506. package/dist/services/TradingService.d.mts.map +0 -1
  507. package/dist/services/TradingService.mjs.map +0 -1
  508. package/dist/types/config.cjs +0 -3
  509. package/dist/types/config.cjs.map +0 -1
  510. package/dist/types/config.d.cts.map +0 -1
  511. package/dist/types/config.d.mts +0 -49
  512. package/dist/types/config.d.mts.map +0 -1
  513. package/dist/types/config.mjs +0 -2
  514. package/dist/types/config.mjs.map +0 -1
  515. package/dist/types/hyperliquid-types.cjs +0 -45
  516. package/dist/types/hyperliquid-types.cjs.map +0 -1
  517. package/dist/types/hyperliquid-types.d.cts.map +0 -1
  518. package/dist/types/hyperliquid-types.d.mts +0 -67
  519. package/dist/types/hyperliquid-types.d.mts.map +0 -1
  520. package/dist/types/hyperliquid-types.mjs.map +0 -1
  521. package/dist/types/index.cjs +0 -151
  522. package/dist/types/index.cjs.map +0 -1
  523. package/dist/types/index.d.cts.map +0 -1
  524. package/dist/types/index.d.mts +0 -1951
  525. package/dist/types/index.d.mts.map +0 -1
  526. package/dist/types/index.mjs.map +0 -1
  527. package/dist/types/messenger.cjs +0 -3
  528. package/dist/types/messenger.cjs.map +0 -1
  529. package/dist/types/messenger.d.cts +0 -30
  530. package/dist/types/messenger.d.cts.map +0 -1
  531. package/dist/types/messenger.d.mts.map +0 -1
  532. package/dist/types/messenger.mjs +0 -2
  533. package/dist/types/messenger.mjs.map +0 -1
  534. package/dist/types/myx-types.cjs +0 -41
  535. package/dist/types/myx-types.cjs.map +0 -1
  536. package/dist/types/myx-types.d.cts +0 -94
  537. package/dist/types/myx-types.d.cts.map +0 -1
  538. package/dist/types/myx-types.d.mts.map +0 -1
  539. package/dist/types/myx-types.mjs.map +0 -1
  540. package/dist/types/perps-types.cjs +0 -7
  541. package/dist/types/perps-types.cjs.map +0 -1
  542. package/dist/types/perps-types.d.cts.map +0 -1
  543. package/dist/types/perps-types.d.mts +0 -184
  544. package/dist/types/perps-types.d.mts.map +0 -1
  545. package/dist/types/perps-types.mjs +0 -5
  546. package/dist/types/perps-types.mjs.map +0 -1
  547. package/dist/types/token.cjs +0 -3
  548. package/dist/types/token.cjs.map +0 -1
  549. package/dist/types/token.d.cts.map +0 -1
  550. package/dist/types/token.d.mts +0 -25
  551. package/dist/types/token.d.mts.map +0 -1
  552. package/dist/types/token.mjs +0 -2
  553. package/dist/types/token.mjs.map +0 -1
  554. package/dist/types/transactionTypes.cjs +0 -29
  555. package/dist/types/transactionTypes.cjs.map +0 -1
  556. package/dist/types/transactionTypes.d.cts.map +0 -1
  557. package/dist/types/transactionTypes.d.mts +0 -60
  558. package/dist/types/transactionTypes.d.mts.map +0 -1
  559. package/dist/types/transactionTypes.mjs.map +0 -1
  560. package/dist/utils/accountUtils.cjs +0 -236
  561. package/dist/utils/accountUtils.cjs.map +0 -1
  562. package/dist/utils/accountUtils.d.cts.map +0 -1
  563. package/dist/utils/accountUtils.d.mts +0 -72
  564. package/dist/utils/accountUtils.d.mts.map +0 -1
  565. package/dist/utils/accountUtils.mjs.map +0 -1
  566. package/dist/utils/capabilitySymbols.cjs +0 -25
  567. package/dist/utils/capabilitySymbols.cjs.map +0 -1
  568. package/dist/utils/capabilitySymbols.d.cts +0 -15
  569. package/dist/utils/capabilitySymbols.d.cts.map +0 -1
  570. package/dist/utils/capabilitySymbols.d.mts.map +0 -1
  571. package/dist/utils/capabilitySymbols.mjs.map +0 -1
  572. package/dist/utils/coalescePerpsRestRequest.cjs +0 -71
  573. package/dist/utils/coalescePerpsRestRequest.cjs.map +0 -1
  574. package/dist/utils/coalescePerpsRestRequest.d.cts.map +0 -1
  575. package/dist/utils/coalescePerpsRestRequest.d.mts +0 -32
  576. package/dist/utils/coalescePerpsRestRequest.d.mts.map +0 -1
  577. package/dist/utils/coalescePerpsRestRequest.mjs.map +0 -1
  578. package/dist/utils/errorUtils.cjs +0 -104
  579. package/dist/utils/errorUtils.cjs.map +0 -1
  580. package/dist/utils/errorUtils.d.cts +0 -50
  581. package/dist/utils/errorUtils.d.cts.map +0 -1
  582. package/dist/utils/errorUtils.d.mts.map +0 -1
  583. package/dist/utils/errorUtils.mjs.map +0 -1
  584. package/dist/utils/hyperLiquidAbstraction.cjs +0 -23
  585. package/dist/utils/hyperLiquidAbstraction.cjs.map +0 -1
  586. package/dist/utils/hyperLiquidAbstraction.d.cts.map +0 -1
  587. package/dist/utils/hyperLiquidAbstraction.d.mts +0 -11
  588. package/dist/utils/hyperLiquidAbstraction.d.mts.map +0 -1
  589. package/dist/utils/hyperLiquidAbstraction.mjs.map +0 -1
  590. package/dist/utils/hyperLiquidAdapter.cjs +0 -512
  591. package/dist/utils/hyperLiquidAdapter.cjs.map +0 -1
  592. package/dist/utils/hyperLiquidAdapter.d.cts.map +0 -1
  593. package/dist/utils/hyperLiquidAdapter.d.mts +0 -77
  594. package/dist/utils/hyperLiquidAdapter.d.mts.map +0 -1
  595. package/dist/utils/hyperLiquidAdapter.mjs.map +0 -1
  596. package/dist/utils/hyperLiquidOrderBookProcessor.cjs +0 -83
  597. package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +0 -1
  598. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +0 -55
  599. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +0 -1
  600. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +0 -1
  601. package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +0 -1
  602. package/dist/utils/hyperLiquidValidation.cjs +0 -799
  603. package/dist/utils/hyperLiquidValidation.cjs.map +0 -1
  604. package/dist/utils/hyperLiquidValidation.d.cts.map +0 -1
  605. package/dist/utils/hyperLiquidValidation.d.mts +0 -192
  606. package/dist/utils/hyperLiquidValidation.d.mts.map +0 -1
  607. package/dist/utils/hyperLiquidValidation.mjs.map +0 -1
  608. package/dist/utils/idUtils.cjs +0 -18
  609. package/dist/utils/idUtils.cjs.map +0 -1
  610. package/dist/utils/idUtils.d.cts.map +0 -1
  611. package/dist/utils/idUtils.d.mts +0 -6
  612. package/dist/utils/idUtils.d.mts.map +0 -1
  613. package/dist/utils/idUtils.mjs.map +0 -1
  614. package/dist/utils/index.cjs +0 -65
  615. package/dist/utils/index.cjs.map +0 -1
  616. package/dist/utils/index.d.cts +0 -28
  617. package/dist/utils/index.d.cts.map +0 -1
  618. package/dist/utils/index.d.mts +0 -28
  619. package/dist/utils/index.d.mts.map +0 -1
  620. package/dist/utils/index.mjs.map +0 -1
  621. package/dist/utils/marketDataTransform.cjs +0 -250
  622. package/dist/utils/marketDataTransform.cjs.map +0 -1
  623. package/dist/utils/marketDataTransform.d.cts.map +0 -1
  624. package/dist/utils/marketDataTransform.d.mts +0 -71
  625. package/dist/utils/marketDataTransform.d.mts.map +0 -1
  626. package/dist/utils/marketDataTransform.mjs.map +0 -1
  627. package/dist/utils/marketSearch.cjs +0 -111
  628. package/dist/utils/marketSearch.cjs.map +0 -1
  629. package/dist/utils/marketSearch.d.cts.map +0 -1
  630. package/dist/utils/marketSearch.d.mts +0 -48
  631. package/dist/utils/marketSearch.d.mts.map +0 -1
  632. package/dist/utils/marketSearch.mjs.map +0 -1
  633. package/dist/utils/marketUtils.cjs +0 -266
  634. package/dist/utils/marketUtils.cjs.map +0 -1
  635. package/dist/utils/marketUtils.d.cts.map +0 -1
  636. package/dist/utils/marketUtils.d.mts +0 -73
  637. package/dist/utils/marketUtils.d.mts.map +0 -1
  638. package/dist/utils/marketUtils.mjs.map +0 -1
  639. package/dist/utils/myxAdapter.cjs +0 -569
  640. package/dist/utils/myxAdapter.cjs.map +0 -1
  641. package/dist/utils/myxAdapter.d.cts.map +0 -1
  642. package/dist/utils/myxAdapter.d.mts +0 -168
  643. package/dist/utils/myxAdapter.d.mts.map +0 -1
  644. package/dist/utils/myxAdapter.mjs.map +0 -1
  645. package/dist/utils/orderCalculations.cjs +0 -823
  646. package/dist/utils/orderCalculations.cjs.map +0 -1
  647. package/dist/utils/orderCalculations.d.cts.map +0 -1
  648. package/dist/utils/orderCalculations.d.mts +0 -298
  649. package/dist/utils/orderCalculations.d.mts.map +0 -1
  650. package/dist/utils/orderCalculations.mjs.map +0 -1
  651. package/dist/utils/orderTypes.cjs +0 -301
  652. package/dist/utils/orderTypes.cjs.map +0 -1
  653. package/dist/utils/orderTypes.d.cts +0 -166
  654. package/dist/utils/orderTypes.d.cts.map +0 -1
  655. package/dist/utils/orderTypes.d.mts.map +0 -1
  656. package/dist/utils/orderTypes.mjs.map +0 -1
  657. package/dist/utils/perpsConnectionAttemptContext.cjs +0 -20
  658. package/dist/utils/perpsConnectionAttemptContext.cjs.map +0 -1
  659. package/dist/utils/perpsConnectionAttemptContext.d.cts +0 -7
  660. package/dist/utils/perpsConnectionAttemptContext.d.cts.map +0 -1
  661. package/dist/utils/perpsConnectionAttemptContext.d.mts.map +0 -1
  662. package/dist/utils/perpsConnectionAttemptContext.mjs.map +0 -1
  663. package/dist/utils/perpsDiskPersistence.cjs +0 -259
  664. package/dist/utils/perpsDiskPersistence.cjs.map +0 -1
  665. package/dist/utils/perpsDiskPersistence.d.cts.map +0 -1
  666. package/dist/utils/perpsDiskPersistence.d.mts +0 -112
  667. package/dist/utils/perpsDiskPersistence.d.mts.map +0 -1
  668. package/dist/utils/perpsDiskPersistence.mjs.map +0 -1
  669. package/dist/utils/perpsFormatters.cjs +0 -509
  670. package/dist/utils/perpsFormatters.cjs.map +0 -1
  671. package/dist/utils/perpsFormatters.d.cts.map +0 -1
  672. package/dist/utils/perpsFormatters.d.mts +0 -204
  673. package/dist/utils/perpsFormatters.d.mts.map +0 -1
  674. package/dist/utils/perpsFormatters.mjs.map +0 -1
  675. package/dist/utils/rewardsUtils.cjs +0 -98
  676. package/dist/utils/rewardsUtils.cjs.map +0 -1
  677. package/dist/utils/rewardsUtils.d.cts.map +0 -1
  678. package/dist/utils/rewardsUtils.d.mts +0 -33
  679. package/dist/utils/rewardsUtils.d.mts.map +0 -1
  680. package/dist/utils/rewardsUtils.mjs.map +0 -1
  681. package/dist/utils/significantFigures.cjs +0 -88
  682. package/dist/utils/significantFigures.cjs.map +0 -1
  683. package/dist/utils/significantFigures.d.cts.map +0 -1
  684. package/dist/utils/significantFigures.d.mts +0 -25
  685. package/dist/utils/significantFigures.d.mts.map +0 -1
  686. package/dist/utils/significantFigures.mjs.map +0 -1
  687. package/dist/utils/sortMarkets.cjs +0 -93
  688. package/dist/utils/sortMarkets.cjs.map +0 -1
  689. package/dist/utils/sortMarkets.d.cts.map +0 -1
  690. package/dist/utils/sortMarkets.d.mts +0 -25
  691. package/dist/utils/sortMarkets.d.mts.map +0 -1
  692. package/dist/utils/sortMarkets.mjs.map +0 -1
  693. package/dist/utils/standaloneInfoClient.cjs +0 -70
  694. package/dist/utils/standaloneInfoClient.cjs.map +0 -1
  695. package/dist/utils/standaloneInfoClient.d.cts.map +0 -1
  696. package/dist/utils/standaloneInfoClient.d.mts +0 -37
  697. package/dist/utils/standaloneInfoClient.d.mts.map +0 -1
  698. package/dist/utils/standaloneInfoClient.mjs.map +0 -1
  699. package/dist/utils/stringParseUtils.cjs +0 -34
  700. package/dist/utils/stringParseUtils.cjs.map +0 -1
  701. package/dist/utils/stringParseUtils.d.cts.map +0 -1
  702. package/dist/utils/stringParseUtils.d.mts +0 -11
  703. package/dist/utils/stringParseUtils.d.mts.map +0 -1
  704. package/dist/utils/stringParseUtils.mjs.map +0 -1
  705. package/dist/utils/transferData.cjs +0 -33
  706. package/dist/utils/transferData.cjs.map +0 -1
  707. package/dist/utils/transferData.d.cts.map +0 -1
  708. package/dist/utils/transferData.d.mts +0 -9
  709. package/dist/utils/transferData.d.mts.map +0 -1
  710. package/dist/utils/transferData.mjs.map +0 -1
  711. package/dist/utils/wait.cjs +0 -6
  712. package/dist/utils/wait.cjs.map +0 -1
  713. package/dist/utils/wait.d.cts.map +0 -1
  714. package/dist/utils/wait.d.mts +0 -2
  715. package/dist/utils/wait.d.mts.map +0 -1
  716. package/dist/utils/wait.mjs.map +0 -1
@@ -1,1045 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _HyperLiquidClientService_instances, _HyperLiquidClientService_exchangeClient, _HyperLiquidClientService_infoClient, _HyperLiquidClientService_infoClientHttp, _HyperLiquidClientService_subscriptionClient, _HyperLiquidClientService_wsTransport, _HyperLiquidClientService_httpTransport, _HyperLiquidClientService_walletParams, _HyperLiquidClientService_isTestnet, _HyperLiquidClientService_connectionState, _HyperLiquidClientService_disconnectionPromise, _HyperLiquidClientService_onTerminateCallback, _HyperLiquidClientService_onReconnectCallback, _HyperLiquidClientService_reconnectionAttempt, _HyperLiquidClientService_connectionStateListeners, _HyperLiquidClientService_reconnectionRetryTimeout, _HyperLiquidClientService_deps, _HyperLiquidClientService_createTransports, _HyperLiquidClientService_createAllClients, _HyperLiquidClientService_createHttpClients, _HyperLiquidClientService_runCandleSnapshotFetch, _HyperLiquidClientService_runHistoricalOrdersFetch, _HyperLiquidClientService_getIntervalMilliseconds, _HyperLiquidClientService_performDisconnection, _HyperLiquidClientService_updateConnectionState, _HyperLiquidClientService_notifyConnectionStateListeners, _HyperLiquidClientService_isReconnecting, _HyperLiquidClientService_handleConnectionDrop;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.HyperLiquidClientService = exports.WebSocketConnectionState = void 0;
16
- const hyperliquid_1 = require("@nktkas/hyperliquid");
17
- const chartConfig_js_1 = require("../constants/chartConfig.cjs");
18
- const hyperLiquidConfig_js_1 = require("../constants/hyperLiquidConfig.cjs");
19
- const perpsConfig_js_1 = require("../constants/perpsConfig.cjs");
20
- const perpsErrorCodes_js_1 = require("../perpsErrorCodes.cjs");
21
- const index_js_1 = require("../types/index.cjs");
22
- const coalescePerpsRestRequest_js_1 = require("../utils/coalescePerpsRestRequest.cjs");
23
- const errorUtils_js_1 = require("../utils/errorUtils.cjs");
24
- const perpsConnectionAttemptContext_js_1 = require("../utils/perpsConnectionAttemptContext.cjs");
25
- /**
26
- * Maximum number of reconnection attempts before giving up.
27
- */
28
- const maxReconnectionAttempts = 10;
29
- // WebSocketConnectionState is now imported from controllers/types
30
- // Re-export for backward compatibility with existing consumers
31
- var index_js_2 = require("../types/index.cjs");
32
- Object.defineProperty(exports, "WebSocketConnectionState", { enumerable: true, get: function () { return index_js_2.WebSocketConnectionState; } });
33
- /**
34
- * Service for managing HyperLiquid SDK clients
35
- * Handles initialization, transport creation, and client lifecycle
36
- */
37
- class HyperLiquidClientService {
38
- constructor(deps, options = {}) {
39
- _HyperLiquidClientService_instances.add(this);
40
- _HyperLiquidClientService_exchangeClient.set(this, void 0);
41
- _HyperLiquidClientService_infoClient.set(this, void 0); // WebSocket transport (default)
42
- _HyperLiquidClientService_infoClientHttp.set(this, void 0); // HTTP transport (fallback)
43
- _HyperLiquidClientService_subscriptionClient.set(this, void 0);
44
- _HyperLiquidClientService_wsTransport.set(this, void 0);
45
- _HyperLiquidClientService_httpTransport.set(this, void 0);
46
- _HyperLiquidClientService_walletParams.set(this, void 0);
47
- _HyperLiquidClientService_isTestnet.set(this, void 0);
48
- _HyperLiquidClientService_connectionState.set(this, index_js_1.WebSocketConnectionState.Disconnected);
49
- _HyperLiquidClientService_disconnectionPromise.set(this, null);
50
- // Callback for SDK terminate event (fired when all reconnection attempts exhausted)
51
- _HyperLiquidClientService_onTerminateCallback.set(this, null);
52
- _HyperLiquidClientService_onReconnectCallback.set(this, void 0);
53
- // Reconnection attempt counter
54
- _HyperLiquidClientService_reconnectionAttempt.set(this, 0);
55
- // Connection state change listeners for event-based notifications
56
- _HyperLiquidClientService_connectionStateListeners.set(this, new Set());
57
- // Timeout reference for reconnection retry, tracked to enable cancellation on disconnect
58
- _HyperLiquidClientService_reconnectionRetryTimeout.set(this, null);
59
- // Platform dependencies for logging
60
- _HyperLiquidClientService_deps.set(this, void 0);
61
- // Flag to prevent concurrent reconnection attempts
62
- _HyperLiquidClientService_isReconnecting.set(this, false);
63
- __classPrivateFieldSet(this, _HyperLiquidClientService_deps, deps, "f");
64
- __classPrivateFieldSet(this, _HyperLiquidClientService_isTestnet, options.isTestnet ?? false, "f");
65
- }
66
- /**
67
- * Initialize all HyperLiquid SDK clients
68
- *
69
- * IMPORTANT: This method awaits transport.ready() to ensure the WebSocket is
70
- * in OPEN state before marking initialization complete. This prevents race
71
- * conditions where subscriptions are attempted before the WebSocket handshake
72
- * completes (which would cause "subscribe error: undefined" errors).
73
- *
74
- * @param wallet - The wallet parameters for signing typed data.
75
- */
76
- async initialize(wallet) {
77
- const network = __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet';
78
- const attemptContext = (0, perpsConnectionAttemptContext_js_1.getPerpsConnectionAttemptContext)();
79
- try {
80
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Connecting);
81
- __classPrivateFieldSet(this, _HyperLiquidClientService_walletParams, wallet, "f");
82
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_createTransports).call(this);
83
- // Ensure transports are created
84
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_httpTransport, "f") || !__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f")) {
85
- throw new Error('Failed to create transports');
86
- }
87
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_createAllClients).call(this, wallet);
88
- // Wait for WebSocket to actually be ready before setting CONNECTED
89
- // This ensures we have a real connection, not just client objects
90
- await __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f").ready();
91
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Connected);
92
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid SDK clients initialized', {
93
- testnet: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"),
94
- timestamp: new Date().toISOString(),
95
- connectionState: __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"),
96
- note: 'Using WebSocket for InfoClient (default), HTTP fallback available',
97
- });
98
- }
99
- catch (error) {
100
- // Cleanup on failure to prevent leaks and ensure isInitialized() returns false
101
- // Clear clients first, then transports
102
- __classPrivateFieldSet(this, _HyperLiquidClientService_subscriptionClient, undefined, "f");
103
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClient, undefined, "f");
104
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClientHttp, undefined, "f");
105
- __classPrivateFieldSet(this, _HyperLiquidClientService_exchangeClient, undefined, "f");
106
- // Close WebSocket transport to release resources and event listeners
107
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f")) {
108
- try {
109
- __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f").close();
110
- }
111
- catch {
112
- // Ignore cleanup errors
113
- }
114
- __classPrivateFieldSet(this, _HyperLiquidClientService_wsTransport, undefined, "f");
115
- }
116
- __classPrivateFieldSet(this, _HyperLiquidClientService_httpTransport, undefined, "f");
117
- const errorInstance = (0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.initialize');
118
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnected);
119
- if (attemptContext?.suppressError) {
120
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid initialize failed during suppressed startup attempt', {
121
- error: errorInstance.message,
122
- network,
123
- source: attemptContext.source,
124
- });
125
- }
126
- else {
127
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error(errorInstance, {
128
- tags: {
129
- feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName,
130
- service: 'HyperLiquidClientService',
131
- network,
132
- },
133
- context: {
134
- name: 'sdk_initialization',
135
- data: {
136
- operation: 'initialize',
137
- isTestnet: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"),
138
- source: attemptContext?.source ?? 'unspecified',
139
- },
140
- },
141
- });
142
- }
143
- throw error;
144
- }
145
- }
146
- /**
147
- * Toggle testnet mode and reinitialize clients
148
- *
149
- * @param wallet - The wallet parameters for signing typed data.
150
- * @returns The new network name after toggling.
151
- */
152
- async toggleTestnet(wallet) {
153
- __classPrivateFieldSet(this, _HyperLiquidClientService_isTestnet, !__classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"), "f");
154
- await this.initialize(wallet);
155
- return __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet';
156
- }
157
- /**
158
- * Check if clients are properly initialized
159
- *
160
- * @returns True if all SDK clients are initialized.
161
- */
162
- isInitialized() {
163
- return Boolean(__classPrivateFieldGet(this, _HyperLiquidClientService_exchangeClient, "f") &&
164
- __classPrivateFieldGet(this, _HyperLiquidClientService_infoClient, "f") &&
165
- __classPrivateFieldGet(this, _HyperLiquidClientService_infoClientHttp, "f") &&
166
- __classPrivateFieldGet(this, _HyperLiquidClientService_subscriptionClient, "f"));
167
- }
168
- /**
169
- * Ensure clients are initialized, throw if not
170
- */
171
- ensureInitialized() {
172
- if (!this.isInitialized()) {
173
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.CLIENT_NOT_INITIALIZED);
174
- }
175
- }
176
- /**
177
- * Recreate subscription client if needed (for reconnection scenarios)
178
- *
179
- * @param wallet - The wallet parameters for signing typed data.
180
- */
181
- async ensureSubscriptionClient(wallet) {
182
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_subscriptionClient, "f")) {
183
- // A reconnect publishes its WebSocket clients only after transport.ready().
184
- // Do not start a competing initialize() while that attempt or its retry
185
- // backoff is active; callers will observe an unavailable subscription
186
- // client until the reconnect completes and restores tracked subscriptions.
187
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_isReconnecting, "f") || __classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionRetryTimeout, "f")) {
188
- return;
189
- }
190
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: Recreating subscription client after disconnect');
191
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_walletParams, "f") &&
192
- __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f") === index_js_1.WebSocketConnectionState.Disconnected) {
193
- await this.reconnect();
194
- }
195
- else {
196
- await this.initialize(wallet);
197
- }
198
- }
199
- }
200
- /**
201
- * Get the exchange client
202
- *
203
- * @returns The initialized ExchangeClient instance.
204
- */
205
- getExchangeClient() {
206
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_exchangeClient, "f")) {
207
- this.ensureInitialized();
208
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.EXCHANGE_CLIENT_NOT_AVAILABLE);
209
- }
210
- return __classPrivateFieldGet(this, _HyperLiquidClientService_exchangeClient, "f");
211
- }
212
- /**
213
- * Get the info client
214
- *
215
- * @param options - The options for selecting the transport.
216
- * @param options.useHttp - Force HTTP transport instead of WebSocket (default: false).
217
- * @returns InfoClient instance with the selected transport.
218
- */
219
- getInfoClient(options) {
220
- if (options?.useHttp) {
221
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_infoClientHttp, "f")) {
222
- this.ensureInitialized();
223
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.INFO_CLIENT_NOT_AVAILABLE);
224
- }
225
- return __classPrivateFieldGet(this, _HyperLiquidClientService_infoClientHttp, "f");
226
- }
227
- this.ensureInitialized();
228
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_infoClient, "f")) {
229
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.INFO_CLIENT_NOT_AVAILABLE);
230
- }
231
- return __classPrivateFieldGet(this, _HyperLiquidClientService_infoClient, "f");
232
- }
233
- /**
234
- * Get the subscription client
235
- *
236
- * @returns The SubscriptionClient instance, or undefined if not initialized.
237
- */
238
- getSubscriptionClient() {
239
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_subscriptionClient, "f")) {
240
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('SubscriptionClient not initialized');
241
- return undefined;
242
- }
243
- return __classPrivateFieldGet(this, _HyperLiquidClientService_subscriptionClient, "f");
244
- }
245
- /**
246
- * Ensures the WebSocket transport is in OPEN state and ready for subscriptions.
247
- * This MUST be called before any subscription operations to prevent race conditions.
248
- *
249
- * The SDK's `transport.ready()` method:
250
- * - Returns immediately if WebSocket is already in OPEN state
251
- * - Waits for the "open" event if WebSocket is in CONNECTING state
252
- * - Supports AbortSignal for timeout/cancellation
253
- *
254
- * @param options - The options for transport readiness check.
255
- * @param options.timeoutMs - Maximum time to wait for transport ready (default 5000ms).
256
- * @throws Error if transport not ready within timeout or subscription client unavailable.
257
- */
258
- async ensureTransportReady(options = {}) {
259
- const { timeoutMs = 5000 } = options;
260
- const subscriptionClient = this.getSubscriptionClient();
261
- if (!subscriptionClient) {
262
- throw new Error('Subscription client not initialized');
263
- }
264
- const controller = new AbortController();
265
- const timeoutId = setTimeout(() => controller.abort(new Error(`WebSocket transport ready timeout after ${timeoutMs}ms`)), timeoutMs);
266
- try {
267
- await subscriptionClient.config_.transport.ready(controller.signal);
268
- }
269
- catch (error) {
270
- if (controller.signal.aborted) {
271
- throw new Error(`WebSocket transport ready timeout after ${timeoutMs}ms`);
272
- }
273
- throw (0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.ensureTransportReady');
274
- }
275
- finally {
276
- clearTimeout(timeoutId);
277
- }
278
- }
279
- /**
280
- * Get current network state
281
- *
282
- * @returns The current HyperLiquid network (mainnet or testnet).
283
- */
284
- getNetwork() {
285
- return __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet';
286
- }
287
- /**
288
- * Check if running on testnet
289
- *
290
- * @returns True if the service is in testnet mode.
291
- */
292
- isTestnetMode() {
293
- return __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f");
294
- }
295
- /**
296
- * Update testnet mode
297
- *
298
- * @param isTestnet - Whether to enable testnet mode.
299
- */
300
- setTestnetMode(isTestnet) {
301
- __classPrivateFieldSet(this, _HyperLiquidClientService_isTestnet, isTestnet, "f");
302
- }
303
- /**
304
- * Fetch historical candle data using the HyperLiquid SDK
305
- *
306
- * @param options - The candle fetch configuration.
307
- * @param options.symbol - The asset symbol (e.g., "BTC", "ETH").
308
- * @param options.interval - The candle interval (e.g., "1m", "5m", "15m", "1h", "1d").
309
- * @param options.limit - Number of candles to fetch (default: 100).
310
- * @param options.endTime - End timestamp in milliseconds (default: now).
311
- * @param options.signal - Optional AbortSignal to cancel the fetch.
312
- * @returns The historical candle data, or null if no data is available.
313
- */
314
- async fetchHistoricalCandles(options) {
315
- const { symbol, interval, limit = 100, endTime, signal } = options;
316
- if (signal?.aborted) {
317
- const abortError = new Error('Aborted');
318
- abortError.name = 'AbortError';
319
- throw abortError;
320
- }
321
- // Explicit endTime is a paging call — the caller owns that exact window
322
- // and expects a fresh page. Coalescing per-millisecond endTimes produces
323
- // keys that never dedupe and never evict (TTL-miss sweep only fires on
324
- // re-access with the same key), so route paging straight to the SDK and
325
- // only coalesce the live-snapshot path where all callers share 'now'.
326
- if (endTime !== undefined) {
327
- return __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_runCandleSnapshotFetch).call(this, {
328
- symbol,
329
- interval,
330
- limit,
331
- endTime,
332
- signal,
333
- });
334
- }
335
- // Live snapshot: coalesce across rapid market switches (pass 1 → pass 2
336
- // of the 10-market stress loop) so callers share one snapshot per
337
- // (symbol, interval).
338
- // Signal is intentionally dropped inside the coalesced fetch — the HL
339
- // SDK charges weight for any request already sent, and dropping a
340
- // per-caller abort lets the next caller reuse the in-flight/cached
341
- // result instead of re-firing the REST. The WS stream keeps live
342
- // candles fresh, so reusing the first-caller snapshot for up to the
343
- // TTL is acceptable.
344
- const cacheKey = [
345
- 'candleSnapshot',
346
- __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet',
347
- symbol,
348
- interval,
349
- limit,
350
- ].join('|');
351
- return (0, coalescePerpsRestRequest_js_1.coalescePerpsRestRequest)(cacheKey, () => __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_runCandleSnapshotFetch).call(this, { symbol, interval, limit }), { ttlMs: perpsConfig_js_1.PERFORMANCE_CONFIG.PerpsCandleCoalesceTtlMs });
352
- }
353
- /**
354
- * Fetch the user's historical orders via the HyperLiquid SDK, coalesced
355
- * across concurrent callers and cached for {@link PERFORMANCE_CONFIG.PerpsRestCoalesceTtlMs}.
356
- *
357
- * Both getOrders (service layer) and the getUserFills enrichment sidecar
358
- * (fills→order-type resolution for TP/SL pills in activity) hit the same
359
- * `historicalOrders` info-post. Routing both through this wrapper means the
360
- * enrichment path rides the same cache as an explicit activity-page fetch,
361
- * so rapid market switching never fires redundant HL traffic.
362
- *
363
- * Pass `forceRefresh: true` to bypass the coalesce cache end-to-end
364
- * (hooks → controller → MarketDataService → provider → this method), which
365
- * is required for pull-to-refresh to fetch fresh data from the network.
366
- *
367
- * @param userAddress - The user's 0x address to query.
368
- * @param options - Optional cache-control options.
369
- * @param options.forceRefresh - When true, bypasses the coalesce cache.
370
- * @returns Array of historical orders, empty array on SDK null.
371
- */
372
- async fetchHistoricalOrders(userAddress, options) {
373
- this.ensureInitialized();
374
- const cacheKey = [
375
- 'historicalOrders',
376
- __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet',
377
- userAddress.toLowerCase(),
378
- ].join('|');
379
- return (0, coalescePerpsRestRequest_js_1.coalescePerpsRestRequest)(cacheKey, () => __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_runHistoricalOrdersFetch).call(this, userAddress), { forceRefresh: options?.forceRefresh });
380
- }
381
- /**
382
- * Subscribe to candle updates via WebSocket
383
- *
384
- * @param root0 - The subscription parameters.
385
- * @param root0.symbol - The asset symbol (e.g., "BTC", "ETH").
386
- * @param root0.interval - The candle interval (e.g., "1m", "5m", "15m").
387
- * @param root0.duration - Optional time duration for calculating initial fetch size.
388
- * @param root0.callback - Function called with updated candle data.
389
- * @param root0.onError - Optional function called if subscription initialization fails.
390
- * @returns Cleanup function to unsubscribe.
391
- */
392
- subscribeToCandles({ symbol, interval, duration, callback, onError, }) {
393
- this.ensureInitialized();
394
- const subscriptionClient = this.getSubscriptionClient();
395
- if (!subscriptionClient) {
396
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.SUBSCRIPTION_CLIENT_NOT_AVAILABLE);
397
- }
398
- let currentCandleData = null;
399
- let wsUnsubscribe = null;
400
- let isUnsubscribed = false;
401
- let hasUnsubscribeStarted = false;
402
- let subscriptionPromise = null;
403
- const unsubscribeFromCandles = (subscription) => {
404
- if (hasUnsubscribeStarted) {
405
- return;
406
- }
407
- hasUnsubscribeStarted = true;
408
- const logUnsubscribeError = (error) => {
409
- const errorInstance = (0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.subscribeToCandles');
410
- if (errorInstance.message.startsWith('Already unsubscribed')) {
411
- return;
412
- }
413
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error(errorInstance, {
414
- tags: {
415
- feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName,
416
- service: 'HyperLiquidClientService',
417
- network: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet',
418
- },
419
- context: {
420
- name: 'websocket_unsubscription',
421
- data: {
422
- operation: 'subscribeToCandles',
423
- symbol,
424
- interval,
425
- phase: 'ws_unsubscription',
426
- },
427
- },
428
- });
429
- };
430
- try {
431
- Promise.resolve(subscription.unsubscribe()).catch(logUnsubscribeError);
432
- }
433
- catch (error) {
434
- logUnsubscribeError(error);
435
- }
436
- };
437
- // AbortController to cancel in-flight REST calls (candleSnapshot) on cleanup.
438
- // Prevents rate limit exhaustion when rapidly switching markets (#28141).
439
- const abortController = new AbortController();
440
- // Calculate initial fetch size dynamically based on duration and interval
441
- // Match main branch behavior: up to 500 candles initially
442
- const initialLimit = duration
443
- ? Math.min((0, chartConfig_js_1.calculateCandleCount)(duration, interval), 500)
444
- : 100; // Default to 100 if no duration provided
445
- // 1. Fetch initial historical data, then subscribe to WebSocket updates
446
- // Using an async IIFE to avoid nested promises and callback-in-promise issues
447
- const initAndSubscribe = async () => {
448
- try {
449
- const initialData = await this.fetchHistoricalCandles({
450
- symbol,
451
- interval,
452
- limit: initialLimit,
453
- signal: abortController.signal,
454
- });
455
- // Don't proceed if already unsubscribed
456
- if (isUnsubscribed) {
457
- return;
458
- }
459
- currentCandleData = initialData;
460
- if (currentCandleData) {
461
- callback(currentCandleData);
462
- }
463
- // 2. Subscribe to WebSocket for new candles
464
- // HyperLiquid SDK uses 'coin' terminology
465
- // Store the promise so cleanup can wait for it if needed
466
- subscriptionPromise = subscriptionClient.candle({ coin: symbol, interval }, // Map to HyperLiquid SDK's 'coin' parameter
467
- (candleEvent) => {
468
- // Don't process events if already unsubscribed
469
- if (isUnsubscribed) {
470
- return;
471
- }
472
- // Transform SDK CandleEvent to our Candle format
473
- const newCandle = {
474
- time: candleEvent.t,
475
- open: candleEvent.o.toString(),
476
- high: candleEvent.h.toString(),
477
- low: candleEvent.l.toString(),
478
- close: candleEvent.c.toString(),
479
- volume: candleEvent.v.toString(),
480
- };
481
- if (currentCandleData) {
482
- // Check if this is an update to the last candle or a new candle
483
- const { candles } = currentCandleData;
484
- const lastCandle = candles[candles.length - 1];
485
- if (lastCandle?.time === newCandle.time) {
486
- // Update existing candle (live candle update)
487
- // Create new array with updated last element to trigger React re-render
488
- currentCandleData = {
489
- ...currentCandleData,
490
- candles: [...candles.slice(0, -1), newCandle],
491
- };
492
- }
493
- else {
494
- // New candle (completed candle)
495
- // Create new array with added element to trigger React re-render
496
- currentCandleData = {
497
- ...currentCandleData,
498
- candles: [...candles, newCandle],
499
- };
500
- }
501
- }
502
- else {
503
- currentCandleData = {
504
- symbol,
505
- interval,
506
- candles: [newCandle],
507
- };
508
- }
509
- callback(currentCandleData);
510
- });
511
- // Store cleanup function when subscription resolves
512
- try {
513
- const sub = await subscriptionPromise;
514
- wsUnsubscribe = () => unsubscribeFromCandles(sub);
515
- // If already unsubscribed while waiting, clean up immediately
516
- if (isUnsubscribed) {
517
- wsUnsubscribe();
518
- wsUnsubscribe = null;
519
- }
520
- }
521
- catch (error) {
522
- const errorInstance = (0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.subscribeToCandles');
523
- // Log to Sentry: WebSocket subscription failure prevents live updates
524
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error(errorInstance, {
525
- tags: {
526
- feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName,
527
- service: 'HyperLiquidClientService',
528
- network: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet',
529
- },
530
- context: {
531
- name: 'websocket_subscription',
532
- data: {
533
- operation: 'subscribeToCandles',
534
- symbol,
535
- interval,
536
- phase: 'ws_subscription',
537
- },
538
- },
539
- });
540
- // Notify caller of error
541
- onError?.(errorInstance);
542
- }
543
- }
544
- catch (error) {
545
- // Skip logging and notification for intentional abort (user navigated away)
546
- if (abortController.signal.aborted) {
547
- return;
548
- }
549
- const errorInstance = (0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.subscribeToCandles');
550
- // Log to Sentry: initial fetch failure blocks chart completely
551
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error(errorInstance, {
552
- tags: {
553
- feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName,
554
- service: 'HyperLiquidClientService',
555
- network: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet',
556
- },
557
- context: {
558
- name: 'initial_candles_fetch',
559
- data: {
560
- operation: 'subscribeToCandles',
561
- symbol,
562
- interval,
563
- phase: 'initial_fetch',
564
- initialLimit,
565
- },
566
- },
567
- });
568
- // Notify caller of error
569
- onError?.(errorInstance);
570
- }
571
- };
572
- // Fire-and-forget the async initialization
573
- initAndSubscribe().catch(() => {
574
- // Error already handled inside initAndSubscribe
575
- });
576
- // Return cleanup function
577
- return () => {
578
- isUnsubscribed = true;
579
- // Cancel any in-flight REST calls (candleSnapshot) to conserve rate limit budget (#28141)
580
- abortController.abort();
581
- if (wsUnsubscribe) {
582
- // Subscription already resolved - unsubscribe directly
583
- wsUnsubscribe();
584
- wsUnsubscribe = null;
585
- }
586
- else if (subscriptionPromise) {
587
- // Subscription promise still pending - wait for it and clean up
588
- // This prevents WebSocket subscription leaks when component unmounts
589
- // before the subscription promise resolves
590
- subscriptionPromise
591
- .then((sub) => unsubscribeFromCandles(sub))
592
- .catch(() => {
593
- // Ignore errors during cleanup - subscription may have failed
594
- });
595
- subscriptionPromise = null;
596
- }
597
- };
598
- }
599
- /**
600
- * Disconnect and cleanup all clients
601
- *
602
- * @returns A promise that resolves when disconnection is complete.
603
- */
604
- async disconnect() {
605
- // Await existing promise if already disconnecting
606
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_disconnectionPromise, "f")) {
607
- await __classPrivateFieldGet(this, _HyperLiquidClientService_disconnectionPromise, "f");
608
- return;
609
- }
610
- // If already disconnected, return immediately
611
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f") === index_js_1.WebSocketConnectionState.Disconnected) {
612
- return;
613
- }
614
- // Create and store the disconnection promise
615
- __classPrivateFieldSet(this, _HyperLiquidClientService_disconnectionPromise, __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_performDisconnection).call(this), "f");
616
- try {
617
- await __classPrivateFieldGet(this, _HyperLiquidClientService_disconnectionPromise, "f");
618
- }
619
- finally {
620
- __classPrivateFieldSet(this, _HyperLiquidClientService_disconnectionPromise, null, "f");
621
- }
622
- }
623
- /**
624
- * Get current WebSocket connection state
625
- *
626
- * @returns The current WebSocket connection state.
627
- */
628
- getConnectionState() {
629
- return __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f");
630
- }
631
- /**
632
- * Check if WebSocket is fully disconnected
633
- *
634
- * @returns True if the WebSocket is in disconnected state.
635
- */
636
- isDisconnected() {
637
- return __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f") === index_js_1.WebSocketConnectionState.Disconnected;
638
- }
639
- /**
640
- * Set callback to be invoked when reconnection is needed
641
- * This allows the service to notify external components (like PerpsConnectionManager)
642
- * when a connection drop is detected
643
- *
644
- * @param callback - The async callback to invoke when reconnection is needed.
645
- */
646
- setOnReconnectCallback(callback) {
647
- __classPrivateFieldSet(this, _HyperLiquidClientService_onReconnectCallback, callback, "f");
648
- }
649
- /**
650
- * Set callback for WebSocket termination events
651
- * Called when the SDK exhausts all reconnection attempts
652
- *
653
- * @param callback - The callback to invoke on termination, or null to clear.
654
- */
655
- setOnTerminateCallback(callback) {
656
- __classPrivateFieldSet(this, _HyperLiquidClientService_onTerminateCallback, callback, "f");
657
- }
658
- /**
659
- * Subscribe to connection state changes.
660
- * The listener will be called immediately with the current state and whenever the state changes.
661
- *
662
- * @param listener - Callback function that receives the new connection state and reconnection attempt
663
- * @returns Unsubscribe function to remove the listener
664
- */
665
- subscribeToConnectionState(listener) {
666
- __classPrivateFieldGet(this, _HyperLiquidClientService_connectionStateListeners, "f").add(listener);
667
- // Immediately notify with current state
668
- // Wrap in try-catch to match notifyConnectionStateListeners behavior
669
- // This ensures the unsubscribe function is always returned even if listener throws
670
- try {
671
- listener(__classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"), __classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f"));
672
- }
673
- catch {
674
- // Ignore errors in listeners to prevent breaking subscription mechanism
675
- // If listener throws, it will be removed when unsubscribe is called
676
- }
677
- // Return unsubscribe function
678
- return () => {
679
- __classPrivateFieldGet(this, _HyperLiquidClientService_connectionStateListeners, "f").delete(listener);
680
- };
681
- }
682
- /**
683
- * Manually trigger a reconnection attempt.
684
- * This is exposed for UI retry buttons when user wants to force reconnection.
685
- * Resets the reconnection attempt counter to allow retrying after max attempts.
686
- */
687
- async reconnect() {
688
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('[HyperLiquidClientService] reconnect() called', {
689
- previousAttempt: __classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f"),
690
- currentState: __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"),
691
- });
692
- // Reset attempt counter when user manually triggers retry
693
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionAttempt, 0, "f");
694
- await __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_handleConnectionDrop).call(this);
695
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('[HyperLiquidClientService] reconnect() completed', {
696
- newState: __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"),
697
- });
698
- }
699
- }
700
- exports.HyperLiquidClientService = HyperLiquidClientService;
701
- _HyperLiquidClientService_exchangeClient = new WeakMap(), _HyperLiquidClientService_infoClient = new WeakMap(), _HyperLiquidClientService_infoClientHttp = new WeakMap(), _HyperLiquidClientService_subscriptionClient = new WeakMap(), _HyperLiquidClientService_wsTransport = new WeakMap(), _HyperLiquidClientService_httpTransport = new WeakMap(), _HyperLiquidClientService_walletParams = new WeakMap(), _HyperLiquidClientService_isTestnet = new WeakMap(), _HyperLiquidClientService_connectionState = new WeakMap(), _HyperLiquidClientService_disconnectionPromise = new WeakMap(), _HyperLiquidClientService_onTerminateCallback = new WeakMap(), _HyperLiquidClientService_onReconnectCallback = new WeakMap(), _HyperLiquidClientService_reconnectionAttempt = new WeakMap(), _HyperLiquidClientService_connectionStateListeners = new WeakMap(), _HyperLiquidClientService_reconnectionRetryTimeout = new WeakMap(), _HyperLiquidClientService_deps = new WeakMap(), _HyperLiquidClientService_isReconnecting = new WeakMap(), _HyperLiquidClientService_instances = new WeakSet(), _HyperLiquidClientService_createTransports = function _HyperLiquidClientService_createTransports() {
702
- // Prevent duplicate transport creation and listener accumulation
703
- // This guards against re-entry if initialize() is called multiple times
704
- // (e.g., after a failed initialization attempt that didn't properly clean up)
705
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f") && __classPrivateFieldGet(this, _HyperLiquidClientService_httpTransport, "f")) {
706
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: Transports already exist, skipping creation');
707
- return __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f");
708
- }
709
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: Creating transports', {
710
- isTestnet: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"),
711
- timestamp: new Date().toISOString(),
712
- note: 'SDK will auto-select endpoints based on isTestnet flag',
713
- });
714
- // HTTP transport for request/response operations (InfoClient, ExchangeClient)
715
- // SDK automatically selects: mainnet (https://api.hyperliquid.xyz) or testnet (https://api.hyperliquid-testnet.xyz)
716
- __classPrivateFieldSet(this, _HyperLiquidClientService_httpTransport, new hyperliquid_1.HttpTransport({
717
- isTestnet: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"),
718
- timeout: hyperLiquidConfig_js_1.HYPERLIQUID_TRANSPORT_CONFIG.timeout,
719
- }), "f");
720
- // WebSocket transport for real-time subscriptions (SubscriptionClient)
721
- // SDK automatically selects: mainnet (wss://api.hyperliquid.xyz/ws) or testnet (wss://api.hyperliquid-testnet.xyz/ws)
722
- __classPrivateFieldSet(this, _HyperLiquidClientService_wsTransport, new hyperliquid_1.WebSocketTransport({
723
- isTestnet: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"),
724
- ...hyperLiquidConfig_js_1.HYPERLIQUID_TRANSPORT_CONFIG,
725
- reconnect: hyperLiquidConfig_js_1.HYPERLIQUID_TRANSPORT_CONFIG.reconnect,
726
- }), "f");
727
- // Listen for WebSocket termination (fired when SDK exhausts all reconnection attempts)
728
- __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f").socket.addEventListener('terminate', (event) => {
729
- const customEvent = event;
730
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: WebSocket terminated', {
731
- reason: customEvent.detail?.code,
732
- timestamp: new Date().toISOString(),
733
- });
734
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnected);
735
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_onTerminateCallback, "f")) {
736
- const error = customEvent.detail instanceof Error
737
- ? customEvent.detail
738
- : new Error(`WebSocket terminated: ${customEvent.detail?.code ?? 'unknown'}`);
739
- __classPrivateFieldGet(this, _HyperLiquidClientService_onTerminateCallback, "f").call(this, error);
740
- }
741
- });
742
- return __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f");
743
- }, _HyperLiquidClientService_createAllClients = function _HyperLiquidClientService_createAllClients(wallet) {
744
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f") || !__classPrivateFieldGet(this, _HyperLiquidClientService_httpTransport, "f")) {
745
- throw new Error('Transports must be created before clients');
746
- }
747
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClient, new hyperliquid_1.InfoClient({ transport: __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f") }), "f");
748
- __classPrivateFieldSet(this, _HyperLiquidClientService_subscriptionClient, new hyperliquid_1.SubscriptionClient({
749
- transport: __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f"),
750
- }), "f");
751
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_createHttpClients).call(this, wallet);
752
- }, _HyperLiquidClientService_createHttpClients = function _HyperLiquidClientService_createHttpClients(wallet) {
753
- const effectiveWallet = wallet ?? __classPrivateFieldGet(this, _HyperLiquidClientService_walletParams, "f");
754
- if (!__classPrivateFieldGet(this, _HyperLiquidClientService_httpTransport, "f")) {
755
- throw new Error('HTTP transport must be created before clients');
756
- }
757
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClientHttp, new hyperliquid_1.InfoClient({ transport: __classPrivateFieldGet(this, _HyperLiquidClientService_httpTransport, "f") }), "f");
758
- if (effectiveWallet) {
759
- __classPrivateFieldSet(this, _HyperLiquidClientService_exchangeClient, new hyperliquid_1.ExchangeClient({
760
- wallet: effectiveWallet, // eslint-disable-line @typescript-eslint/no-explicit-any -- Type widening for SDK compatibility
761
- transport: __classPrivateFieldGet(this, _HyperLiquidClientService_httpTransport, "f"),
762
- }), "f");
763
- }
764
- else {
765
- __classPrivateFieldSet(this, _HyperLiquidClientService_exchangeClient, undefined, "f");
766
- }
767
- }, _HyperLiquidClientService_runCandleSnapshotFetch = async function _HyperLiquidClientService_runCandleSnapshotFetch(options) {
768
- const { symbol, interval, limit, endTime, signal } = options;
769
- try {
770
- const now = endTime ?? Date.now();
771
- const intervalMs = __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_getIntervalMilliseconds).call(this, interval);
772
- const startTime = now - limit * intervalMs;
773
- // Use HTTP transport for historical candle snapshots (request/response).
774
- // This avoids the WebSocket abort race condition that causes 429s
775
- // during rapid market switching on extension (#TAT-2954).
776
- const infoClient = this.getInfoClient({ useHttp: true });
777
- const request = {
778
- coin: symbol, // Map to HyperLiquid SDK's 'coin' parameter
779
- interval,
780
- startTime,
781
- endTime: now,
782
- };
783
- const data = signal
784
- ? await infoClient.candleSnapshot(request, signal)
785
- : await infoClient.candleSnapshot(request);
786
- if (Array.isArray(data) && data.length > 0) {
787
- const candles = data.map((candle) => ({
788
- time: candle.t, // open time
789
- open: candle.o.toString(),
790
- high: candle.h.toString(),
791
- low: candle.l.toString(),
792
- close: candle.c.toString(),
793
- volume: candle.v.toString(),
794
- }));
795
- return {
796
- symbol,
797
- interval,
798
- candles,
799
- };
800
- }
801
- return {
802
- symbol,
803
- interval,
804
- candles: [],
805
- };
806
- }
807
- catch (error) {
808
- const errorInstance = (0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.fetchHistoricalCandles');
809
- if ((0, errorUtils_js_1.isAbortError)(error)) {
810
- throw error;
811
- }
812
- // Log to Sentry: prevents initial chart data load
813
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error(errorInstance, {
814
- tags: {
815
- feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName,
816
- service: 'HyperLiquidClientService',
817
- network: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f") ? 'testnet' : 'mainnet',
818
- },
819
- context: {
820
- name: 'historical_candles_api',
821
- data: {
822
- operation: 'fetchHistoricalCandles',
823
- symbol,
824
- interval,
825
- limit,
826
- hasEndTime: endTime !== undefined,
827
- },
828
- },
829
- });
830
- throw error;
831
- }
832
- }, _HyperLiquidClientService_runHistoricalOrdersFetch = async function _HyperLiquidClientService_runHistoricalOrdersFetch(userAddress) {
833
- const infoClient = this.getInfoClient();
834
- const result = await infoClient.historicalOrders({ user: userAddress });
835
- return result ?? [];
836
- }, _HyperLiquidClientService_getIntervalMilliseconds = function _HyperLiquidClientService_getIntervalMilliseconds(interval) {
837
- const intervalMap = {
838
- [chartConfig_js_1.CandlePeriod.OneMinute]: 1 * 60 * 1000,
839
- [chartConfig_js_1.CandlePeriod.ThreeMinutes]: 3 * 60 * 1000,
840
- [chartConfig_js_1.CandlePeriod.FiveMinutes]: 5 * 60 * 1000,
841
- [chartConfig_js_1.CandlePeriod.FifteenMinutes]: 15 * 60 * 1000,
842
- [chartConfig_js_1.CandlePeriod.ThirtyMinutes]: 30 * 60 * 1000,
843
- [chartConfig_js_1.CandlePeriod.OneHour]: 60 * 60 * 1000,
844
- [chartConfig_js_1.CandlePeriod.TwoHours]: 2 * 60 * 60 * 1000,
845
- [chartConfig_js_1.CandlePeriod.FourHours]: 4 * 60 * 60 * 1000,
846
- [chartConfig_js_1.CandlePeriod.EightHours]: 8 * 60 * 60 * 1000,
847
- [chartConfig_js_1.CandlePeriod.TwelveHours]: 12 * 60 * 60 * 1000,
848
- [chartConfig_js_1.CandlePeriod.OneDay]: 24 * 60 * 60 * 1000,
849
- [chartConfig_js_1.CandlePeriod.ThreeDays]: 3 * 24 * 60 * 60 * 1000,
850
- [chartConfig_js_1.CandlePeriod.OneWeek]: 7 * 24 * 60 * 60 * 1000,
851
- [chartConfig_js_1.CandlePeriod.OneMonth]: 30 * 24 * 60 * 60 * 1000, // Approximate
852
- };
853
- return intervalMap[interval];
854
- }, _HyperLiquidClientService_performDisconnection = async function _HyperLiquidClientService_performDisconnection() {
855
- try {
856
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnecting);
857
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: Disconnecting SDK clients', {
858
- isTestnet: __classPrivateFieldGet(this, _HyperLiquidClientService_isTestnet, "f"),
859
- timestamp: new Date().toISOString(),
860
- connectionState: __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"),
861
- });
862
- // Clear callbacks
863
- __classPrivateFieldSet(this, _HyperLiquidClientService_onReconnectCallback, undefined, "f");
864
- __classPrivateFieldSet(this, _HyperLiquidClientService_onTerminateCallback, null, "f");
865
- // Cancel any pending reconnection retry timeout
866
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionRetryTimeout, "f")) {
867
- clearTimeout(__classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionRetryTimeout, "f"));
868
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionRetryTimeout, null, "f");
869
- }
870
- // Clear connection state listeners to prevent stale callbacks
871
- __classPrivateFieldGet(this, _HyperLiquidClientService_connectionStateListeners, "f").clear();
872
- // Reset reconnection flag to allow future manual retries
873
- // This prevents a race condition where disconnecting during an active
874
- // reconnection attempt could leave the flag stuck, blocking subsequent retries
875
- __classPrivateFieldSet(this, _HyperLiquidClientService_isReconnecting, false, "f");
876
- // Close WebSocket transport only (HTTP is stateless)
877
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f")) {
878
- try {
879
- __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f").close();
880
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: Closed WebSocket transport', {
881
- timestamp: new Date().toISOString(),
882
- });
883
- }
884
- catch (error) {
885
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error((0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.performDisconnection'), {
886
- tags: { feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName },
887
- context: {
888
- name: 'HyperLiquidClientService.performDisconnection',
889
- data: { action: 'close_transport' },
890
- },
891
- });
892
- }
893
- }
894
- // Clear client references
895
- __classPrivateFieldSet(this, _HyperLiquidClientService_subscriptionClient, undefined, "f");
896
- __classPrivateFieldSet(this, _HyperLiquidClientService_exchangeClient, undefined, "f");
897
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClient, undefined, "f");
898
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClientHttp, undefined, "f");
899
- __classPrivateFieldSet(this, _HyperLiquidClientService_wsTransport, undefined, "f");
900
- __classPrivateFieldSet(this, _HyperLiquidClientService_httpTransport, undefined, "f");
901
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnected);
902
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: SDK clients fully disconnected', {
903
- timestamp: new Date().toISOString(),
904
- connectionState: __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"),
905
- });
906
- }
907
- catch (error) {
908
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnected);
909
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").logger.error((0, errorUtils_js_1.ensureError)(error, 'HyperLiquidClientService.performDisconnection'), {
910
- tags: { feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName },
911
- context: {
912
- name: 'HyperLiquidClientService.performDisconnection',
913
- data: { action: 'outer_catch' },
914
- },
915
- });
916
- throw error;
917
- }
918
- }, _HyperLiquidClientService_updateConnectionState = function _HyperLiquidClientService_updateConnectionState(newState) {
919
- const previousState = __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f");
920
- const stateChanged = previousState !== newState;
921
- const isReconnectionAttempt = newState === index_js_1.WebSocketConnectionState.Connecting &&
922
- __classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f") > 0;
923
- __classPrivateFieldSet(this, _HyperLiquidClientService_connectionState, newState, "f");
924
- // Reset reconnection attempt counter when successfully connected
925
- if (newState === index_js_1.WebSocketConnectionState.Connected) {
926
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionAttempt, 0, "f");
927
- }
928
- // Notify if state changed OR if this is a reconnection attempt (to update attempt count)
929
- if (stateChanged || isReconnectionAttempt) {
930
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_notifyConnectionStateListeners).call(this);
931
- }
932
- }, _HyperLiquidClientService_notifyConnectionStateListeners = function _HyperLiquidClientService_notifyConnectionStateListeners() {
933
- __classPrivateFieldGet(this, _HyperLiquidClientService_connectionStateListeners, "f").forEach((listener) => {
934
- try {
935
- listener(__classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f"), __classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f"));
936
- }
937
- catch {
938
- // Ignore errors in listeners to prevent breaking other listeners
939
- }
940
- });
941
- }, _HyperLiquidClientService_handleConnectionDrop =
942
- /**
943
- * Handle detected connection drop
944
- * Recreates WebSocket transport and notifies callback to restore subscriptions
945
- * Will give up after maxReconnectionAttempts and mark status as disconnected
946
- */
947
- async function _HyperLiquidClientService_handleConnectionDrop() {
948
- // Prevent multiple simultaneous reconnection attempts
949
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_isReconnecting, "f")) {
950
- return;
951
- }
952
- __classPrivateFieldSet(this, _HyperLiquidClientService_isReconnecting, true, "f");
953
- // Increment reconnection attempt counter
954
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionAttempt, __classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f") + 1, "f");
955
- // Check if we've exceeded max retry attempts
956
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f") > maxReconnectionAttempts) {
957
- __classPrivateFieldSet(this, _HyperLiquidClientService_isReconnecting, false, "f");
958
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnected);
959
- return;
960
- }
961
- try {
962
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Connecting);
963
- // Close existing WebSocket transport and clear references
964
- // so createTransports() will create fresh ones
965
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f")) {
966
- try {
967
- __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f").close();
968
- }
969
- catch {
970
- // Ignore errors during close - transport may already be dead
971
- }
972
- }
973
- __classPrivateFieldSet(this, _HyperLiquidClientService_wsTransport, undefined, "f");
974
- __classPrivateFieldSet(this, _HyperLiquidClientService_httpTransport, undefined, "f");
975
- // WebSocket clients are unavailable throughout the reconnect. HTTP
976
- // clients remain usable while the new socket is staged and verified.
977
- __classPrivateFieldSet(this, _HyperLiquidClientService_subscriptionClient, undefined, "f");
978
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClient, undefined, "f");
979
- // Recreate transports (both WS and HTTP)
980
- const newWsTransport = __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_createTransports).call(this);
981
- const newInfoClient = new hyperliquid_1.InfoClient({ transport: newWsTransport });
982
- const newSubscriptionClient = new hyperliquid_1.SubscriptionClient({
983
- transport: newWsTransport,
984
- });
985
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_createHttpClients).call(this);
986
- await newWsTransport.ready();
987
- // Publish WebSocket clients only after the transport is usable. This
988
- // keeps isInitialized() false and blocks WS-backed access during a
989
- // failed or in-flight reconnect without disabling HTTP-backed trading.
990
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClient, newInfoClient, "f");
991
- __classPrivateFieldSet(this, _HyperLiquidClientService_subscriptionClient, newSubscriptionClient, "f");
992
- __classPrivateFieldGet(this, _HyperLiquidClientService_deps, "f").debugLogger.log('HyperLiquid: Transport ready, restoring subscriptions', { timestamp: new Date().toISOString() });
993
- // NOW safe to restore subscriptions
994
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_onReconnectCallback, "f")) {
995
- await __classPrivateFieldGet(this, _HyperLiquidClientService_onReconnectCallback, "f").call(this);
996
- }
997
- // Cancel any pending retry timeout from previous failed attempts
998
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionRetryTimeout, "f")) {
999
- clearTimeout(__classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionRetryTimeout, "f"));
1000
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionRetryTimeout, null, "f");
1001
- }
1002
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Connected);
1003
- __classPrivateFieldSet(this, _HyperLiquidClientService_isReconnecting, false, "f");
1004
- }
1005
- catch {
1006
- // The staged WebSocket clients were never published. Keep the HTTP
1007
- // clients alive so exchange writes and explicit HTTP info reads remain
1008
- // available while the WebSocket retry loop continues.
1009
- __classPrivateFieldSet(this, _HyperLiquidClientService_subscriptionClient, undefined, "f");
1010
- __classPrivateFieldSet(this, _HyperLiquidClientService_infoClient, undefined, "f");
1011
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f")) {
1012
- try {
1013
- __classPrivateFieldGet(this, _HyperLiquidClientService_wsTransport, "f").close();
1014
- }
1015
- catch {
1016
- // Ignore cleanup errors - transport may already be dead
1017
- }
1018
- }
1019
- __classPrivateFieldSet(this, _HyperLiquidClientService_wsTransport, undefined, "f");
1020
- // Reset flag before scheduling retry so the next attempt can proceed
1021
- __classPrivateFieldSet(this, _HyperLiquidClientService_isReconnecting, false, "f");
1022
- // Check if we've exceeded max retry attempts
1023
- if (__classPrivateFieldGet(this, _HyperLiquidClientService_reconnectionAttempt, "f") >= maxReconnectionAttempts) {
1024
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_updateConnectionState).call(this, index_js_1.WebSocketConnectionState.Disconnected);
1025
- return;
1026
- }
1027
- // Reconnection failed - schedule a retry after a delay
1028
- // Store timeout reference so it can be cancelled on intentional disconnect
1029
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionRetryTimeout, setTimeout(() => {
1030
- __classPrivateFieldSet(this, _HyperLiquidClientService_reconnectionRetryTimeout, null, "f"); // Clear reference after execution
1031
- // Only retry if we haven't been intentionally disconnected
1032
- // and no manual reconnect() is already in progress
1033
- // Note: State may be CONNECTING or DISCONNECTED (if terminate event fired during reconnect)
1034
- if ((__classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f") === index_js_1.WebSocketConnectionState.Connecting ||
1035
- __classPrivateFieldGet(this, _HyperLiquidClientService_connectionState, "f") === index_js_1.WebSocketConnectionState.Disconnected) &&
1036
- !__classPrivateFieldGet(this, _HyperLiquidClientService_disconnectionPromise, "f") &&
1037
- !__classPrivateFieldGet(this, _HyperLiquidClientService_isReconnecting, "f")) {
1038
- __classPrivateFieldGet(this, _HyperLiquidClientService_instances, "m", _HyperLiquidClientService_handleConnectionDrop).call(this).catch(() => {
1039
- // Error already handled inside #handleConnectionDrop
1040
- });
1041
- }
1042
- }, perpsConfig_js_1.PERPS_CONSTANTS.ReconnectionRetryDelayMs), "f");
1043
- }
1044
- };
1045
- //# sourceMappingURL=HyperLiquidClientService.cjs.map