@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 +0,0 @@
1
- {"version":3,"file":"AggregatedOrderBookConnection.mjs","sourceRoot":"","sources":["../../src/services/AggregatedOrderBookConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EA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E,CAAC;QACd,SAAS,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;AACH,CAAC","sourcesContent":["import { SubscriptionClient, WebSocketTransport } from '@nktkas/hyperliquid';\nimport type { ISubscription } from '@nktkas/hyperliquid';\n\nimport { HYPERLIQUID_TRANSPORT_CONFIG } from '../constants/hyperLiquidConfig.js';\nimport type { OrderBookData } from '../types/index.js';\n\n/**\n * A single L2 book price level as delivered by Hyperliquid's `l2Book`\n * subscription. Declared locally to avoid coupling to the SDK's exported type\n * names (and to keep this the only file that references the SDK's shapes).\n */\ntype HyperliquidL2BookLevel = {\n /** Price. */\n px: string;\n /** Total size resting at this price. */\n sz: string;\n /** Number of individual orders. */\n n: number;\n};\n\n/** `l2Book` snapshot event (index 0 = bids, index 1 = asks). */\ntype HyperliquidL2BookEvent = {\n coin: string;\n time: number;\n levels: [bids: HyperliquidL2BookLevel[], asks: HyperliquidL2BookLevel[]];\n spread?: string;\n};\n\n/**\n * Health of the dedicated order-book socket, surfaced to the UI so the panel\n * can show a reconnect affordance.\n *\n * - `connecting`: socket opening or reconnecting after a transient drop.\n * - `connected`: subscription is live.\n * - `error`: dropped and automatic reconnection was exhausted; needs a manual reconnect.\n */\nexport type OrderBookConnectionStatus = 'connecting' | 'connected' | 'error';\n\nexport type SubscribeAggregatedOrderBookParams = {\n /** Market symbol (e.g. 'BTC'). */\n symbol: string;\n /** Number of levels per side to keep. */\n levels?: number;\n /**\n * Server-side aggregation significant figures. Required: omitting it would\n * request the raw, full-precision book instead of an aggregated one, which\n * contradicts this service's contract.\n */\n nSigFigs: 2 | 3 | 4 | 5;\n /** Mantissa refinement when `nSigFigs` is 5. */\n mantissa?: 2 | 5;\n /** Invoked with each processed snapshot. */\n callback: (data: OrderBookData) => void;\n /** Invoked when the underlying socket's health changes. */\n onStatusChange?: (status: OrderBookConnectionStatus) => void;\n};\n\nexport type AggregatedOrderBookConnectionOptions = {\n /** Resolves the current network at subscribe time. */\n isTestnet: () => boolean;\n};\n\n// Fast mode streams 5 levels per side (slow mode streams 20). We run fast mode\n// for lower-latency ladder updates, so the book never carries more than this.\nconst DEFAULT_LEVELS = 5;\n\n/**\n * Transforms a raw Hyperliquid `l2Book` snapshot into the `OrderBookData` shape\n * the UI consumes. Mirrors the subscription service's internal\n * `processOrderBookData` so this dedicated connection is a drop-in replacement\n * for `subscribeToOrderBook` on the aggregated channel.\n *\n * @param data - Raw `l2Book` event.\n * @param levels - Number of levels per side to keep.\n * @returns Processed order-book snapshot.\n */\nexport function processAggregatedOrderBook(\n data: HyperliquidL2BookEvent,\n levels: number,\n): OrderBookData {\n const bidsRaw = data?.levels?.[0] ?? [];\n const asksRaw = data?.levels?.[1] ?? [];\n\n let bidCumulativeSize = 0;\n let bidCumulativeNotional = 0;\n const bids = bidsRaw.slice(0, levels).map((level) => {\n const price = Number.parseFloat(level.px);\n const size = Number.parseFloat(level.sz);\n const notional = price * size;\n bidCumulativeSize += size;\n bidCumulativeNotional += notional;\n return {\n price: level.px,\n size: level.sz,\n total: bidCumulativeSize.toString(),\n notional: notional.toFixed(2),\n totalNotional: bidCumulativeNotional.toFixed(2),\n };\n });\n\n let askCumulativeSize = 0;\n let askCumulativeNotional = 0;\n const asks = asksRaw.slice(0, levels).map((level) => {\n const price = Number.parseFloat(level.px);\n const size = Number.parseFloat(level.sz);\n const notional = price * size;\n askCumulativeSize += size;\n askCumulativeNotional += notional;\n return {\n price: level.px,\n size: level.sz,\n total: askCumulativeSize.toString(),\n notional: notional.toFixed(2),\n totalNotional: askCumulativeNotional.toFixed(2),\n };\n });\n\n const bestBid = bids[0];\n const bestAsk = asks[0];\n const bidPrice = bestBid ? Number.parseFloat(bestBid.price) : 0;\n const askPrice = bestAsk ? Number.parseFloat(bestAsk.price) : 0;\n const spread = askPrice > 0 && bidPrice > 0 ? askPrice - bidPrice : 0;\n const midPrice = askPrice > 0 && bidPrice > 0 ? (askPrice + bidPrice) / 2 : 0;\n const spreadPercentage =\n midPrice > 0 ? ((spread / midPrice) * 100).toFixed(4) : '0';\n const maxTotal = Math.max(bidCumulativeSize, askCumulativeSize).toString();\n\n return {\n bids,\n asks,\n spread: spread.toFixed(5),\n spreadPercentage,\n midPrice: midPrice.toFixed(5),\n lastUpdated: Date.now(),\n maxTotal,\n };\n}\n\n/**\n * Owns a dedicated Hyperliquid WebSocket connection used solely for the\n * order-book panel's server-aggregated `l2Book` subscription.\n *\n * The main connection (managed by the subscription service) multiplexes every\n * subscription onto a single socket. The Hyperliquid SDK dispatches `l2Book`\n * events by `coin` only, so running the raw (full-precision) and the aggregated\n * (`nSigFigs`) subscriptions for the same coin on that shared socket\n * cross-contaminates them — the coarse ladder and the precise spread/slippage\n * clobber each other. Giving the aggregated subscription its own socket removes\n * the collision entirely: this socket only ever carries a single `l2Book`\n * stream, and the main socket is never touched by the panel's grouping.\n *\n * The socket is created lazily on the first subscription and torn down once the\n * last subscription is removed, so it exists only while an order-book panel is\n * open. Because network is a global setting, the transport is recreated if\n * `isTestnet` changes between (re)subscriptions.\n */\nexport class AggregatedOrderBookConnection {\n readonly #isTestnet: () => boolean;\n\n #transport: WebSocketTransport | null = null;\n\n #transportIsTestnet = false;\n\n #activeCount = 0;\n\n // Tracks the single `l2Book` payload the dedicated socket carries per asset,\n // keyed by symbol. The SDK dispatches `l2Book` events by `coin` only, so two\n // subscriptions for the same asset with different params (e.g. `nSigFigs`)\n // would cross-contaminate on this shared socket — exactly the collision this\n // connection exists to avoid. `count` refcounts the (identical) subscriptions\n // sharing a payload so the entry is dropped once the last one unsubscribes.\n readonly #payloads = new Map<string, { signature: string; count: number }>();\n\n // Force-terminate callback for every currently-active subscription. When a\n // transport rebuild (`#closeTransport`) shuts the socket down out from under\n // live subscriptions, these tear each one down — notifying the caller and\n // releasing its SDK subscription / socket listeners — instead of orphaning\n // them (stale handle, no more updates, and no further status because\n // reporting is suppressed once `transport !== this.#transport`).\n readonly #activeSubscriptions = new Set<() => void>();\n\n // Set when the socket's auto-reconnection is exhausted (its\n // `terminationSignal` aborts). A terminated socket cannot recover, so the next\n // subscribe must build a fresh transport instead of reusing the dead one.\n #terminated = false;\n\n constructor({ isTestnet }: AggregatedOrderBookConnectionOptions) {\n this.#isTestnet = isTestnet;\n }\n\n /**\n * Opens an aggregated `l2Book` subscription on the dedicated socket.\n *\n * Mirrors the subscription service's synchronous-unsubscribe contract: the\n * returned function can be called before the async subscribe resolves and\n * will cancel the pending subscription.\n *\n * Only one `l2Book` payload per asset may be active at a time. Subscribing to\n * an asset that already has a live subscription with different params (e.g. a\n * different `nSigFigs` or `mantissa`) throws, because the shared socket\n * dispatches by `coin` and the conflicting streams would clobber each other.\n *\n * @param params - Subscription parameters.\n * @returns An unsubscribe function.\n * @throws If the asset already has an active subscription with different params.\n */\n subscribe(params: SubscribeAggregatedOrderBookParams): () => void {\n const levels = params.levels ?? DEFAULT_LEVELS;\n // The `l2Book` subscription params the socket carries. `levels` is\n // client-side only (it slices each snapshot), so it is deliberately excluded\n // from the params and their signature.\n const l2BookParams = {\n coin: params.symbol,\n nSigFigs: params.nSigFigs,\n mantissa: params.mantissa ?? null,\n fast: true as const,\n };\n const signature = JSON.stringify(l2BookParams);\n\n const transport = this.#ensureTransport(this.#isTestnet());\n\n // Reject a conflicting payload for an asset already on this socket. A\n // recreated transport (first use, network change, or terminate) starts with\n // an empty payload map, so this can only trip on the reuse path — the shared\n // socket that would actually suffer the collision.\n const existingPayload = this.#payloads.get(params.symbol);\n if (existingPayload && existingPayload.signature !== signature) {\n throw new Error(\n `AggregatedOrderBookConnection: \"${params.symbol}\" is already subscribed with different params; only one l2Book payload per asset is allowed on the dedicated socket.`,\n );\n }\n\n const { socket } = transport;\n\n let cancelled = false;\n let subscription: ISubscription | null = null;\n this.#activeCount += 1;\n if (existingPayload) {\n existingPayload.count += 1;\n } else {\n this.#payloads.set(params.symbol, { signature, count: 1 });\n }\n\n // Set once this subscription's socket terminates (reconnection exhausted).\n // The `error` state is terminal until teardown/resubscribe, so once set we\n // suppress any late `connected`/`connecting` — e.g. from a subscribe promise\n // that resolves *after* the socket died — which would otherwise flip the UI\n // back to a healthy state on a dead socket and hide the manual-reconnect\n // affordance.\n let terminated = false;\n const reportStatus = (status: OrderBookConnectionStatus): void => {\n // Suppress reports from a subscription that no longer drives the UI: it\n // was unsubscribed (`cancelled`), its transport was replaced by a network\n // flip or recreate (`transport !== this.#transport`, so its socket is\n // dead), or its socket permanently terminated and `error` is now sticky\n // until teardown (`terminated`).\n if (\n cancelled ||\n transport !== this.#transport ||\n (terminated && status !== 'error')\n ) {\n return;\n }\n params.onStatusChange?.(status);\n };\n\n // Reflect the socket's live health. Every drop dispatches a `close` event;\n // the reconnecting socket only exposes permanent termination through its\n // `terminationSignal` (an `AbortSignal`), which it aborts *before* the final\n // close. So an aborted signal on close — unless it was our own `close()`\n // (`TERMINATED_BY_USER`) — means automatic reconnection is exhausted: the\n // unrecoverable state the UI surfaces with a manual reconnect button. A\n // still-live signal means a transient drop the socket will auto-reconnect.\n const handleOpen = (): void => reportStatus('connected');\n const handleClose = (): void => {\n // A torn-down subscription must not mutate shared connection state. Its\n // listeners are normally detached before the socket closes, but guard\n // anyway so a late `close` (e.g. from `transport.close()` racing listener\n // removal) can't wrongly flip `#terminated`.\n if (cancelled) {\n return;\n }\n const { terminationSignal } = socket;\n const terminatedByUser =\n (terminationSignal.reason as { code?: string } | undefined)?.code ===\n 'TERMINATED_BY_USER';\n if (terminationSignal.aborted && !terminatedByUser) {\n this.#terminated = true;\n terminated = true;\n reportStatus('error');\n return;\n }\n reportStatus('connecting');\n };\n socket.addEventListener('open', handleOpen);\n socket.addEventListener('close', handleClose);\n\n const removeSocketListeners = (): void => {\n socket.removeEventListener('open', handleOpen);\n socket.removeEventListener('close', handleClose);\n };\n\n // Ends this subscription when its transport is torn down beneath it (network\n // flip, post-termination resubscribe, or `close()`). Unlike `teardown` it\n // leaves the shared refcount/payload state alone — `#closeTransport` clears\n // those wholesale — but still notifies the caller and releases this\n // subscription's resources so nothing leaks on the dead socket.\n const forceTerminate = (): void => {\n if (cancelled) {\n return;\n }\n // Notify directly rather than via `reportStatus`: `#closeTransport`\n // detaches `#transport` before invoking these callbacks (so a reentrant\n // subscribe from this handler builds a fresh transport instead of binding\n // to the dying one), which would otherwise trip `reportStatus`'s\n // stale-transport guard. A subscription whose socket already terminated\n // has reported `error`; a still-live one (abandoned by a network flip or\n // `close()`) needs the terminal signal so the caller stops trusting a\n // now-dead book.\n if (!terminated) {\n params.onStatusChange?.('error');\n }\n cancelled = true;\n removeSocketListeners();\n this.#activeSubscriptions.delete(forceTerminate);\n if (subscription) {\n subscription.unsubscribe().catch(() => undefined);\n subscription = null;\n }\n };\n this.#activeSubscriptions.add(forceTerminate);\n\n // Releases this subscription's refcount and tears down the socket once no\n // subscriptions remain. Idempotent via `cancelled`, so it's safe whether it\n // runs from the returned unsubscribe or from a failed subscribe.\n const teardown = (): void => {\n if (cancelled) {\n return;\n }\n cancelled = true;\n removeSocketListeners();\n this.#activeSubscriptions.delete(forceTerminate);\n if (subscription) {\n subscription.unsubscribe().catch(() => undefined);\n subscription = null;\n }\n // Only touch the refcount/current socket if this subscription still\n // belongs to the active transport. If the transport was recreated (network\n // change or terminate), this subscription's socket is already dead and\n // `#activeCount` now tracks only the new transport's subscriptions — so an\n // older unsubscribe must not decrement it and tear down the live socket.\n if (transport === this.#transport) {\n this.#activeCount = Math.max(0, this.#activeCount - 1);\n const entry = this.#payloads.get(params.symbol);\n if (entry) {\n entry.count -= 1;\n if (entry.count <= 0) {\n this.#payloads.delete(params.symbol);\n }\n }\n if (this.#activeCount === 0) {\n this.#closeTransport();\n }\n }\n };\n\n // Surfaces a subscription failure the same way regardless of when it\n // happens: report `error` (before teardown flips `cancelled`, which gates\n // status updates) then release the refcount so the dead subscription doesn't\n // keep the dedicated socket open. Used for both the initial subscribe\n // rejection (`.catch`) and post-confirmation failures the SDK reports only\n // through `onError` — e.g. the server rejecting the re-subscription after a\n // reconnect, which removes the listener and stops all further events (a\n // frozen order book that would otherwise still read as `connected`).\n // Idempotent via `teardown`'s `cancelled` guard.\n const handleSubscriptionError = (): void => {\n reportStatus('error');\n teardown();\n };\n\n reportStatus('connecting');\n\n // Subscribe through the typed `l2Book` client so the params are validated\n // before they reach the wire (`fast: true` requests fast mode — 5 levels at\n // ~0.5s). The listener receives the decoded snapshot directly.\n new SubscriptionClient({ transport })\n .l2Book(\n l2BookParams,\n (data: HyperliquidL2BookEvent) => {\n if (cancelled || data?.coin !== params.symbol || !data?.levels) {\n return;\n }\n params.callback(processAggregatedOrderBook(data, levels));\n },\n // `onError` fires at most once for an *already confirmed* subscription\n // that later fails (rejected re-subscription after reconnect, permanent\n // termination, or a drop while re-subscription is disabled). The SDK\n // removes the listener and emits nothing further, so treat it exactly\n // like an initial failure.\n { onError: handleSubscriptionError },\n )\n .then(async (sub) => {\n // Stale if this subscription was unsubscribed (`cancelled`) or its\n // transport was replaced (network flip / recreate) before the subscribe\n // settled — either way the captured socket is dead, so clean up the SDK\n // subscription instead of storing it or announcing `connected`.\n if (cancelled || transport !== this.#transport) {\n try {\n await sub.unsubscribe();\n } catch {\n // Ignore cleanup errors on an already-cancelled/stale subscription.\n }\n return undefined;\n }\n subscription = sub;\n reportStatus('connected');\n return undefined;\n })\n .catch(handleSubscriptionError);\n\n return teardown;\n }\n\n /** Closes the dedicated socket and drops all subscriptions. */\n close(): void {\n this.#closeTransport();\n }\n\n #ensureTransport(isTestnet: boolean): WebSocketTransport {\n if (\n this.#transport &&\n this.#transportIsTestnet === isTestnet &&\n !this.#terminated\n ) {\n return this.#transport;\n }\n // First use, the network changed, or the previous socket was terminated —\n // (re)create the dedicated transport. Reuse the package's transport config\n // so this socket shares the finite five-attempt reconnection policy; without\n // it the SDK defaults `maxRetries` to Infinity and a sustained outage would\n // never exhaust reconnection to reach the `error`/manual-reconnect state.\n this.#closeTransport();\n // `#closeTransport` notifies subscribers, which may synchronously re-enter\n // `subscribe` and build a matching transport. Reuse it instead of orphaning\n // it (which would leak the reentrant subscription on an unreferenced socket).\n if (\n this.#transport &&\n this.#transportIsTestnet === isTestnet &&\n !this.#terminated\n ) {\n return this.#transport;\n }\n const transport = new WebSocketTransport({\n isTestnet,\n ...HYPERLIQUID_TRANSPORT_CONFIG,\n reconnect: HYPERLIQUID_TRANSPORT_CONFIG.reconnect,\n });\n this.#transport = transport;\n this.#transportIsTestnet = isTestnet;\n return transport;\n }\n\n #closeTransport(): void {\n const transport = this.#transport;\n // Snapshot the subscriptions to force-terminate, then detach ALL shared\n // state (the set, `#transport`, refcounts) *before* invoking any callback.\n // Those callbacks notify subscribers via `onStatusChange`, which can\n // synchronously re-enter `subscribe`; detaching first guarantees a reentrant\n // subscribe builds a fresh transport (rather than reusing this dying one)\n // and registers itself in a clean set (rather than being swept up by, or\n // lingering past, this teardown). Subscriptions torn down normally have\n // already removed themselves, so their entry is a no-op here.\n const subscriptions = [...this.#activeSubscriptions];\n this.#activeSubscriptions.clear();\n this.#transport = null;\n this.#activeCount = 0;\n this.#payloads.clear();\n this.#terminated = false;\n // Force-terminate (which detaches each subscription's socket listeners)\n // BEFORE closing the transport. `close()` on an already-exhausted socket\n // dispatches a final `close`; if a stale `handleClose` were still attached\n // it would re-set `#terminated` right after we cleared it, making the next\n // `#ensureTransport` tear down the healthy replacement socket.\n for (const forceTerminate of subscriptions) {\n forceTerminate();\n }\n if (transport) {\n transport.close();\n }\n }\n}\n"]}
@@ -1,233 +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 _DataLakeService_instances, _DataLakeService_deps, _DataLakeService_messenger, _DataLakeService_getBearerToken;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.DataLakeService = void 0;
16
- const uuid_1 = require("uuid");
17
- const performanceMetrics_js_1 = require("../constants/performanceMetrics.cjs");
18
- const perpsConfig_js_1 = require("../constants/perpsConfig.cjs");
19
- const index_js_1 = require("../types/index.cjs");
20
- const accountUtils_js_1 = require("../utils/accountUtils.cjs");
21
- const errorUtils_js_1 = require("../utils/errorUtils.cjs");
22
- /**
23
- * DataLakeService
24
- *
25
- * Handles reporting order events to external Data Lake API.
26
- * Implements exponential backoff retry logic and performance tracing.
27
- * Stateless service that operates purely on external API calls.
28
- *
29
- * Instance-based service with constructor injection of platform dependencies.
30
- */
31
- class DataLakeService {
32
- /**
33
- * Create a new DataLakeService instance
34
- *
35
- * @param deps - Platform dependencies for logging, metrics, etc.
36
- * @param messenger - Controller messenger for cross-controller communication.
37
- */
38
- constructor(deps, messenger) {
39
- _DataLakeService_instances.add(this);
40
- _DataLakeService_deps.set(this, void 0);
41
- _DataLakeService_messenger.set(this, void 0);
42
- __classPrivateFieldSet(this, _DataLakeService_deps, deps, "f");
43
- __classPrivateFieldSet(this, _DataLakeService_messenger, messenger, "f");
44
- }
45
- /**
46
- * Report order events to data lake API with retry (non-blocking)
47
- * Implements exponential backoff retry logic (max 3 retries)
48
- *
49
- * @param options - Configuration object
50
- * @param options.action - Order action ('open' or 'close')
51
- * @param options.symbol - Market symbol
52
- * @param options.slPrice - Optional stop loss price.
53
- * @param options.tpPrice - Optional take profit price.
54
- * @param options.isTestnet - Whether this is a testnet operation (skips API call)
55
- * @param options.context - ServiceContext for dependencies (messenger, tracing)
56
- * @param options.retryCount - Internal retry counter (managed by service)
57
- * @param options._traceId - Internal trace ID (managed by service)
58
- * @returns Result object with success flag and optional error message
59
- */
60
- async reportOrder(options) {
61
- const { action, symbol, slPrice, tpPrice, isTestnet, context, retryCount = 0, _traceId, } = options;
62
- // Skip data lake reporting for testnet as the API doesn't handle testnet data
63
- if (isTestnet) {
64
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").debugLogger.log('DataLake API: Skipping for testnet', {
65
- action,
66
- symbol,
67
- network: 'testnet',
68
- });
69
- return { success: true, error: 'Skipped for testnet' };
70
- }
71
- const MAX_RETRIES = 3;
72
- const RETRY_DELAY_MS = 1000;
73
- // Generate trace ID once on first call
74
- const traceId = _traceId ?? (0, uuid_1.v4)();
75
- // Start trace only on first attempt
76
- if (retryCount === 0) {
77
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").tracer.trace({
78
- name: index_js_1.PerpsTraceNames.DataLakeReport,
79
- op: index_js_1.PerpsTraceOperations.Operation,
80
- id: traceId,
81
- tags: {
82
- action,
83
- symbol,
84
- provider: context.tracingContext.provider,
85
- isTestnet: String(context.tracingContext.isTestnet),
86
- },
87
- });
88
- }
89
- // Log the attempt
90
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").debugLogger.log('DataLake API: Starting order report', {
91
- action,
92
- symbol,
93
- attempt: retryCount + 1,
94
- maxAttempts: MAX_RETRIES + 1,
95
- hasStopLoss: Boolean(slPrice),
96
- hasTakeProfit: Boolean(tpPrice),
97
- timestamp: new Date().toISOString(),
98
- });
99
- const apiCallStartTime = __classPrivateFieldGet(this, _DataLakeService_deps, "f").performance.now();
100
- try {
101
- const token = await __classPrivateFieldGet(this, _DataLakeService_instances, "m", _DataLakeService_getBearerToken).call(this);
102
- const evmAccount = (0, accountUtils_js_1.getSelectedEvmAccountFromMessenger)(__classPrivateFieldGet(this, _DataLakeService_messenger, "f"));
103
- if (!evmAccount || !token) {
104
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").debugLogger.log('DataLake API: Missing requirements', {
105
- hasAccount: Boolean(evmAccount),
106
- hasToken: Boolean(token),
107
- action,
108
- symbol,
109
- });
110
- return { success: false, error: 'No account or token available' };
111
- }
112
- const response = await fetch(perpsConfig_js_1.DATA_LAKE_API_CONFIG.OrdersEndpoint, {
113
- method: 'POST',
114
- headers: {
115
- 'Content-Type': 'application/json',
116
- Authorization: `Bearer ${token}`,
117
- },
118
- body: JSON.stringify({
119
- user_id: evmAccount.address,
120
- symbol,
121
- sl_price: slPrice,
122
- tp_price: tpPrice,
123
- }),
124
- });
125
- if (!response.ok) {
126
- throw new Error(`DataLake API error: ${response.status}`);
127
- }
128
- // Consume response body (might be empty for 201, but good to check)
129
- const responseBody = await response.text();
130
- const apiCallDuration = __classPrivateFieldGet(this, _DataLakeService_deps, "f").performance.now() - apiCallStartTime;
131
- // Record measurement
132
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").tracer.setMeasurement(performanceMetrics_js_1.PerpsMeasurementName.PerpsDataLakeApiCall, apiCallDuration, 'millisecond');
133
- // Success logging
134
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").debugLogger.log('DataLake API: Order reported successfully', {
135
- action,
136
- symbol,
137
- status: response.status,
138
- attempt: retryCount + 1,
139
- responseBody: responseBody || 'empty',
140
- duration: `${apiCallDuration.toFixed(0)}ms`,
141
- });
142
- // End trace on success
143
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").tracer.endTrace({
144
- name: index_js_1.PerpsTraceNames.DataLakeReport,
145
- id: traceId,
146
- data: {
147
- success: true,
148
- retries: retryCount,
149
- },
150
- });
151
- return { success: true };
152
- }
153
- catch (error) {
154
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
155
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").logger.error((0, errorUtils_js_1.ensureError)(error, 'DataLakeService.reportOrder'), {
156
- tags: { feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName },
157
- context: {
158
- name: 'DataLakeService.reportOrder',
159
- data: {
160
- action,
161
- symbol,
162
- retryCount,
163
- willRetry: retryCount < MAX_RETRIES,
164
- },
165
- },
166
- });
167
- // Retry logic
168
- if (retryCount < MAX_RETRIES) {
169
- const retryDelay = RETRY_DELAY_MS * Math.pow(2, retryCount);
170
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").debugLogger.log('DataLake API: Scheduling retry', {
171
- retryIn: `${retryDelay}ms`,
172
- nextAttempt: retryCount + 2,
173
- action,
174
- symbol,
175
- });
176
- setTimeout(() => {
177
- this.reportOrder({
178
- action,
179
- symbol,
180
- slPrice,
181
- tpPrice,
182
- isTestnet,
183
- context,
184
- retryCount: retryCount + 1,
185
- _traceId: traceId,
186
- }).catch((_retryError) => {
187
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").logger.error((0, errorUtils_js_1.ensureError)(_retryError, 'DataLakeService.reportOrder'), {
188
- tags: { feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName },
189
- context: {
190
- name: 'DataLakeService.reportOrder',
191
- data: {
192
- operation: 'retry',
193
- retryCount: retryCount + 1,
194
- action,
195
- symbol,
196
- },
197
- },
198
- });
199
- });
200
- }, retryDelay);
201
- return { success: false, error: errorMessage };
202
- }
203
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").tracer.endTrace({
204
- name: index_js_1.PerpsTraceNames.DataLakeReport,
205
- id: traceId,
206
- data: {
207
- success: false,
208
- error: errorMessage,
209
- totalRetries: retryCount,
210
- },
211
- });
212
- __classPrivateFieldGet(this, _DataLakeService_deps, "f").logger.error((0, errorUtils_js_1.ensureError)(error, 'DataLakeService.reportOrder'), {
213
- tags: { feature: perpsConfig_js_1.PERPS_CONSTANTS.FeatureName },
214
- context: {
215
- name: 'DataLakeService.reportOrder',
216
- data: { operation: 'finalFailure', action, symbol, retryCount },
217
- },
218
- });
219
- return { success: false, error: errorMessage };
220
- }
221
- }
222
- }
223
- exports.DataLakeService = DataLakeService;
224
- _DataLakeService_deps = new WeakMap(), _DataLakeService_messenger = new WeakMap(), _DataLakeService_instances = new WeakSet(), _DataLakeService_getBearerToken =
225
- /**
226
- * Get bearer token via DI authentication controller
227
- *
228
- * @returns The bearer token string for API authentication.
229
- */
230
- async function _DataLakeService_getBearerToken() {
231
- return __classPrivateFieldGet(this, _DataLakeService_messenger, "f").call('AuthenticationController:getBearerToken');
232
- };
233
- //# sourceMappingURL=DataLakeService.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataLakeService.cjs","sourceRoot":"","sources":["../../src/services/DataLakeService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAoC;AAEpC,+EAA0E;AAC1E,iEAGqC;AACrC,iDAA0E;AAG1E,+DAA8E;AAC9E,2DAAqD;AAGrD;;;;;;;;GAQG;AACH,MAAa,eAAe;IAK1B;;;;;OAKG;IACH,YACE,IAA+B,EAC/B,SAAuC;;QAZhC,wCAAiC;QAEjC,6CAAyC;QAYhD,uBAAA,IAAI,yBAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,8BAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAWD;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,WAAW,CAAC,OASjB;QACC,MAAM,EACJ,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,GAAG,CAAC,EACd,QAAQ,GACT,GAAG,OAAO,CAAC;QAEZ,8EAA8E;QAC9E,IAAI,SAAS,EAAE,CAAC;YACd,uBAAA,IAAI,6BAAM,CAAC,WAAW,CAAC,GAAG,CAAC,oCAAoC,EAAE;gBAC/D,MAAM;gBACN,MAAM;gBACN,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;QACzD,CAAC;QAED,MAAM,WAAW,GAAG,CAAC,CAAC;QACtB,MAAM,cAAc,GAAG,IAAI,CAAC;QAE5B,uCAAuC;QACvC,MAAM,OAAO,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;YAEF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QACjD,CAAC;IACH,CAAC;CACF;AAnQD,0CAmQC;;AAhPC;;;;GAIG;AACH,KAAK;IACH,OAAO,uBAAA,IAAI,kCAAW,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\n\nimport { PerpsMeasurementName } from '../constants/performanceMetrics.js';\nimport {\n DATA_LAKE_API_CONFIG,\n PERPS_CONSTANTS,\n} from '../constants/perpsConfig.js';\nimport { PerpsTraceNames, PerpsTraceOperations } from '../types/index.js';\nimport type { PerpsPlatformDependencies } from '../types/index.js';\nimport type { PerpsControllerMessengerBase } from '../types/messenger.js';\nimport { getSelectedEvmAccountFromMessenger } from '../utils/accountUtils.js';\nimport { ensureError } from '../utils/errorUtils.js';\nimport type { ServiceContext } from './ServiceContext.js';\n\n/**\n * DataLakeService\n *\n * Handles reporting order events to external Data Lake API.\n * Implements exponential backoff retry logic and performance tracing.\n * Stateless service that operates purely on external API calls.\n *\n * Instance-based service with constructor injection of platform dependencies.\n */\nexport class DataLakeService {\n readonly #deps: PerpsPlatformDependencies;\n\n readonly #messenger: PerpsControllerMessengerBase;\n\n /**\n * Create a new DataLakeService instance\n *\n * @param deps - Platform dependencies for logging, metrics, etc.\n * @param messenger - Controller messenger for cross-controller communication.\n */\n constructor(\n deps: PerpsPlatformDependencies,\n messenger: PerpsControllerMessengerBase,\n ) {\n this.#deps = deps;\n this.#messenger = messenger;\n }\n\n /**\n * Get bearer token via DI authentication controller\n *\n * @returns The bearer token string for API authentication.\n */\n async #getBearerToken(): Promise<string> {\n return this.#messenger.call('AuthenticationController:getBearerToken');\n }\n\n /**\n * Report order events to data lake API with retry (non-blocking)\n * Implements exponential backoff retry logic (max 3 retries)\n *\n * @param options - Configuration object\n * @param options.action - Order action ('open' or 'close')\n * @param options.symbol - Market symbol\n * @param options.slPrice - Optional stop loss price.\n * @param options.tpPrice - Optional take profit price.\n * @param options.isTestnet - Whether this is a testnet operation (skips API call)\n * @param options.context - ServiceContext for dependencies (messenger, tracing)\n * @param options.retryCount - Internal retry counter (managed by service)\n * @param options._traceId - Internal trace ID (managed by service)\n * @returns Result object with success flag and optional error message\n */\n async reportOrder(options: {\n action: 'open' | 'close';\n symbol: string;\n slPrice?: number;\n tpPrice?: number;\n isTestnet: boolean;\n context: ServiceContext;\n retryCount?: number;\n _traceId?: string;\n }): Promise<{ success: boolean; error?: string }> {\n const {\n action,\n symbol,\n slPrice,\n tpPrice,\n isTestnet,\n context,\n retryCount = 0,\n _traceId,\n } = options;\n\n // Skip data lake reporting for testnet as the API doesn't handle testnet data\n if (isTestnet) {\n this.#deps.debugLogger.log('DataLake API: Skipping for testnet', {\n action,\n symbol,\n network: 'testnet',\n });\n return { success: true, error: 'Skipped for testnet' };\n }\n\n const MAX_RETRIES = 3;\n const RETRY_DELAY_MS = 1000;\n\n // Generate trace ID once on first call\n const traceId = _traceId ?? uuidv4();\n\n // Start trace only on first attempt\n if (retryCount === 0) {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.DataLakeReport,\n op: PerpsTraceOperations.Operation,\n id: traceId,\n tags: {\n action,\n symbol,\n provider: context.tracingContext.provider,\n isTestnet: String(context.tracingContext.isTestnet),\n },\n });\n }\n\n // Log the attempt\n this.#deps.debugLogger.log('DataLake API: Starting order report', {\n action,\n symbol,\n attempt: retryCount + 1,\n maxAttempts: MAX_RETRIES + 1,\n hasStopLoss: Boolean(slPrice),\n hasTakeProfit: Boolean(tpPrice),\n timestamp: new Date().toISOString(),\n });\n\n const apiCallStartTime = this.#deps.performance.now();\n\n try {\n const token = await this.#getBearerToken();\n const evmAccount = getSelectedEvmAccountFromMessenger(this.#messenger);\n\n if (!evmAccount || !token) {\n this.#deps.debugLogger.log('DataLake API: Missing requirements', {\n hasAccount: Boolean(evmAccount),\n hasToken: Boolean(token),\n action,\n symbol,\n });\n return { success: false, error: 'No account or token available' };\n }\n\n const response = await fetch(DATA_LAKE_API_CONFIG.OrdersEndpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n user_id: evmAccount.address,\n symbol,\n sl_price: slPrice,\n tp_price: tpPrice,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`DataLake API error: ${response.status}`);\n }\n\n // Consume response body (might be empty for 201, but good to check)\n const responseBody = await response.text();\n\n const apiCallDuration = this.#deps.performance.now() - apiCallStartTime;\n\n // Record measurement\n this.#deps.tracer.setMeasurement(\n PerpsMeasurementName.PerpsDataLakeApiCall,\n apiCallDuration,\n 'millisecond',\n );\n\n // Success logging\n this.#deps.debugLogger.log('DataLake API: Order reported successfully', {\n action,\n symbol,\n status: response.status,\n attempt: retryCount + 1,\n responseBody: responseBody || 'empty',\n duration: `${apiCallDuration.toFixed(0)}ms`,\n });\n\n // End trace on success\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.DataLakeReport,\n id: traceId,\n data: {\n success: true,\n retries: retryCount,\n },\n });\n\n return { success: true };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error';\n\n this.#deps.logger.error(\n ensureError(error, 'DataLakeService.reportOrder'),\n {\n tags: { feature: PERPS_CONSTANTS.FeatureName },\n context: {\n name: 'DataLakeService.reportOrder',\n data: {\n action,\n symbol,\n retryCount,\n willRetry: retryCount < MAX_RETRIES,\n },\n },\n },\n );\n\n // Retry logic\n if (retryCount < MAX_RETRIES) {\n const retryDelay = RETRY_DELAY_MS * Math.pow(2, retryCount);\n this.#deps.debugLogger.log('DataLake API: Scheduling retry', {\n retryIn: `${retryDelay}ms`,\n nextAttempt: retryCount + 2,\n action,\n symbol,\n });\n\n setTimeout(() => {\n this.reportOrder({\n action,\n symbol,\n slPrice,\n tpPrice,\n isTestnet,\n context,\n retryCount: retryCount + 1,\n _traceId: traceId,\n }).catch((_retryError) => {\n this.#deps.logger.error(\n ensureError(_retryError, 'DataLakeService.reportOrder'),\n {\n tags: { feature: PERPS_CONSTANTS.FeatureName },\n context: {\n name: 'DataLakeService.reportOrder',\n data: {\n operation: 'retry',\n retryCount: retryCount + 1,\n action,\n symbol,\n },\n },\n },\n );\n });\n }, retryDelay);\n\n return { success: false, error: errorMessage };\n }\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.DataLakeReport,\n id: traceId,\n data: {\n success: false,\n error: errorMessage,\n totalRetries: retryCount,\n },\n });\n\n this.#deps.logger.error(\n ensureError(error, 'DataLakeService.reportOrder'),\n {\n tags: { feature: PERPS_CONSTANTS.FeatureName },\n context: {\n name: 'DataLakeService.reportOrder',\n data: { operation: 'finalFailure', action, symbol, retryCount },\n },\n },\n );\n\n return { success: false, error: errorMessage };\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataLakeService.d.cts","sourceRoot":"","sources":["../../src/services/DataLakeService.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,yBAAyB,EAAE,2BAA0B;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,+BAA8B;AAG1E,OAAO,KAAK,EAAE,cAAc,EAAE,6BAA4B;AAE1D;;;;;;;;GAQG;AACH,qBAAa,eAAe;;IAK1B;;;;;OAKG;gBAED,IAAI,EAAE,yBAAyB,EAC/B,SAAS,EAAE,4BAA4B;IAezC;;;;;;;;;;;;;;OAcG;IACG,WAAW,CAAC,OAAO,EAAE;QACzB,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,EAAE,cAAc,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CA+MlD"}
@@ -1,51 +0,0 @@
1
- import type { PerpsPlatformDependencies } from "../types/index.mjs";
2
- import type { PerpsControllerMessengerBase } from "../types/messenger.mjs";
3
- import type { ServiceContext } from "./ServiceContext.mjs";
4
- /**
5
- * DataLakeService
6
- *
7
- * Handles reporting order events to external Data Lake API.
8
- * Implements exponential backoff retry logic and performance tracing.
9
- * Stateless service that operates purely on external API calls.
10
- *
11
- * Instance-based service with constructor injection of platform dependencies.
12
- */
13
- export declare class DataLakeService {
14
- #private;
15
- /**
16
- * Create a new DataLakeService instance
17
- *
18
- * @param deps - Platform dependencies for logging, metrics, etc.
19
- * @param messenger - Controller messenger for cross-controller communication.
20
- */
21
- constructor(deps: PerpsPlatformDependencies, messenger: PerpsControllerMessengerBase);
22
- /**
23
- * Report order events to data lake API with retry (non-blocking)
24
- * Implements exponential backoff retry logic (max 3 retries)
25
- *
26
- * @param options - Configuration object
27
- * @param options.action - Order action ('open' or 'close')
28
- * @param options.symbol - Market symbol
29
- * @param options.slPrice - Optional stop loss price.
30
- * @param options.tpPrice - Optional take profit price.
31
- * @param options.isTestnet - Whether this is a testnet operation (skips API call)
32
- * @param options.context - ServiceContext for dependencies (messenger, tracing)
33
- * @param options.retryCount - Internal retry counter (managed by service)
34
- * @param options._traceId - Internal trace ID (managed by service)
35
- * @returns Result object with success flag and optional error message
36
- */
37
- reportOrder(options: {
38
- action: 'open' | 'close';
39
- symbol: string;
40
- slPrice?: number;
41
- tpPrice?: number;
42
- isTestnet: boolean;
43
- context: ServiceContext;
44
- retryCount?: number;
45
- _traceId?: string;
46
- }): Promise<{
47
- success: boolean;
48
- error?: string;
49
- }>;
50
- }
51
- //# sourceMappingURL=DataLakeService.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataLakeService.d.mts","sourceRoot":"","sources":["../../src/services/DataLakeService.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,E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E,KAAK,EAAE,YAAY,EAAE,CAAC;YACjD,CAAC;YAED,uBAAA,IAAI,6BAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACzB,IAAI,EAAE,eAAe,CAAC,cAAc;gBACpC,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE;oBACJ,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,YAAY;oBACnB,YAAY,EAAE,UAAU;iBACzB;aACF,CAAC,CAAC;YAEH,uBAAA,IAAI,6BAAM,CAAC,MAAM,CAAC,KAAK,CACrB,WAAW,CAAC,KAAK,EAAE,6BAA6B,CAAC,EACjD;gBACE,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE;gBAC9C,OAAO,EAAE;oBACP,IAAI,EAAE,6BAA6B;oBACnC,IAAI,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;iBAChE;aACF,CACF,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QACjD,CAAC;IACH,CAAC;CACF;;AAhPC;;;;GAIG;AACH,KAAK;IACH,OAAO,uBAAA,IAAI,kCAAW,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import { v4 as uuidv4 } from 'uuid';\n\nimport { PerpsMeasurementName } from '../constants/performanceMetrics.js';\nimport {\n DATA_LAKE_API_CONFIG,\n PERPS_CONSTANTS,\n} from '../constants/perpsConfig.js';\nimport { PerpsTraceNames, PerpsTraceOperations } from '../types/index.js';\nimport type { PerpsPlatformDependencies } from '../types/index.js';\nimport type { PerpsControllerMessengerBase } from '../types/messenger.js';\nimport { getSelectedEvmAccountFromMessenger } from '../utils/accountUtils.js';\nimport { ensureError } from '../utils/errorUtils.js';\nimport type { ServiceContext } from './ServiceContext.js';\n\n/**\n * DataLakeService\n *\n * Handles reporting order events to external Data Lake API.\n * Implements exponential backoff retry logic and performance tracing.\n * Stateless service that operates purely on external API calls.\n *\n * Instance-based service with constructor injection of platform dependencies.\n */\nexport class DataLakeService {\n readonly #deps: PerpsPlatformDependencies;\n\n readonly #messenger: PerpsControllerMessengerBase;\n\n /**\n * Create a new DataLakeService instance\n *\n * @param deps - Platform dependencies for logging, metrics, etc.\n * @param messenger - Controller messenger for cross-controller communication.\n */\n constructor(\n deps: PerpsPlatformDependencies,\n messenger: PerpsControllerMessengerBase,\n ) {\n this.#deps = deps;\n this.#messenger = messenger;\n }\n\n /**\n * Get bearer token via DI authentication controller\n *\n * @returns The bearer token string for API authentication.\n */\n async #getBearerToken(): Promise<string> {\n return this.#messenger.call('AuthenticationController:getBearerToken');\n }\n\n /**\n * Report order events to data lake API with retry (non-blocking)\n * Implements exponential backoff retry logic (max 3 retries)\n *\n * @param options - Configuration object\n * @param options.action - Order action ('open' or 'close')\n * @param options.symbol - Market symbol\n * @param options.slPrice - Optional stop loss price.\n * @param options.tpPrice - Optional take profit price.\n * @param options.isTestnet - Whether this is a testnet operation (skips API call)\n * @param options.context - ServiceContext for dependencies (messenger, tracing)\n * @param options.retryCount - Internal retry counter (managed by service)\n * @param options._traceId - Internal trace ID (managed by service)\n * @returns Result object with success flag and optional error message\n */\n async reportOrder(options: {\n action: 'open' | 'close';\n symbol: string;\n slPrice?: number;\n tpPrice?: number;\n isTestnet: boolean;\n context: ServiceContext;\n retryCount?: number;\n _traceId?: string;\n }): Promise<{ success: boolean; error?: string }> {\n const {\n action,\n symbol,\n slPrice,\n tpPrice,\n isTestnet,\n context,\n retryCount = 0,\n _traceId,\n } = options;\n\n // Skip data lake reporting for testnet as the API doesn't handle testnet data\n if (isTestnet) {\n this.#deps.debugLogger.log('DataLake API: Skipping for testnet', {\n action,\n symbol,\n network: 'testnet',\n });\n return { success: true, error: 'Skipped for testnet' };\n }\n\n const MAX_RETRIES = 3;\n const RETRY_DELAY_MS = 1000;\n\n // Generate trace ID once on first call\n const traceId = _traceId ?? uuidv4();\n\n // Start trace only on first attempt\n if (retryCount === 0) {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.DataLakeReport,\n op: PerpsTraceOperations.Operation,\n id: traceId,\n tags: {\n action,\n symbol,\n provider: context.tracingContext.provider,\n isTestnet: String(context.tracingContext.isTestnet),\n },\n });\n }\n\n // Log the attempt\n this.#deps.debugLogger.log('DataLake API: Starting order report', {\n action,\n symbol,\n attempt: retryCount + 1,\n maxAttempts: MAX_RETRIES + 1,\n hasStopLoss: Boolean(slPrice),\n hasTakeProfit: Boolean(tpPrice),\n timestamp: new Date().toISOString(),\n });\n\n const apiCallStartTime = this.#deps.performance.now();\n\n try {\n const token = await this.#getBearerToken();\n const evmAccount = getSelectedEvmAccountFromMessenger(this.#messenger);\n\n if (!evmAccount || !token) {\n this.#deps.debugLogger.log('DataLake API: Missing requirements', {\n hasAccount: Boolean(evmAccount),\n hasToken: Boolean(token),\n action,\n symbol,\n });\n return { success: false, error: 'No account or token available' };\n }\n\n const response = await fetch(DATA_LAKE_API_CONFIG.OrdersEndpoint, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n user_id: evmAccount.address,\n symbol,\n sl_price: slPrice,\n tp_price: tpPrice,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`DataLake API error: ${response.status}`);\n }\n\n // Consume response body (might be empty for 201, but good to check)\n const responseBody = await response.text();\n\n const apiCallDuration = this.#deps.performance.now() - apiCallStartTime;\n\n // Record measurement\n this.#deps.tracer.setMeasurement(\n PerpsMeasurementName.PerpsDataLakeApiCall,\n apiCallDuration,\n 'millisecond',\n );\n\n // Success logging\n this.#deps.debugLogger.log('DataLake API: Order reported successfully', {\n action,\n symbol,\n status: response.status,\n attempt: retryCount + 1,\n responseBody: responseBody || 'empty',\n duration: `${apiCallDuration.toFixed(0)}ms`,\n });\n\n // End trace on success\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.DataLakeReport,\n id: traceId,\n data: {\n success: true,\n retries: retryCount,\n },\n });\n\n return { success: true };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error';\n\n this.#deps.logger.error(\n ensureError(error, 'DataLakeService.reportOrder'),\n {\n tags: { feature: PERPS_CONSTANTS.FeatureName },\n context: {\n name: 'DataLakeService.reportOrder',\n data: {\n action,\n symbol,\n retryCount,\n willRetry: retryCount < MAX_RETRIES,\n },\n },\n },\n );\n\n // Retry logic\n if (retryCount < MAX_RETRIES) {\n const retryDelay = RETRY_DELAY_MS * Math.pow(2, retryCount);\n this.#deps.debugLogger.log('DataLake API: Scheduling retry', {\n retryIn: `${retryDelay}ms`,\n nextAttempt: retryCount + 2,\n action,\n symbol,\n });\n\n setTimeout(() => {\n this.reportOrder({\n action,\n symbol,\n slPrice,\n tpPrice,\n isTestnet,\n context,\n retryCount: retryCount + 1,\n _traceId: traceId,\n }).catch((_retryError) => {\n this.#deps.logger.error(\n ensureError(_retryError, 'DataLakeService.reportOrder'),\n {\n tags: { feature: PERPS_CONSTANTS.FeatureName },\n context: {\n name: 'DataLakeService.reportOrder',\n data: {\n operation: 'retry',\n retryCount: retryCount + 1,\n action,\n symbol,\n },\n },\n },\n );\n });\n }, retryDelay);\n\n return { success: false, error: errorMessage };\n }\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.DataLakeReport,\n id: traceId,\n data: {\n success: false,\n error: errorMessage,\n totalRetries: retryCount,\n },\n });\n\n this.#deps.logger.error(\n ensureError(error, 'DataLakeService.reportOrder'),\n {\n tags: { feature: PERPS_CONSTANTS.FeatureName },\n context: {\n name: 'DataLakeService.reportOrder',\n data: { operation: 'finalFailure', action, symbol, retryCount },\n },\n },\n );\n\n return { success: false, error: errorMessage };\n }\n }\n}\n"]}
@@ -1,99 +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 _DepositService_deps, _DepositService_messenger;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.DepositService = void 0;
16
- const controller_utils_1 = require("@metamask/controller-utils");
17
- const utils_1 = require("@metamask/utils");
18
- const hyperLiquidConfig_js_1 = require("../constants/hyperLiquidConfig.cjs");
19
- const accountUtils_js_1 = require("../utils/accountUtils.cjs");
20
- const idUtils_js_1 = require("../utils/idUtils.cjs");
21
- const transferData_js_1 = require("../utils/transferData.cjs");
22
- // Temporary to avoid estimation failures due to insufficient balance
23
- const DEPOSIT_GAS_LIMIT = (0, controller_utils_1.toHex)(hyperLiquidConfig_js_1.DEPOSIT_CONFIG.EstimatedGasLimit);
24
- /**
25
- * DepositService
26
- *
27
- * Handles deposit transaction preparation and validation.
28
- * Stateless service that prepares transaction data for TransactionController.
29
- * Controller handles TransactionController integration and promise lifecycle.
30
- *
31
- * Instance-based service with constructor injection of platform dependencies
32
- * and messenger for inter-controller communication.
33
- */
34
- class DepositService {
35
- /**
36
- * Create a new DepositService instance
37
- *
38
- * @param deps - Platform dependencies for logging, metrics, etc.
39
- * @param messenger - Controller messenger for cross-controller communication.
40
- */
41
- constructor(deps, messenger) {
42
- _DepositService_deps.set(this, void 0);
43
- _DepositService_messenger.set(this, void 0);
44
- __classPrivateFieldSet(this, _DepositService_deps, deps, "f");
45
- __classPrivateFieldSet(this, _DepositService_messenger, messenger, "f");
46
- }
47
- /**
48
- * Prepare deposit transaction for confirmation
49
- * Extracts transaction construction logic from controller
50
- *
51
- * @param options - Configuration object
52
- * @param options.provider - Active provider instance
53
- * @returns Transaction data ready for TransactionController.addTransaction
54
- */
55
- async prepareTransaction(options) {
56
- const { provider } = options;
57
- __classPrivateFieldGet(this, _DepositService_deps, "f").debugLogger.log('DepositService: Preparing deposit transaction');
58
- // Generate deposit request ID for tracking
59
- const currentDepositId = (0, idUtils_js_1.generateDepositId)();
60
- // Get deposit routes from provider
61
- const depositRoutes = provider.getDepositRoutes({ isTestnet: false });
62
- const route = depositRoutes[0];
63
- const bridgeContractAddress = route.contractAddress;
64
- // Generate transfer data for ERC-20 token transfer (portable, no mobile imports)
65
- const transferData = (0, transferData_js_1.generateERC20TransferData)(bridgeContractAddress, '0x0');
66
- // Get EVM account from selected account, falling back to the selected account group.
67
- const evmAccount = (0, accountUtils_js_1.getSelectedEvmAccountFromMessenger)(__classPrivateFieldGet(this, _DepositService_messenger, "f"));
68
- if (!evmAccount) {
69
- throw new Error('No EVM-compatible account found in selected account group');
70
- }
71
- const accountAddress = evmAccount.address;
72
- // Parse CAIP asset ID to extract chain ID and token address
73
- const parsedAsset = (0, utils_1.parseCaipAssetId)(route.assetId);
74
- const assetChainId = (0, controller_utils_1.toHex)(parsedAsset.chainId.split(':')[1]);
75
- const tokenAddress = parsedAsset.assetReference;
76
- // Build transaction parameters for TransactionController
77
- const transaction = {
78
- from: accountAddress,
79
- to: tokenAddress,
80
- value: '0x0',
81
- data: transferData,
82
- gas: DEPOSIT_GAS_LIMIT,
83
- };
84
- __classPrivateFieldGet(this, _DepositService_deps, "f").debugLogger.log('DepositService: Deposit transaction prepared', {
85
- depositId: currentDepositId,
86
- assetChainId,
87
- from: accountAddress,
88
- to: tokenAddress,
89
- });
90
- return {
91
- transaction,
92
- assetChainId,
93
- currentDepositId,
94
- };
95
- }
96
- }
97
- exports.DepositService = DepositService;
98
- _DepositService_deps = new WeakMap(), _DepositService_messenger = new WeakMap();
99
- //# sourceMappingURL=DepositService.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DepositService.cjs","sourceRoot":"","sources":["../../src/services/DepositService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,2CAAmD;AAGnD,6EAAmE;AAOnE,+DAA8E;AAC9E,qDAAwD;AACxD,+DAAqE;AAErE,qEAAqE;AACrE,MAAM,iBAAiB,GAAG,IAAA,wBAAK,EAAC,qCAAc,CAAC,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAa,cAAc;IAKzB;;;;;OAKG;IACH,YACE,IAA+B,EAC/B,SAAuC;QAZhC,uCAAiC;QAEjC,4CAAyC;QAYhD,uBAAA,IAAI,wBAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,6BAAc,SAAS,MAAA,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAoC;QAK3D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7B,uBAAA,IAAI,4BAAM,CAAC,WAAW,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;QAE5E,2CAA2C;QAC3C,MAAM,gBAAgB,GAAG,IAAA,8BAAiB,GAAE,CAAC;QAE7C,mCAAmC;QACnC,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QACtE,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,qBAAqB,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,iFAAiF;QACjF,MAAM,YAAY,GAAG,IAAA,2CAAyB,EAC5C,qBAAqB,EACrB,KAAK,CACN,CAAC;QAEF,qFAAqF;QACrF,MAAM,UAAU,GAAG,IAAA,oDAAkC,EAAC,uBAAA,IAAI,iCAAW,CAAC,CAAC;QACvE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;QACJ,CAAC;QACD,MAAM,cAAc,GAAG,UAAU,CAAC,OAAc,CAAC;QAEjD,4DAA4D;QAC5D,MAAM,WAAW,GAAG,IAAA,wBAAgB,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,YAAY,GAAG,IAAA,wBAAK,EAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,WAAW,CAAC,cAAqB,CAAC;QAEvD,yDAAyD;QACzD,MAAM,WAAW,GAA2B;YAC1C,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,YAAY;YAChB,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,iBAAiB;SACvB,CAAC;QAEF,uBAAA,IAAI,4BAAM,CAAC,WAAW,CAAC,GAAG,CAAC,8CAA8C,EAAE;YACzE,SAAS,EAAE,gBAAgB;YAC3B,YAAY;YACZ,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,YAAY;SACjB,CAAC,CAAC;QAEH,OAAO;YACL,WAAW;YACX,YAAY;YACZ,gBAAgB;SACjB,CAAC;IACJ,CAAC;CACF;AAtFD,wCAsFC","sourcesContent":["import { toHex } from '@metamask/controller-utils';\nimport { parseCaipAssetId } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { DEPOSIT_CONFIG } from '../constants/hyperLiquidConfig.js';\nimport type {\n PerpsProvider,\n PerpsPlatformDependencies,\n PerpsTransactionParams,\n} from '../types/index.js';\nimport type { PerpsControllerMessengerBase } from '../types/messenger.js';\nimport { getSelectedEvmAccountFromMessenger } from '../utils/accountUtils.js';\nimport { generateDepositId } from '../utils/idUtils.js';\nimport { generateERC20TransferData } from '../utils/transferData.js';\n\n// Temporary to avoid estimation failures due to insufficient balance\nconst DEPOSIT_GAS_LIMIT = toHex(DEPOSIT_CONFIG.EstimatedGasLimit);\n\n/**\n * DepositService\n *\n * Handles deposit transaction preparation and validation.\n * Stateless service that prepares transaction data for TransactionController.\n * Controller handles TransactionController integration and promise lifecycle.\n *\n * Instance-based service with constructor injection of platform dependencies\n * and messenger for inter-controller communication.\n */\nexport class DepositService {\n readonly #deps: PerpsPlatformDependencies;\n\n readonly #messenger: PerpsControllerMessengerBase;\n\n /**\n * Create a new DepositService instance\n *\n * @param deps - Platform dependencies for logging, metrics, etc.\n * @param messenger - Controller messenger for cross-controller communication.\n */\n constructor(\n deps: PerpsPlatformDependencies,\n messenger: PerpsControllerMessengerBase,\n ) {\n this.#deps = deps;\n this.#messenger = messenger;\n }\n\n /**\n * Prepare deposit transaction for confirmation\n * Extracts transaction construction logic from controller\n *\n * @param options - Configuration object\n * @param options.provider - Active provider instance\n * @returns Transaction data ready for TransactionController.addTransaction\n */\n async prepareTransaction(options: { provider: PerpsProvider }): Promise<{\n transaction: PerpsTransactionParams;\n assetChainId: Hex;\n currentDepositId: string;\n }> {\n const { provider } = options;\n\n this.#deps.debugLogger.log('DepositService: Preparing deposit transaction');\n\n // Generate deposit request ID for tracking\n const currentDepositId = generateDepositId();\n\n // Get deposit routes from provider\n const depositRoutes = provider.getDepositRoutes({ isTestnet: false });\n const route = depositRoutes[0];\n const bridgeContractAddress = route.contractAddress;\n\n // Generate transfer data for ERC-20 token transfer (portable, no mobile imports)\n const transferData = generateERC20TransferData(\n bridgeContractAddress,\n '0x0',\n );\n\n // Get EVM account from selected account, falling back to the selected account group.\n const evmAccount = getSelectedEvmAccountFromMessenger(this.#messenger);\n if (!evmAccount) {\n throw new Error(\n 'No EVM-compatible account found in selected account group',\n );\n }\n const accountAddress = evmAccount.address as Hex;\n\n // Parse CAIP asset ID to extract chain ID and token address\n const parsedAsset = parseCaipAssetId(route.assetId);\n const assetChainId = toHex(parsedAsset.chainId.split(':')[1]);\n const tokenAddress = parsedAsset.assetReference as Hex;\n\n // Build transaction parameters for TransactionController\n const transaction: PerpsTransactionParams = {\n from: accountAddress,\n to: tokenAddress,\n value: '0x0',\n data: transferData,\n gas: DEPOSIT_GAS_LIMIT,\n };\n\n this.#deps.debugLogger.log('DepositService: Deposit transaction prepared', {\n depositId: currentDepositId,\n assetChainId,\n from: accountAddress,\n to: tokenAddress,\n });\n\n return {\n transaction,\n assetChainId,\n currentDepositId,\n };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DepositService.d.cts","sourceRoot":"","sources":["../../src/services/DepositService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAG3C,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,sBAAsB,EACvB,2BAA0B;AAC3B,OAAO,KAAK,EAAE,4BAA4B,EAAE,+BAA8B;AAQ1E;;;;;;;;;GASG;AACH,qBAAa,cAAc;;IAKzB;;;;;OAKG;gBAED,IAAI,EAAE,yBAAyB,EAC/B,SAAS,EAAE,4BAA4B;IAMzC;;;;;;;OAOG;IACG,kBAAkB,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAA;KAAE,GAAG,OAAO,CAAC;QACtE,WAAW,EAAE,sBAAsB,CAAC;QACpC,YAAY,EAAE,GAAG,CAAC;QAClB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CAuDH"}
@@ -1,39 +0,0 @@
1
- import type { Hex } from "@metamask/utils";
2
- import type { PerpsProvider, PerpsPlatformDependencies, PerpsTransactionParams } from "../types/index.mjs";
3
- import type { PerpsControllerMessengerBase } from "../types/messenger.mjs";
4
- /**
5
- * DepositService
6
- *
7
- * Handles deposit transaction preparation and validation.
8
- * Stateless service that prepares transaction data for TransactionController.
9
- * Controller handles TransactionController integration and promise lifecycle.
10
- *
11
- * Instance-based service with constructor injection of platform dependencies
12
- * and messenger for inter-controller communication.
13
- */
14
- export declare class DepositService {
15
- #private;
16
- /**
17
- * Create a new DepositService instance
18
- *
19
- * @param deps - Platform dependencies for logging, metrics, etc.
20
- * @param messenger - Controller messenger for cross-controller communication.
21
- */
22
- constructor(deps: PerpsPlatformDependencies, messenger: PerpsControllerMessengerBase);
23
- /**
24
- * Prepare deposit transaction for confirmation
25
- * Extracts transaction construction logic from controller
26
- *
27
- * @param options - Configuration object
28
- * @param options.provider - Active provider instance
29
- * @returns Transaction data ready for TransactionController.addTransaction
30
- */
31
- prepareTransaction(options: {
32
- provider: PerpsProvider;
33
- }): Promise<{
34
- transaction: PerpsTransactionParams;
35
- assetChainId: Hex;
36
- currentDepositId: string;
37
- }>;
38
- }
39
- //# sourceMappingURL=DepositService.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DepositService.d.mts","sourceRoot":"","sources":["../../src/services/DepositService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAG3C,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,sBAAsB,EACvB,2BAA0B;AAC3B,OAAO,KAAK,EAAE,4BAA4B,EAAE,+BAA8B;AAQ1E;;;;;;;;;GASG;AACH,qBAAa,cAAc;;IAKzB;;;;;OAKG;gBAED,IAAI,EAAE,yBAAyB,EAC/B,SAAS,EAAE,4BAA4B;IAMzC;;;;;;;OAOG;IACG,kBAAkB,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAA;KAAE,GAAG,OAAO,CAAC;QACtE,WAAW,EAAE,sBAAsB,CAAC;QACpC,YAAY,EAAE,GAAG,CAAC;QAClB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CAuDH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DepositService.mjs","sourceRoot":"","sources":["../../src/services/DepositService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,mCAAmC;AACnD,OAAO,EAAE,gBAAgB,EAAE,wBAAwB;AAGnD,OAAO,EA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OAAc,CAAC;QAEjD,4DAA4D;QAC5D,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,WAAW,CAAC,cAAqB,CAAC;QAEvD,yDAAyD;QACzD,MAAM,WAAW,GAA2B;YAC1C,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,YAAY;YAChB,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,iBAAiB;SACvB,CAAC;QAEF,uBAAA,IAAI,4BAAM,CAAC,WAAW,CAAC,GAAG,CAAC,8CAA8C,EAAE;YACzE,SAAS,EAAE,gBAAgB;YAC3B,YAAY;YACZ,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,YAAY;SACjB,CAAC,CAAC;QAEH,OAAO;YACL,WAAW;YACX,YAAY;YACZ,gBAAgB;SACjB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { toHex } from '@metamask/controller-utils';\nimport { parseCaipAssetId } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { DEPOSIT_CONFIG } from '../constants/hyperLiquidConfig.js';\nimport type {\n PerpsProvider,\n PerpsPlatformDependencies,\n PerpsTransactionParams,\n} from '../types/index.js';\nimport type { PerpsControllerMessengerBase } from '../types/messenger.js';\nimport { getSelectedEvmAccountFromMessenger } from '../utils/accountUtils.js';\nimport { generateDepositId } from '../utils/idUtils.js';\nimport { generateERC20TransferData } from '../utils/transferData.js';\n\n// Temporary to avoid estimation failures due to insufficient balance\nconst DEPOSIT_GAS_LIMIT = toHex(DEPOSIT_CONFIG.EstimatedGasLimit);\n\n/**\n * DepositService\n *\n * Handles deposit transaction preparation and validation.\n * Stateless service that prepares transaction data for TransactionController.\n * Controller handles TransactionController integration and promise lifecycle.\n *\n * Instance-based service with constructor injection of platform dependencies\n * and messenger for inter-controller communication.\n */\nexport class DepositService {\n readonly #deps: PerpsPlatformDependencies;\n\n readonly #messenger: PerpsControllerMessengerBase;\n\n /**\n * Create a new DepositService instance\n *\n * @param deps - Platform dependencies for logging, metrics, etc.\n * @param messenger - Controller messenger for cross-controller communication.\n */\n constructor(\n deps: PerpsPlatformDependencies,\n messenger: PerpsControllerMessengerBase,\n ) {\n this.#deps = deps;\n this.#messenger = messenger;\n }\n\n /**\n * Prepare deposit transaction for confirmation\n * Extracts transaction construction logic from controller\n *\n * @param options - Configuration object\n * @param options.provider - Active provider instance\n * @returns Transaction data ready for TransactionController.addTransaction\n */\n async prepareTransaction(options: { provider: PerpsProvider }): Promise<{\n transaction: PerpsTransactionParams;\n assetChainId: Hex;\n currentDepositId: string;\n }> {\n const { provider } = options;\n\n this.#deps.debugLogger.log('DepositService: Preparing deposit transaction');\n\n // Generate deposit request ID for tracking\n const currentDepositId = generateDepositId();\n\n // Get deposit routes from provider\n const depositRoutes = provider.getDepositRoutes({ isTestnet: false });\n const route = depositRoutes[0];\n const bridgeContractAddress = route.contractAddress;\n\n // Generate transfer data for ERC-20 token transfer (portable, no mobile imports)\n const transferData = generateERC20TransferData(\n bridgeContractAddress,\n '0x0',\n );\n\n // Get EVM account from selected account, falling back to the selected account group.\n const evmAccount = getSelectedEvmAccountFromMessenger(this.#messenger);\n if (!evmAccount) {\n throw new Error(\n 'No EVM-compatible account found in selected account group',\n );\n }\n const accountAddress = evmAccount.address as Hex;\n\n // Parse CAIP asset ID to extract chain ID and token address\n const parsedAsset = parseCaipAssetId(route.assetId);\n const assetChainId = toHex(parsedAsset.chainId.split(':')[1]);\n const tokenAddress = parsedAsset.assetReference as Hex;\n\n // Build transaction parameters for TransactionController\n const transaction: PerpsTransactionParams = {\n from: accountAddress,\n to: tokenAddress,\n value: '0x0',\n data: transferData,\n gas: DEPOSIT_GAS_LIMIT,\n };\n\n this.#deps.debugLogger.log('DepositService: Deposit transaction prepared', {\n depositId: currentDepositId,\n assetChainId,\n from: accountAddress,\n to: tokenAddress,\n });\n\n return {\n transaction,\n assetChainId,\n currentDepositId,\n };\n }\n}\n"]}