@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":"TradingService.mjs","sourceRoot":"","sources":["../../src/services/TradingService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,qBAAq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W,CAAC,GAAG,CACxB,iDAAiD,EACjD;QACE,YAAY,EAAE,UAAU,CAAC,YAAY;QACrC,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,QAAQ,EAAE,GAAG,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;KAC9D,CACF,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { BigNumber } from 'bignumber.js';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n PERPS_EVENT_PROPERTY,\n PERPS_EVENT_VALUE,\n} from '../constants/eventNames.js';\nimport { isTPSLOrder } from '../constants/orderTypes.js';\nimport { PerpsMeasurementName } from '../constants/performanceMetrics.js';\nimport { PERPS_CONSTANTS } from '../constants/perpsConfig.js';\nimport {\n PerpsAnalyticsEvent,\n PerpsTraceNames,\n PerpsTraceOperations,\n} from '../types/index.js';\nimport type {\n PerpsProvider,\n OrderParams,\n OrderResult,\n EditOrderParams,\n CancelOrderParams,\n CancelOrderResult,\n CancelOrdersParams,\n CancelOrdersResult,\n ClosePositionParams,\n ClosePositionsParams,\n ClosePositionsResult,\n Position,\n TrackingData,\n UpdatePositionTPSLParams,\n PerpsAnalyticsProperties,\n PerpsPlatformDependencies,\n PerpsFeeResolution,\n} from '../types/index.js';\nimport { ensureError } from '../utils/errorUtils.js';\nimport { isLimitExecutionOrderType } from '../utils/orderTypes.js';\nimport type { RewardsIntegrationService } from './RewardsIntegrationService.js';\nimport type { ServiceContext } from './ServiceContext.js';\n\n/**\n * Controller-level dependencies for TradingService.\n * These are singletons that don't change per-call, injected once via setControllerDependencies().\n */\nexport type TradingServiceControllerDeps = {\n rewardsIntegrationService: RewardsIntegrationService;\n};\n\n/**\n * Subset of tracking data carrying discovery attribution + hl_fee_rate that is\n * shared across trade/close/cancel/risk events. Both\n * {@link TrackingData} and {@link TPSLTrackingData} satisfy this shape.\n */\ntype AttributionTrackingData = Pick<\n TrackingData,\n 'entryPoint' | 'discoverySource' | 'perpDiscoverySource' | 'hlFeeRate'\n>;\n\n/**\n * TradingService\n *\n * Handles trading operations with fee discount management.\n * Controller is responsible for analytics, state management, and tracing.\n *\n * Instance-based service with constructor injection of platform dependencies.\n * Controller-level dependencies (RewardsController, NetworkController, etc.)\n * are injected via setControllerDependencies() after construction.\n */\nexport class TradingService {\n /**\n * Platform dependencies for logging, metrics, etc.\n */\n readonly #deps: PerpsPlatformDependencies;\n\n /**\n * Controller-level dependencies for fee discount calculation.\n * Set via setControllerDependencies() after construction.\n */\n #controllerDeps: TradingServiceControllerDeps | null = null;\n\n /** Serializes provider fee context so concurrent orders cannot share it. */\n #feeContextTail: Promise<void> = Promise.resolve();\n\n /**\n * Create a new TradingService instance\n *\n * @param deps - Platform dependencies for logging, metrics, etc.\n */\n constructor(deps: PerpsPlatformDependencies) {\n this.#deps = deps;\n }\n\n /**\n * Set controller-level dependencies for fee discount calculation.\n * Called by PerpsController after construction to inject singleton dependencies.\n *\n * @param controllerDeps - Controller-level dependencies (RewardsController, etc.)\n */\n setControllerDependencies(\n controllerDeps: TradingServiceControllerDeps,\n ): void {\n this.#controllerDeps = controllerDeps;\n }\n\n /**\n * Error context helper for consistent logging\n *\n * @param method - The method name.\n * @param additionalContext - The additional context value.\n * @returns The resulting string value.\n */\n #getErrorContext(\n method: string,\n additionalContext?: Record<string, unknown>,\n ): Record<string, unknown> {\n return {\n controller: 'TradingService',\n method,\n ...additionalContext,\n };\n }\n\n /**\n * Build discovery/attribution properties shared across trade/close/cancel/risk\n * events. Each property is only included when present so\n * that, in particular, hl_fee_rate is omitted entirely when unavailable.\n *\n * @param trackingData - Optional tracking data carried on the operation params.\n * @returns The attribution properties to merge into an analytics event.\n */\n #buildAttributionProperties(\n trackingData?: AttributionTrackingData,\n ): PerpsAnalyticsProperties {\n const properties: PerpsAnalyticsProperties = {};\n if (trackingData?.entryPoint !== undefined) {\n properties[PERPS_EVENT_PROPERTY.ENTRY_POINT] = trackingData.entryPoint;\n }\n if (trackingData?.discoverySource !== undefined) {\n properties[PERPS_EVENT_PROPERTY.DISCOVERY_SOURCE] =\n trackingData.discoverySource;\n }\n if (trackingData?.perpDiscoverySource !== undefined) {\n properties[PERPS_EVENT_PROPERTY.PERP_DISCOVERY_SOURCE] =\n trackingData.perpDiscoverySource;\n }\n if (trackingData?.hlFeeRate !== undefined) {\n properties[PERPS_EVENT_PROPERTY.HL_FEE_RATE] = trackingData.hlFeeRate;\n }\n return properties;\n }\n\n /**\n * Emit a transaction event with status=submitted before the provider round-trip.\n * Fired for trade, close, cancel and risk-management operations.\n *\n * @param event - The analytics event name to emit.\n * @param properties - Additional event properties (asset, attribution, etc.).\n */\n #trackSubmitted(\n event: PerpsAnalyticsEvent,\n properties: PerpsAnalyticsProperties,\n ): void {\n this.#deps.metrics.trackPerpsEvent(event, {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.SUBMITTED,\n ...properties,\n });\n }\n\n /**\n * Track order result analytics event (success or failure)\n *\n * @param options - The configuration options.\n * @param options.result - The transaction result to check.\n * @param options.error - The error that occurred.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.duration - Optional time duration.\n */\n #trackOrderResult(options: {\n result: OrderResult | null;\n error?: Error;\n params: OrderParams;\n context: ServiceContext;\n duration: number;\n }): void {\n const { result, error, params, duration } = options;\n\n const status =\n result?.success === true\n ? PERPS_EVENT_VALUE.STATUS.EXECUTED\n : PERPS_EVENT_VALUE.STATUS.FAILED;\n\n // Build base properties\n const properties: PerpsAnalyticsProperties = {\n [PERPS_EVENT_PROPERTY.STATUS]: status,\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: params.isBuy\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.orderType,\n [PERPS_EVENT_PROPERTY.LEVERAGE]: parseFloat(String(params.leverage ?? 1)),\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: parseFloat(\n result?.filledSize ?? params.size,\n ),\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: duration,\n };\n\n // Add optional properties\n if (params.trackingData?.marginUsed !== undefined) {\n properties[PERPS_EVENT_PROPERTY.MARGIN_USED] =\n params.trackingData.marginUsed;\n }\n if (params.trackingData?.totalFee !== undefined) {\n properties[PERPS_EVENT_PROPERTY.FEES] = params.trackingData.totalFee;\n }\n if (result?.averagePrice ?? params.trackingData?.marketPrice) {\n properties[PERPS_EVENT_PROPERTY.ASSET_PRICE] = result?.averagePrice\n ? parseFloat(result.averagePrice)\n : params.trackingData?.marketPrice;\n }\n // Trigger limit placements carry a real limit price too, so the companion\n // property must not go missing when order_type is stop_limit/take_profit_limit.\n if (isLimitExecutionOrderType(params.orderType) && params.price) {\n properties[PERPS_EVENT_PROPERTY.LIMIT_PRICE] = parseFloat(params.price);\n }\n if (params.trackingData?.source) {\n properties[PERPS_EVENT_PROPERTY.SOURCE] = params.trackingData.source;\n }\n if (params.trackingData?.chartLibrary) {\n properties[PERPS_EVENT_PROPERTY.CHART_LIBRARY] =\n params.trackingData.chartLibrary;\n }\n if (params.trackingData?.tradeAction) {\n properties[PERPS_EVENT_PROPERTY.ACTION] = params.trackingData.tradeAction;\n }\n // Pay with any token: trade_with_token (boolean); when true, include mm_pay_token_selected and mm_pay_network_selected; when false (Perps balance), include mm_pay_token_selected: \"Perps Balance\"\n properties[PERPS_EVENT_PROPERTY.TRADE_WITH_TOKEN] =\n params.trackingData?.tradeWithToken === true;\n if (params.trackingData?.tradeWithToken === true) {\n if (params.trackingData.mmPayTokenSelected !== undefined) {\n properties[PERPS_EVENT_PROPERTY.MM_PAY_TOKEN_SELECTED] =\n params.trackingData.mmPayTokenSelected;\n }\n if (params.trackingData.mmPayNetworkSelected !== undefined) {\n properties[PERPS_EVENT_PROPERTY.MM_PAY_NETWORK_SELECTED] =\n params.trackingData.mmPayNetworkSelected;\n }\n } else if (params.trackingData !== undefined) {\n properties[PERPS_EVENT_PROPERTY.MM_PAY_TOKEN_SELECTED] =\n PERPS_EVENT_VALUE.MM_PAY_TOKEN.PERPS_BALANCE;\n }\n\n // Calculate order value in USD (size * price)\n const orderSize = parseFloat(result?.filledSize ?? params.size);\n const assetPrice = result?.averagePrice\n ? parseFloat(result.averagePrice)\n : params.trackingData?.marketPrice;\n if (assetPrice && orderSize) {\n properties[PERPS_EVENT_PROPERTY.ORDER_VALUE] = orderSize * assetPrice;\n }\n\n // Add success-specific properties\n if (status === PERPS_EVENT_VALUE.STATUS.EXECUTED) {\n if (params.trackingData?.metamaskFee !== undefined) {\n properties[PERPS_EVENT_PROPERTY.METAMASK_FEE] =\n params.trackingData.metamaskFee;\n }\n if (params.trackingData?.metamaskFeeRate !== undefined) {\n properties[PERPS_EVENT_PROPERTY.METAMASK_FEE_RATE] =\n params.trackingData.metamaskFeeRate;\n }\n if (params.trackingData?.feeDiscountPercentage !== undefined) {\n properties[PERPS_EVENT_PROPERTY.DISCOUNT_PERCENTAGE] =\n params.trackingData.feeDiscountPercentage;\n }\n if (params.trackingData?.estimatedPoints !== undefined) {\n properties[PERPS_EVENT_PROPERTY.ESTIMATED_REWARDS] =\n params.trackingData.estimatedPoints;\n }\n if (params.takeProfitPrice) {\n properties[PERPS_EVENT_PROPERTY.TAKE_PROFIT_PRICE] = parseFloat(\n params.takeProfitPrice,\n );\n }\n if (params.stopLossPrice) {\n properties[PERPS_EVENT_PROPERTY.STOP_LOSS_PRICE] = parseFloat(\n params.stopLossPrice,\n );\n }\n } else {\n // Add failure-specific properties\n properties[PERPS_EVENT_PROPERTY.ERROR_MESSAGE] =\n error?.message ?? result?.error ?? 'Unknown error';\n }\n\n if (params.trackingData?.vipTier !== undefined) {\n properties[PERPS_EVENT_PROPERTY.VIP_TIER] = params.trackingData.vipTier;\n }\n if (params.trackingData?.vipDiscount !== undefined) {\n properties[PERPS_EVENT_PROPERTY.VIP_DISCOUNT] =\n params.trackingData.vipDiscount;\n }\n\n if (\n params.trackingData?.abTests &&\n Object.keys(params.trackingData.abTests).length > 0\n ) {\n properties[PERPS_EVENT_PROPERTY.AB_TESTS] = params.trackingData.abTests;\n }\n\n // Propagate discovery attribution + hl_fee_rate\n Object.assign(\n properties,\n this.#buildAttributionProperties(params.trackingData),\n );\n\n // Emit an additional partially filled trade event when the fill is partial,\n // mirroring the close path so the fill's partiality is visible in analytics\n // rather than hidden behind a status=executed event. Classification is based\n // on the provider's final submitted size (post precision rounding, USD\n // recalculation, and $10-minimum retry), not the caller's pre-normalization\n // params.size — the provider transforms the size before submission and a\n // complete fill of the normalized size must not look partial. When the\n // provider did not report a submitted size we do not classify (rather than\n // guess from params.size). The partial event mirrors the close schema:\n // order_size = submitted size, amount_filled = filled, remaining = the rest.\n // Compare and subtract the decimal size strings with arbitrary-precision\n // math (BigNumber): routing them through parseFloat can introduce\n // binary-float artifacts that collapse distinct values (misclassifying the\n // fill) or leave e-17 dust in remaining_amount. Only convert to Number for\n // the emitted analytics values, after the exact decimal subtraction.\n const submittedSize =\n result?.submittedSize === undefined\n ? undefined\n : new BigNumber(result.submittedSize);\n const filledSize =\n result?.filledSize === undefined\n ? undefined\n : new BigNumber(result.filledSize);\n if (\n result?.success === true &&\n submittedSize !== undefined &&\n filledSize !== undefined &&\n submittedSize.isFinite() &&\n filledSize.isFinite() &&\n filledSize.gt(0) &&\n filledSize.lt(submittedSize)\n ) {\n this.#deps.metrics.trackPerpsEvent(PerpsAnalyticsEvent.TradeTransaction, {\n ...properties,\n [PERPS_EVENT_PROPERTY.STATUS]:\n PERPS_EVENT_VALUE.STATUS.PARTIALLY_FILLED,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: submittedSize.toNumber(),\n [PERPS_EVENT_PROPERTY.AMOUNT_FILLED]: filledSize.toNumber(),\n [PERPS_EVENT_PROPERTY.REMAINING_AMOUNT]: submittedSize\n .minus(filledSize)\n .toNumber(),\n });\n }\n\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.TradeTransaction,\n properties,\n );\n }\n\n /**\n * Handle successful order placement (state updates, analytics, data lake reporting)\n *\n * @param options - The configuration options.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.reportOrderToDataLake - The report order to data lake value.\n */\n async #handleOrderSuccess(options: {\n params: OrderParams;\n context: ServiceContext;\n reportOrderToDataLake: (params: {\n action: 'open' | 'close';\n symbol: string;\n slPrice?: number;\n tpPrice?: number;\n }) => Promise<{ success: boolean; error?: string }>;\n }): Promise<void> {\n const { params, context, reportOrderToDataLake } = options;\n\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n\n // Save executed trade configuration for this market\n if (params.leverage && context.saveTradeConfiguration) {\n context.saveTradeConfiguration(params.symbol, params.leverage);\n }\n\n // Report to data lake (fire-and-forget with retry)\n reportOrderToDataLake({\n action: 'open',\n symbol: params.symbol,\n slPrice: params.stopLossPrice\n ? parseFloat(params.stopLossPrice)\n : undefined,\n tpPrice: params.takeProfitPrice\n ? parseFloat(params.takeProfitPrice)\n : undefined,\n }).catch((error) => {\n this.#deps.logger.error(\n ensureError(error, 'TradingService.handleOrderSuccess'),\n {\n tags: {\n feature: PERPS_CONSTANTS.FeatureName,\n provider: context.tracingContext.provider,\n network: context.tracingContext.isTestnet ? 'testnet' : 'mainnet',\n },\n context: {\n name: context.errorContext.controller,\n data: {\n method: context.errorContext.method,\n operation: 'reportOrderToDataLake',\n symbol: params.symbol,\n },\n },\n },\n );\n });\n }\n\n /**\n * Execute a trading operation with fee discount context\n * Ensures fee discount is always cleared after operation (success or failure)\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.feeResolution - The resolved fee and attribution source.\n * @param options.operation - The operation value.\n * @returns The result of the operation.\n */\n async #withFeeDiscount<TResult>(options: {\n provider: PerpsProvider;\n feeResolution?: PerpsFeeResolution;\n operation: () => Promise<TResult>;\n }): Promise<TResult> {\n const { provider, feeResolution, operation } = options;\n const previous = this.#feeContextTail;\n let release: () => void = () => undefined;\n this.#feeContextTail = new Promise<void>((resolve) => {\n release = resolve;\n });\n await previous;\n\n try {\n if (provider.setUserFeeResolution) {\n provider.setUserFeeResolution(feeResolution);\n } else if (provider.setUserFeeDiscount) {\n provider.setUserFeeDiscount(feeResolution?.discountBips);\n }\n if (feeResolution) {\n this.#deps.debugLogger.log(\n 'TradingService: Fee resolution set in provider',\n {\n feeDiscountBips: feeResolution.discountBips,\n feeSource: feeResolution.source,\n },\n );\n }\n\n // Execute the operation\n return await operation();\n } finally {\n // Always clear discount context, even on exception\n if (provider.setUserFeeResolution) {\n provider.setUserFeeResolution(undefined);\n } else if (provider.setUserFeeDiscount) {\n provider.setUserFeeDiscount(undefined);\n }\n this.#deps.debugLogger.log(\n 'TradingService: Fee resolution cleared from provider',\n );\n release();\n }\n }\n\n /**\n * Place a new order with full orchestration\n * Handles tracing, fee discounts, state management, analytics, and data lake reporting\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.reportOrderToDataLake - The report order to data lake value.\n * @returns The result of the operation.\n */\n async placeOrder(options: {\n provider: PerpsProvider;\n params: OrderParams;\n context: ServiceContext;\n reportOrderToDataLake: (params: {\n action: 'open' | 'close';\n symbol: string;\n slPrice?: number;\n tpPrice?: number;\n }) => Promise<{ success: boolean; error?: string }>;\n }): Promise<OrderResult> {\n const { provider, params, context, reportOrderToDataLake } = options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n let traceData:\n | {\n success: boolean;\n error?: string;\n orderId?: string;\n reason?: 'error' | 'late_success' | 'late_error';\n }\n | undefined;\n let orderSubmissionThresholdTimeoutId:\n | ReturnType<typeof setTimeout>\n | undefined;\n let didExceedOrderSubmissionThreshold = false;\n\n const paymentToken =\n params.trackingData?.tradeWithToken === true\n ? (params.trackingData.mmPayTokenSelected ?? 'unknown_token')\n : 'perps_balance';\n\n try {\n this.#deps.tracer.addBreadcrumb({\n category: 'perps',\n message: 'Order execution started',\n level: 'info',\n data: {\n payment_token: paymentToken,\n market: params.symbol,\n orderType: params.orderType,\n },\n });\n\n // Start trace for the entire operation\n this.#deps.tracer.trace({\n name: PerpsTraceNames.PlaceOrder,\n id: traceId,\n op: PerpsTraceOperations.OrderSubmission,\n tags: {\n provider: context.tracingContext.provider,\n orderType: params.orderType,\n market: params.symbol,\n leverage: String(params.leverage ?? 1),\n isTestnet: String(context.tracingContext.isTestnet),\n payment_token: paymentToken,\n },\n data: {\n isBuy: params.isBuy,\n orderPrice: params.price ?? '',\n payment_token: paymentToken,\n },\n });\n\n // Calculate fee discount at execution time (fresh, secure)\n const feeResolution = await this.#calculateFeeDiscountWithMeasurement();\n\n this.#deps.debugLogger.log('TradingService: Fee resolution calculated', {\n feeDiscountBips: feeResolution?.discountBips,\n feeSource: feeResolution?.source,\n hasDiscount: feeResolution?.discountBips !== undefined,\n });\n\n this.#deps.debugLogger.log(\n 'TradingService: Submitting order to provider',\n {\n symbol: params.symbol,\n orderType: params.orderType,\n isBuy: params.isBuy,\n size: params.size,\n leverage: params.leverage,\n hasTP: Boolean(params.takeProfitPrice),\n hasSL: Boolean(params.stopLossPrice),\n },\n );\n\n // Emit submitted event before the provider round-trip\n this.#trackSubmitted(PerpsAnalyticsEvent.TradeTransaction, {\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: params.isBuy\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.orderType,\n [PERPS_EVENT_PROPERTY.LEVERAGE]: parseFloat(\n String(params.leverage ?? 1),\n ),\n ...this.#buildAttributionProperties(params.trackingData),\n });\n\n // Observational threshold: when the provider round-trip exceeds\n // PlaceOrderTimeoutMs we tag the trace and emit a breadcrumb, but we\n // intentionally do NOT cancel the in-flight order. Cancelling client-side\n // (e.g. Promise.race rejection) does not stop the provider request, so a\n // race-based timeout would let the UI mark an order as failed while\n // HyperLiquid could still accept it. Instead, we always await\n // provider.placeOrder(params) to terminal completion and surface\n // late completions via trace `reason: 'late_success' | 'late_error'`.\n orderSubmissionThresholdTimeoutId = setTimeout(() => {\n didExceedOrderSubmissionThreshold = true;\n this.#deps.tracer.addBreadcrumb({\n category: 'perps',\n message: 'Order submission exceeded threshold (still pending)',\n level: 'warning',\n data: {\n thresholdMs: PERPS_CONSTANTS.PlaceOrderTimeoutMs,\n payment_token: paymentToken,\n market: params.symbol,\n orderType: params.orderType,\n },\n });\n this.#deps.debugLogger.log(\n 'TradingService: Order submission exceeded threshold (still pending)',\n {\n thresholdMs: PERPS_CONSTANTS.PlaceOrderTimeoutMs,\n symbol: params.symbol,\n orderType: params.orderType,\n },\n );\n }, PERPS_CONSTANTS.PlaceOrderTimeoutMs);\n const result = await this.#withFeeDiscount({\n provider,\n feeResolution,\n operation: () => provider.placeOrder(params),\n });\n if (orderSubmissionThresholdTimeoutId !== undefined) {\n clearTimeout(orderSubmissionThresholdTimeoutId);\n orderSubmissionThresholdTimeoutId = undefined;\n }\n\n this.#deps.debugLogger.log('TradingService: Provider response received', {\n success: result.success,\n orderId: result.orderId,\n error: result.error,\n didExceedOrderSubmissionThreshold,\n });\n\n // Update state and handle success/failure\n const completionDuration = this.#deps.performance.now() - startTime;\n\n if (result.success) {\n // Handle success: state updates, data lake reporting\n await this.#handleOrderSuccess({\n params,\n context,\n reportOrderToDataLake,\n });\n traceData = {\n success: true,\n orderId: result.orderId ?? '',\n ...(didExceedOrderSubmissionThreshold\n ? { reason: 'late_success' as const }\n : {}),\n };\n\n // Invalidate standalone caches so external hooks (e.g., usePerpsPositionForAsset) refresh\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'positions' });\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'accountState' });\n } else {\n traceData = {\n success: false,\n reason: didExceedOrderSubmissionThreshold ? 'late_error' : 'error',\n error: result.error ?? 'Unknown error',\n };\n }\n\n // Track analytics (success or failure)\n this.#trackOrderResult({\n result,\n params,\n context,\n duration: completionDuration,\n });\n\n return result;\n } catch (error) {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n // Track analytics for exception\n this.#trackOrderResult({\n result: null,\n error: error instanceof Error ? error : undefined,\n params,\n context,\n duration: completionDuration,\n });\n\n // withFeeDiscount handles fee discount cleanup automatically\n\n this.#deps.logger.error(ensureError(error, 'TradingService.placeOrder'), {\n tags: {\n feature: PERPS_CONSTANTS.FeatureName,\n provider: context.tracingContext.provider,\n network: context.tracingContext.isTestnet ? 'testnet' : 'mainnet',\n },\n context: {\n name: context.errorContext.controller,\n data: {\n method: context.errorContext.method,\n symbol: params.symbol,\n orderType: params.orderType,\n },\n },\n });\n\n traceData = {\n success: false,\n reason: didExceedOrderSubmissionThreshold ? 'late_error' : 'error',\n error: error instanceof Error ? error.message : 'Unknown error',\n };\n throw error;\n } finally {\n if (orderSubmissionThresholdTimeoutId !== undefined) {\n clearTimeout(orderSubmissionThresholdTimeoutId);\n }\n // Always end trace on exit (success or failure)\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.PlaceOrder,\n id: traceId,\n data: traceData,\n });\n }\n }\n\n /**\n * Load position data with performance measurement\n *\n * @param options - The configuration options.\n * @param options.symbol - The trading pair symbol.\n * @param options.context - The service context for dependencies.\n * @returns The result of the operation.\n */\n async #loadPositionData(options: {\n symbol: string;\n context: ServiceContext;\n }): Promise<Position | undefined> {\n const { symbol, context } = options;\n\n const positionLoadStart = this.#deps.performance.now();\n try {\n const positions = context.getPositions\n ? await context.getPositions()\n : [];\n const position = positions.find((pos) => pos.symbol === symbol);\n\n this.#deps.tracer.setMeasurement(\n PerpsMeasurementName.PerpsGetPositionsOperation,\n this.#deps.performance.now() - positionLoadStart,\n 'millisecond',\n );\n\n return position;\n } catch (error) {\n this.#deps.debugLogger.log(\n 'TradingService: Could not get position data for tracking',\n error instanceof Error ? error.message : String(error),\n );\n return undefined;\n }\n }\n\n /**\n * Calculate close position metrics\n *\n * @param position - The position value.\n * @param params - The operation parameters.\n * @param result - The transaction result to check.\n * @returns The result of the operation.\n */\n #calculateCloseMetrics(\n position: Position,\n params: ClosePositionParams,\n result: OrderResult,\n ): {\n direction: string;\n closePercentage: number;\n closeType: string;\n orderType: string;\n filledSize: number;\n requestedSize: number;\n isPartiallyFilled: boolean;\n } {\n const direction =\n parseFloat(position.size) > 0\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT;\n\n const filledSize = result.filledSize ? parseFloat(result.filledSize) : 0;\n const requestedSize = params.size\n ? parseFloat(params.size)\n : Math.abs(parseFloat(position.size));\n const isPartiallyFilled = filledSize > 0 && filledSize < requestedSize;\n\n const orderType = params.orderType ?? PERPS_EVENT_VALUE.ORDER_TYPE.MARKET;\n const closePercentage = params.size\n ? (parseFloat(params.size) / Math.abs(parseFloat(position.size))) * 100\n : 100;\n const closeType =\n closePercentage === 100\n ? PERPS_EVENT_VALUE.CLOSE_TYPE.FULL\n : PERPS_EVENT_VALUE.CLOSE_TYPE.PARTIAL;\n\n return {\n direction,\n closePercentage,\n closeType,\n orderType,\n filledSize,\n requestedSize,\n isPartiallyFilled,\n };\n }\n\n /**\n * Build event properties for position close analytics\n *\n * @param position - The position value.\n * @param params - The operation parameters.\n * @param metrics - The metrics value.\n * @param metrics.direction - The sort direction.\n * @param metrics.closePercentage - The close percentage value.\n * @param metrics.closeType - The close type value.\n * @param metrics.orderType - The order type value.\n * @param metrics.requestedSize - The requested size value.\n * @param result - The transaction result to check.\n * @param status - The status value.\n * @param error - The error that occurred.\n * @returns The result of the operation.\n */\n #buildCloseEventProperties(\n position: Position,\n params: ClosePositionParams,\n metrics: {\n direction: string;\n closePercentage: number;\n closeType: string;\n orderType: string;\n requestedSize: number;\n },\n result: OrderResult | null,\n status: string,\n error?: string,\n ): Record<string, unknown> {\n // Effective leverage = positionUSD / marginUSD, rounded to 1 decimal place.\n // Computed from the live position rather than the configured leverage so it's\n // populated for every close, including TP/SL triggers.\n const positionUSD = Math.abs(parseFloat(position.positionValue));\n const marginUSD = parseFloat(position.marginUsed);\n const effectiveLeverage =\n Number.isFinite(positionUSD) &&\n Number.isFinite(marginUSD) &&\n marginUSD > 0\n ? Math.round((positionUSD / marginUSD) * 10) / 10\n : undefined;\n\n const baseProperties = {\n [PERPS_EVENT_PROPERTY.STATUS]: status,\n [PERPS_EVENT_PROPERTY.ASSET]: position.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: metrics.direction,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: metrics.orderType,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: metrics.requestedSize,\n [PERPS_EVENT_PROPERTY.OPEN_POSITION_SIZE]: Math.abs(\n parseFloat(position.size),\n ),\n [PERPS_EVENT_PROPERTY.PERCENTAGE_CLOSED]: metrics.closePercentage,\n ...(position.unrealizedPnl && {\n [PERPS_EVENT_PROPERTY.PNL_DOLLAR]: parseFloat(position.unrealizedPnl),\n }),\n ...(position.returnOnEquity && {\n [PERPS_EVENT_PROPERTY.PNL_PERCENT]:\n parseFloat(position.returnOnEquity) * 100,\n }),\n ...(params.trackingData?.totalFee !== undefined && {\n [PERPS_EVENT_PROPERTY.FEE]: params.trackingData.totalFee,\n }),\n ...(params.trackingData?.metamaskFee !== undefined && {\n [PERPS_EVENT_PROPERTY.METAMASK_FEE]: params.trackingData.metamaskFee,\n }),\n ...(params.trackingData?.metamaskFeeRate !== undefined && {\n [PERPS_EVENT_PROPERTY.METAMASK_FEE_RATE]:\n params.trackingData.metamaskFeeRate,\n }),\n ...(params.trackingData?.feeDiscountPercentage !== undefined && {\n [PERPS_EVENT_PROPERTY.DISCOUNT_PERCENTAGE]:\n params.trackingData.feeDiscountPercentage,\n }),\n ...(params.trackingData?.estimatedPoints !== undefined && {\n [PERPS_EVENT_PROPERTY.ESTIMATED_REWARDS]:\n params.trackingData.estimatedPoints,\n }),\n ...((params.trackingData?.marketPrice ?? result?.averagePrice) && {\n [PERPS_EVENT_PROPERTY.ASSET_PRICE]: result?.averagePrice\n ? parseFloat(result.averagePrice)\n : params.trackingData?.marketPrice,\n }),\n ...(params.orderType &&\n isLimitExecutionOrderType(params.orderType) &&\n params.price && {\n [PERPS_EVENT_PROPERTY.LIMIT_PRICE]: parseFloat(params.price),\n }),\n ...(params.trackingData?.receivedAmount !== undefined && {\n [PERPS_EVENT_PROPERTY.RECEIVED_AMOUNT]:\n params.trackingData.receivedAmount,\n }),\n ...(params.trackingData?.source && {\n [PERPS_EVENT_PROPERTY.SOURCE]: params.trackingData.source,\n }),\n ...(params.trackingData?.vipTier !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_TIER]: params.trackingData.vipTier,\n }),\n ...(params.trackingData?.vipDiscount !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_DISCOUNT]: params.trackingData.vipDiscount,\n }),\n // Effective leverage on close events\n ...(effectiveLeverage !== undefined && {\n [PERPS_EVENT_PROPERTY.LEVERAGE]: effectiveLeverage,\n }),\n // Discovery attribution + hl_fee_rate\n ...this.#buildAttributionProperties(params.trackingData),\n };\n\n // Calculate and add order value in USD (size * price)\n const closeAssetPrice = result?.averagePrice\n ? parseFloat(result.averagePrice)\n : params.trackingData?.marketPrice;\n const orderValue =\n closeAssetPrice && metrics.requestedSize\n ? metrics.requestedSize * closeAssetPrice\n : undefined;\n\n // Add success-specific properties\n if (status === PERPS_EVENT_VALUE.STATUS.EXECUTED) {\n return {\n ...baseProperties,\n [PERPS_EVENT_PROPERTY.CLOSE_TYPE]: metrics.closeType,\n ...(orderValue !== undefined && {\n [PERPS_EVENT_PROPERTY.ORDER_VALUE]: orderValue,\n }),\n };\n }\n\n // Add error for failures\n return {\n ...baseProperties,\n ...(error && { [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: error }),\n ...(orderValue !== undefined && {\n [PERPS_EVENT_PROPERTY.ORDER_VALUE]: orderValue,\n }),\n };\n }\n\n /**\n * Track position close result analytics (consolidates all tracking logic)\n *\n * @param options - The configuration options.\n * @param options.position - The position value.\n * @param options.result - The transaction result to check.\n * @param options.error - The error that occurred.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.duration - Optional time duration.\n * @param options.bulkActionId - Optional batch correlation id.\n */\n #trackPositionCloseResult(options: {\n position: Position | undefined;\n result: OrderResult | null;\n error?: Error;\n params: ClosePositionParams;\n context: ServiceContext;\n duration: number;\n bulkActionId?: string;\n }): void {\n const { position, result, error, params, duration, bulkActionId } = options;\n\n // Bulk action correlation id for batch close events\n const bulkActionProps: PerpsAnalyticsProperties = bulkActionId\n ? { [PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId }\n : {};\n\n if (!position) {\n // No local position record, yet closePosition already emitted a\n // submitted event and the close may still complete at the provider.\n // Emit a terminal (executed/failed) event so every submitted close has a\n // matching outcome, even without position-derived metrics.\n const status =\n result?.success === true\n ? PERPS_EVENT_VALUE.STATUS.EXECUTED\n : PERPS_EVENT_VALUE.STATUS.FAILED;\n const errorMessage = error?.message ?? result?.error;\n\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.PositionCloseTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: status,\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]:\n params.orderType ?? PERPS_EVENT_VALUE.ORDER_TYPE.MARKET,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: duration,\n ...(errorMessage && {\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: errorMessage,\n }),\n ...this.#buildAttributionProperties(params.trackingData),\n ...bulkActionProps,\n },\n );\n return;\n }\n\n const metrics = result\n ? this.#calculateCloseMetrics(position, params, result)\n : {\n direction:\n parseFloat(position.size) > 0\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n closePercentage: params.size\n ? (parseFloat(params.size) / Math.abs(parseFloat(position.size))) *\n 100\n : 100,\n closeType: PERPS_EVENT_VALUE.CLOSE_TYPE.FULL,\n orderType: params.orderType ?? PERPS_EVENT_VALUE.ORDER_TYPE.MARKET,\n requestedSize: params.size\n ? parseFloat(params.size)\n : Math.abs(parseFloat(position.size)),\n filledSize: 0,\n isPartiallyFilled: false,\n };\n\n // Track partially filled event if applicable\n if (result?.success && metrics.isPartiallyFilled) {\n const partialProperties = this.#buildCloseEventProperties(\n position,\n params,\n metrics,\n result,\n PERPS_EVENT_VALUE.STATUS.PARTIALLY_FILLED,\n );\n\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.PositionCloseTransaction,\n {\n ...partialProperties,\n [PERPS_EVENT_PROPERTY.AMOUNT_FILLED]: metrics.filledSize,\n [PERPS_EVENT_PROPERTY.REMAINING_AMOUNT]:\n metrics.requestedSize - metrics.filledSize,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: duration,\n ...bulkActionProps,\n },\n );\n }\n\n // Determine status\n const status =\n result?.success === true\n ? PERPS_EVENT_VALUE.STATUS.EXECUTED\n : PERPS_EVENT_VALUE.STATUS.FAILED;\n\n const errorMessage = error?.message ?? result?.error;\n\n // Track main close event\n const eventProperties = this.#buildCloseEventProperties(\n position,\n params,\n metrics,\n result,\n status,\n errorMessage,\n );\n\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.PositionCloseTransaction,\n {\n ...eventProperties,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: duration,\n ...bulkActionProps,\n },\n );\n }\n\n /**\n * Handle data lake reporting (fire-and-forget)\n *\n * @param reportOrderToDataLake - The report order to data lake value.\n * @param symbol - The trading pair symbol.\n * @param context - The service context for dependencies.\n */\n #handleDataLakeReporting(\n reportOrderToDataLake: (params: {\n action: 'open' | 'close';\n symbol: string;\n }) => Promise<{ success: boolean; error?: string }>,\n symbol: string,\n context: ServiceContext,\n ): void {\n reportOrderToDataLake({\n action: 'close',\n symbol,\n }).catch((error) => {\n this.#deps.logger.error(\n ensureError(error, 'TradingService.handleDataLakeReporting'),\n {\n tags: {\n feature: PERPS_CONSTANTS.FeatureName,\n provider: context.tracingContext.provider,\n network: context.tracingContext.isTestnet ? 'testnet' : 'mainnet',\n },\n context: {\n name: context.errorContext.controller,\n data: {\n method: context.errorContext.method,\n operation: 'reportOrderToDataLake',\n symbol,\n },\n },\n },\n );\n });\n }\n\n /**\n * Calculate fee discount with performance measurement\n * Uses controller dependencies injected via setControllerDependencies()\n * Helper method for placeOrder orchestration\n *\n * @returns The result of the operation.\n */\n async #calculateFeeDiscountWithMeasurement(): Promise<\n PerpsFeeResolution | undefined\n > {\n // Check if controller dependencies are available\n if (!this.#controllerDeps) {\n this.#deps.debugLogger.log(\n 'TradingService: Controller dependencies not set, skipping fee discount',\n );\n return undefined;\n }\n\n const { rewardsIntegrationService } = this.#controllerDeps;\n\n const orderExecutionFeeDiscountStartTime = this.#deps.performance.now();\n\n // Calculate fee discount using messenger pattern (service handles controller access internally)\n const resolution = await rewardsIntegrationService.resolveFee();\n\n const orderExecutionFeeDiscountDuration =\n this.#deps.performance.now() - orderExecutionFeeDiscountStartTime;\n\n // Record measurement\n this.#deps.tracer.setMeasurement(\n PerpsMeasurementName.PerpsRewardsOrderExecutionFeeDiscountApiCall,\n orderExecutionFeeDiscountDuration,\n 'millisecond',\n );\n\n this.#deps.debugLogger.log(\n 'TradingService: Fee discount API call completed',\n {\n discountBips: resolution.discountBips,\n source: resolution.source,\n duration: `${orderExecutionFeeDiscountDuration.toFixed(0)}ms`,\n },\n );\n\n return resolution;\n }\n\n /**\n * Edit an existing order with full orchestration\n * Handles tracing, fee discounts, state management, and analytics\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @returns The result of the operation.\n */\n async editOrder(options: {\n provider: PerpsProvider;\n params: EditOrderParams;\n context: ServiceContext;\n }): Promise<OrderResult> {\n const { provider, params, context } = options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n let traceData:\n | { success: boolean; error?: string; orderId?: string }\n | undefined;\n\n try {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.EditOrder,\n id: traceId,\n op: PerpsTraceOperations.OrderSubmission,\n tags: {\n provider: context.tracingContext.provider,\n orderType: params.newOrder.orderType,\n market: params.newOrder.symbol,\n leverage: String(params.newOrder.leverage ?? 1),\n isTestnet: String(context.tracingContext.isTestnet),\n },\n data: {\n isBuy: params.newOrder.isBuy,\n orderPrice: params.newOrder.price ?? '',\n },\n });\n\n // Calculate fee discount only if required dependencies are available\n const feeResolution = await this.#calculateFeeDiscountWithMeasurement();\n\n // Execute order edit with fee discount management\n const result = await this.#withFeeDiscount({\n provider,\n feeResolution,\n operation: () => provider.editOrder(params),\n });\n\n const completionDuration = this.#deps.performance.now() - startTime;\n\n if (result.success) {\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n\n // Track order edit executed\n const editExecutedProps: PerpsAnalyticsProperties = {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.EXECUTED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.newOrder.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: params.newOrder.isBuy\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.newOrder.orderType,\n [PERPS_EVENT_PROPERTY.LEVERAGE]: params.newOrder.leverage ?? 1,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: params.newOrder.size,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n };\n if (params.newOrder.price) {\n editExecutedProps[PERPS_EVENT_PROPERTY.LIMIT_PRICE] = parseFloat(\n params.newOrder.price,\n );\n }\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.TradeTransaction,\n editExecutedProps,\n );\n\n traceData = { success: true, orderId: result.orderId ?? '' };\n } else {\n // Track order edit failed\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.TradeTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.newOrder.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: params.newOrder.isBuy\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.newOrder.orderType,\n [PERPS_EVENT_PROPERTY.LEVERAGE]: params.newOrder.leverage ?? 1,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: params.newOrder.size,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]:\n result.error ?? 'Unknown error',\n },\n );\n\n traceData = { success: false, error: result.error ?? 'Unknown error' };\n }\n\n return result;\n } catch (error) {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n // Track order edit exception\n this.#deps.metrics.trackPerpsEvent(PerpsAnalyticsEvent.TradeTransaction, {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.newOrder.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: params.newOrder.isBuy\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: params.newOrder.orderType,\n [PERPS_EVENT_PROPERTY.LEVERAGE]: params.newOrder.leverage ?? 1,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: params.newOrder.size,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]:\n error instanceof Error ? error.message : 'Unknown error',\n });\n\n this.#deps.logger.error(ensureError(error, 'TradingService.editOrder'), {\n tags: {\n feature: PERPS_CONSTANTS.FeatureName,\n provider: context.tracingContext.provider,\n network: context.tracingContext.isTestnet ? 'testnet' : 'mainnet',\n },\n context: {\n name: context.errorContext.controller,\n data: {\n method: context.errorContext.method,\n orderId: params.orderId,\n },\n },\n });\n\n traceData = {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error',\n };\n throw error;\n } finally {\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.EditOrder,\n id: traceId,\n data: traceData,\n });\n }\n }\n\n /**\n * Cancel a single order with full orchestration\n * Handles tracing, state management, and analytics\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.bulkActionId - Optional batch correlation id.\n * @returns The result of the operation.\n */\n async cancelOrder(options: {\n provider: PerpsProvider;\n params: CancelOrderParams;\n context: ServiceContext;\n bulkActionId?: string;\n }): Promise<CancelOrderResult> {\n const { provider, params, context, bulkActionId } = options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n let traceData:\n | { success: boolean; error?: string; orderId?: string }\n | undefined;\n\n // Shared attribution + bulk correlation props\n const cancelExtraProps: PerpsAnalyticsProperties = {\n ...this.#buildAttributionProperties(params.trackingData),\n ...(bulkActionId && {\n [PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId,\n }),\n };\n\n try {\n // Start trace for the entire operation\n this.#deps.tracer.trace({\n name: PerpsTraceNames.CancelOrder,\n id: traceId,\n op: PerpsTraceOperations.OrderSubmission,\n tags: {\n provider: context.tracingContext.provider,\n market: params.symbol,\n isTestnet: String(context.tracingContext.isTestnet),\n },\n data: {\n orderId: params.orderId,\n },\n });\n\n // Emit submitted event before the provider round-trip\n this.#trackSubmitted(PerpsAnalyticsEvent.OrderCancelTransaction, {\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n ...cancelExtraProps,\n });\n\n // Execute order cancellation\n const result = await provider.cancelOrder(params);\n const completionDuration = this.#deps.performance.now() - startTime;\n\n if (result.success) {\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n\n // Track order cancel executed\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.OrderCancelTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.EXECUTED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n ...cancelExtraProps,\n },\n );\n\n traceData = { success: true, orderId: params.orderId };\n } else {\n // Track order cancel failed\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.OrderCancelTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]:\n result.error ?? 'Unknown error',\n ...cancelExtraProps,\n },\n );\n\n this.#deps.logger.error(\n ensureError(result.error, 'TradingService.cancelOrder'),\n this.#getErrorContext('cancelOrder', {\n symbol: params.symbol,\n orderId: params.orderId,\n providerError: result.error ?? 'Unknown error',\n }),\n );\n\n traceData = { success: false, error: result.error ?? 'Unknown error' };\n }\n\n return result;\n } catch (error) {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n // Track order cancel exception\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.OrderCancelTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]:\n error instanceof Error ? error.message : 'Unknown error',\n ...cancelExtraProps,\n },\n );\n\n this.#deps.logger.error(\n ensureError(error, 'TradingService.cancelOrder'),\n this.#getErrorContext('cancelOrder', { symbol: params.symbol }),\n );\n\n traceData = {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error',\n };\n throw error;\n } finally {\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.CancelOrder,\n id: traceId,\n data: traceData,\n });\n }\n }\n\n /**\n * Cancel multiple orders with full orchestration\n * Handles tracing, stream pausing, filtering, batch operations, and analytics\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.withStreamPause - The with stream pause value.\n * @returns The result of the operation.\n */\n async cancelOrders(options: {\n provider: PerpsProvider;\n params: CancelOrdersParams;\n context: ServiceContext;\n withStreamPause: <TResult>(\n operation: () => Promise<TResult>,\n channels: string[],\n ) => Promise<TResult>;\n }): Promise<CancelOrdersResult> {\n const { provider, params, context, withStreamPause } = options;\n const traceId = uuidv4();\n // Correlation id linking every per-item event to the batch summary\n const bulkActionId = uuidv4();\n const startTime = this.#deps.performance.now();\n let operationResult: CancelOrdersResult | null = null;\n let operationError: Error | null = null;\n\n try {\n // Start trace for batch operation\n this.#deps.tracer.trace({\n name: PerpsTraceNames.CancelOrder,\n id: traceId,\n op: PerpsTraceOperations.OrderSubmission,\n tags: {\n provider: context.tracingContext.provider,\n isBatch: 'true',\n isTestnet: String(context.tracingContext.isTestnet),\n },\n data: {\n cancelAll: params.cancelAll ? 'true' : 'false',\n symbolCount: params.symbols?.length ?? 0,\n orderIdCount: params.orderIds?.length ?? 0,\n },\n });\n\n // Pause orders stream to prevent WebSocket updates during cancellation\n operationResult = await withStreamPause(async () => {\n // Get all open orders\n if (!context.getOpenOrders) {\n throw new Error('getOpenOrders callback not provided in context');\n }\n const orders = await context.getOpenOrders();\n\n // Filter orders based on params\n let ordersToCancel = orders;\n if (\n params.cancelAll === true ||\n (!params.symbols && !params.orderIds)\n ) {\n // Cancel all orders (excluding TP/SL orders for positions)\n ordersToCancel = orders.filter(\n (order) => !isTPSLOrder(order.detailedOrderType),\n );\n } else if (params.orderIds && params.orderIds.length > 0) {\n // Cancel specific order IDs\n ordersToCancel = orders.filter((order) =>\n params.orderIds?.includes(order.orderId),\n );\n } else if (params.symbols && params.symbols.length > 0) {\n // Cancel orders for specific symbols\n ordersToCancel = orders.filter((order) =>\n params.symbols?.includes(order.symbol),\n );\n }\n\n if (ordersToCancel.length === 0) {\n return {\n success: false,\n successCount: 0,\n failureCount: 0,\n results: [],\n };\n }\n\n // Use batch cancel if provider supports it\n if (provider.cancelOrders) {\n return await provider.cancelOrders(\n ordersToCancel.map((order) => ({\n symbol: order.symbol,\n orderId: order.orderId,\n })),\n );\n }\n\n // Fallback: Cancel orders in parallel (for providers without batch support)\n const results = await Promise.allSettled(\n ordersToCancel.map((order) =>\n this.cancelOrder({\n provider,\n params: { symbol: order.symbol, orderId: order.orderId },\n context,\n bulkActionId,\n }),\n ),\n );\n\n // Aggregate results\n const successCount = results.filter(\n (res) => res.status === 'fulfilled' && res.value.success,\n ).length;\n const failureCount = results.length - successCount;\n\n return {\n success: successCount > 0,\n successCount,\n failureCount,\n results: results.map((result, index) => {\n let error: string | undefined;\n if (result.status === 'rejected') {\n error =\n result.reason instanceof Error\n ? result.reason.message\n : 'Unknown error';\n } else if (result.status === 'fulfilled' && !result.value.success) {\n error = result.value.error;\n }\n\n return {\n orderId: ordersToCancel[index].orderId,\n symbol: ordersToCancel[index].symbol,\n success: Boolean(\n result.status === 'fulfilled' && result.value.success,\n ),\n error,\n };\n }),\n };\n }, ['orders']); // Disconnect orders stream during operation\n\n if (\n provider.cancelOrders &&\n operationResult &&\n operationResult.failureCount > 0\n ) {\n const failureSummary = operationResult.results\n .filter((result) => !result.success)\n .map(\n (result) =>\n `${result.symbol}/${result.orderId}: ${result.error ?? 'Unknown error'}`,\n )\n .join('; ');\n\n this.#deps.logger.error(\n new Error(\n `cancelOrders batch failure: ${operationResult.failureCount}/${operationResult.results.length} failed - ${failureSummary}`,\n ),\n this.#getErrorContext('cancelOrders', {\n successCount: operationResult.successCount,\n failureCount: operationResult.failureCount,\n cancelAll: params.cancelAll,\n }),\n );\n }\n\n return operationResult;\n } catch (error) {\n operationError =\n error instanceof Error ? error : new Error(String(error));\n this.#deps.logger.error(\n ensureError(error, 'TradingService.cancelOrders'),\n this.#getErrorContext('cancelOrders'),\n );\n throw error;\n } finally {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n // Track batch cancel event (success or failure)\n const batchCancelProps: PerpsAnalyticsProperties = {\n [PERPS_EVENT_PROPERTY.STATUS]:\n operationResult?.success && operationResult.successCount > 0\n ? PERPS_EVENT_VALUE.STATUS.EXECUTED\n : PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId,\n };\n if (operationError) {\n batchCancelProps[PERPS_EVENT_PROPERTY.ERROR_MESSAGE] =\n operationError.message;\n }\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.OrderCancelTransaction,\n batchCancelProps,\n );\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.CancelOrder,\n id: traceId,\n });\n }\n }\n\n /**\n * Close a single position with full orchestration\n * Handles tracing, fee discounts, state management, analytics, and data lake reporting\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @param options.reportOrderToDataLake - The report order to data lake value.\n * @param options.bulkActionId - Optional batch correlation id.\n * @returns The result of the operation.\n */\n async closePosition(options: {\n provider: PerpsProvider;\n params: ClosePositionParams;\n context: ServiceContext;\n reportOrderToDataLake: (params: {\n action: 'open' | 'close';\n symbol: string;\n }) => Promise<{ success: boolean; error?: string }>;\n bulkActionId?: string;\n }): Promise<OrderResult> {\n const { provider, params, context, reportOrderToDataLake, bulkActionId } =\n options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n let position: Position | undefined;\n let result: OrderResult | undefined;\n let traceData:\n | { success: boolean; error?: string; filledSize?: string }\n | undefined;\n\n try {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.ClosePosition,\n id: traceId,\n op: PerpsTraceOperations.PositionManagement,\n tags: {\n provider: context.tracingContext.provider,\n symbol: params.symbol,\n closeSize: params.size ?? 'full',\n isTestnet: String(context.tracingContext.isTestnet),\n },\n });\n\n // Load position data with measurement\n position = await this.#loadPositionData({\n symbol: params.symbol,\n context,\n });\n\n // Emit submitted event before the provider round-trip\n this.#trackSubmitted(PerpsAnalyticsEvent.PositionCloseTransaction, {\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]:\n params.orderType ?? PERPS_EVENT_VALUE.ORDER_TYPE.MARKET,\n ...this.#buildAttributionProperties(params.trackingData),\n ...(bulkActionId && {\n [PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId,\n }),\n });\n\n // Calculate fee discount with measurement\n const feeResolution = await this.#calculateFeeDiscountWithMeasurement();\n\n // Execute position close with fee discount management\n result = await this.#withFeeDiscount({\n provider,\n feeResolution,\n operation: () => provider.closePosition(params),\n });\n\n const completionDuration = this.#deps.performance.now() - startTime;\n\n if (result.success) {\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n\n // Report to data lake (fire-and-forget)\n this.#handleDataLakeReporting(\n reportOrderToDataLake,\n params.symbol,\n context,\n );\n\n traceData = { success: true, filledSize: result.filledSize ?? '' };\n\n // Invalidate standalone caches so external hooks (e.g., usePerpsPositionForAsset) refresh\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'positions' });\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'accountState' });\n } else {\n traceData = { success: false, error: result.error ?? 'Unknown error' };\n\n this.#deps.logger.error(\n ensureError(result.error, 'TradingService.closePosition'),\n this.#getErrorContext('closePosition', {\n symbol: params.symbol,\n providerError: result.error ?? 'Unknown error',\n }),\n );\n }\n\n // Track analytics (success or failure, includes partial fills)\n this.#trackPositionCloseResult({\n position,\n result,\n params,\n context,\n duration: completionDuration,\n bulkActionId,\n });\n\n return result;\n } catch (error) {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n traceData = {\n success: false,\n error: error instanceof Error ? error.message : 'Unknown error',\n };\n\n // Track analytics for exception\n this.#trackPositionCloseResult({\n position,\n result: null,\n error: error instanceof Error ? error : undefined,\n params,\n context,\n duration: completionDuration,\n bulkActionId,\n });\n\n this.#deps.logger.error(\n ensureError(error, 'TradingService.closePosition'),\n {\n tags: {\n feature: PERPS_CONSTANTS.FeatureName,\n provider: context.tracingContext.provider,\n network: context.tracingContext.isTestnet ? 'testnet' : 'mainnet',\n },\n context: {\n name: context.errorContext.controller,\n data: {\n method: context.errorContext.method,\n symbol: params.symbol,\n },\n },\n },\n );\n\n throw error;\n } finally {\n // Always end trace on exit (success or failure)\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.ClosePosition,\n id: traceId,\n data: traceData,\n });\n }\n }\n\n /**\n * Close multiple positions with full orchestration\n * Handles tracing, fee discounts, batch operations, and analytics\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @returns The result of the operation.\n */\n async closePositions(options: {\n provider: PerpsProvider;\n params: ClosePositionsParams;\n context: ServiceContext;\n }): Promise<ClosePositionsResult> {\n const { provider, params, context } = options;\n const traceId = uuidv4();\n // Correlation id linking every per-item event to the batch summary\n const bulkActionId = uuidv4();\n const startTime = this.#deps.performance.now();\n let operationResult: ClosePositionsResult | null = null;\n let operationError: Error | null = null;\n\n try {\n // Start trace for batch operation\n this.#deps.tracer.trace({\n name: PerpsTraceNames.ClosePosition,\n id: traceId,\n op: PerpsTraceOperations.PositionManagement,\n tags: {\n provider: context.tracingContext.provider,\n isBatch: 'true',\n isTestnet: String(context.tracingContext.isTestnet),\n },\n data: {\n closeAll: params.closeAll ? 'true' : 'false',\n symbolCount: params.symbols?.length ?? 0,\n },\n });\n\n this.#deps.debugLogger.log('[closePositions] Batch method check', {\n providerType: provider.protocolId,\n providerKeys: Object.keys(provider).filter((key) =>\n key.includes('close'),\n ),\n });\n\n // Use batch close if provider supports it (provider handles filtering)\n if (provider.closePositions) {\n const feeResolution = await this.#calculateFeeDiscountWithMeasurement();\n\n operationResult = await this.#withFeeDiscount({\n provider,\n feeResolution,\n operation: async () => {\n if (!provider.closePositions) {\n throw new Error('closePositions method not available');\n }\n return provider.closePositions(params);\n },\n });\n } else {\n // Fallback: Get positions, filter, and close in parallel\n if (!context.getPositions) {\n throw new Error('getPositions callback not provided in context');\n }\n const positions = await context.getPositions();\n\n const positionsToClose =\n params.closeAll === true ||\n !params.symbols ||\n params.symbols.length === 0\n ? positions\n : positions.filter((pos) => params.symbols?.includes(pos.symbol));\n\n if (positionsToClose.length === 0) {\n operationResult = {\n success: false,\n successCount: 0,\n failureCount: 0,\n results: [],\n };\n return operationResult;\n }\n\n const results = await Promise.allSettled(\n positionsToClose.map((position) =>\n this.closePosition({\n provider,\n params: { symbol: position.symbol },\n context,\n reportOrderToDataLake: () => Promise.resolve({ success: true }), // No-op for batch fallback\n bulkActionId,\n }),\n ),\n );\n\n // Aggregate results\n const successCount = results.filter(\n (res) => res.status === 'fulfilled' && res.value.success,\n ).length;\n const failureCount = results.length - successCount;\n\n operationResult = {\n success: successCount > 0,\n successCount,\n failureCount,\n results: results.map((result, index) => {\n let error: string | undefined;\n if (result.status === 'rejected') {\n error =\n result.reason instanceof Error\n ? result.reason.message\n : 'Unknown error';\n } else if (result.status === 'fulfilled' && !result.value.success) {\n error = result.value.error;\n }\n\n return {\n symbol: positionsToClose[index].symbol,\n success: Boolean(\n result.status === 'fulfilled' && result.value.success,\n ),\n error,\n };\n }),\n };\n }\n\n if (\n provider.closePositions &&\n operationResult &&\n operationResult.failureCount > 0\n ) {\n const failureSummary = operationResult.results\n .filter((result) => !result.success)\n .map(\n (result) => `${result.symbol}: ${result.error ?? 'Unknown error'}`,\n )\n .join('; ');\n\n this.#deps.logger.error(\n new Error(\n `closePositions batch failure: ${operationResult.failureCount}/${operationResult.results.length} failed - ${failureSummary}`,\n ),\n this.#getErrorContext('closePositions', {\n successCount: operationResult.successCount,\n failureCount: operationResult.failureCount,\n symbols: params.symbols?.length ?? 0,\n closeAll: params.closeAll,\n }),\n );\n }\n\n return operationResult;\n } catch (error) {\n operationError =\n error instanceof Error ? error : new Error(String(error));\n this.#deps.logger.error(\n ensureError(error, 'TradingService.closePositions'),\n this.#getErrorContext('closePositions', {\n symbols: params.symbols?.length ?? 0,\n closeAll: params.closeAll,\n }),\n );\n throw error;\n } finally {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n // Track batch close event (success or failure)\n const batchCloseProps: PerpsAnalyticsProperties = {\n [PERPS_EVENT_PROPERTY.STATUS]:\n operationResult?.success && operationResult.successCount > 0\n ? PERPS_EVENT_VALUE.STATUS.EXECUTED\n : PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.BULK_ACTION_ID]: bulkActionId,\n [PERPS_EVENT_PROPERTY.NUMBER_POSITIONS_CLOSED]:\n operationResult?.successCount ?? 0,\n };\n if (operationError) {\n batchCloseProps[PERPS_EVENT_PROPERTY.ERROR_MESSAGE] =\n operationError.message;\n }\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.PositionCloseTransaction,\n batchCloseProps,\n );\n\n // Invalidate standalone caches on successful batch close\n if (operationResult?.success && operationResult.successCount > 0) {\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'positions' });\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'accountState' });\n }\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.ClosePosition,\n id: traceId,\n });\n }\n }\n\n /**\n * Update TP/SL for an existing position with full orchestration\n * Handles tracing, fee discounts, state management, and analytics\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.params - The operation parameters.\n * @param options.context - The service context for dependencies.\n * @returns The result of the operation.\n */\n async updatePositionTPSL(options: {\n provider: PerpsProvider;\n params: UpdatePositionTPSLParams;\n context: ServiceContext;\n }): Promise<OrderResult> {\n const { provider, params, context } = options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n let traceData: { success: boolean; error?: string } | undefined;\n let result: OrderResult | undefined;\n let errorMessage: string | undefined;\n\n // Extract tracking data with defaults\n const direction = params.trackingData?.direction;\n const positionSize = params.trackingData?.positionSize;\n const source =\n params.trackingData?.source ?? PERPS_EVENT_VALUE.SOURCE.TP_SL_VIEW;\n const takeProfitPercentage = params.trackingData?.takeProfitPercentage;\n const stopLossPercentage = params.trackingData?.stopLossPercentage;\n const isEditingExistingPosition =\n params.trackingData?.isEditingExistingPosition ?? false;\n\n try {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.UpdateTpsl,\n id: traceId,\n op: PerpsTraceOperations.PositionManagement,\n tags: {\n provider: context.tracingContext.provider,\n market: params.symbol,\n isTestnet: String(context.tracingContext.isTestnet),\n },\n data: {\n takeProfitPrice: params.takeProfitPrice ?? '',\n stopLossPrice: params.stopLossPrice ?? '',\n },\n });\n\n // Emit submitted event before the provider round-trip\n this.#trackSubmitted(PerpsAnalyticsEvent.RiskManagement, {\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.SOURCE]: source,\n ...this.#buildAttributionProperties(params.trackingData),\n });\n\n // Get fee discount from rewards\n const feeResolution = await this.#calculateFeeDiscountWithMeasurement();\n\n // Execute with fee discount management\n result = await this.#withFeeDiscount({\n provider,\n feeResolution,\n operation: () => provider.updatePositionTPSL(params),\n });\n\n if (result.success) {\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n traceData = { success: true };\n } else {\n errorMessage = result.error ?? 'Unknown error';\n traceData = { success: false, error: errorMessage };\n }\n\n return result;\n } catch (error) {\n errorMessage = error instanceof Error ? error.message : 'Unknown error';\n traceData = { success: false, error: errorMessage };\n\n this.#deps.logger.error(\n ensureError(error, 'TradingService.updatePositionTPSL'),\n this.#getErrorContext('updatePositionTPSL', {\n symbol: params.symbol,\n hasTakeProfit: Boolean(params.takeProfitPrice),\n hasStopLoss: Boolean(params.stopLossPrice),\n }),\n );\n\n throw error;\n } finally {\n const completionDuration = this.#deps.performance.now() - startTime;\n\n // Determine screen type based on whether editing existing position\n const screenType = isEditingExistingPosition\n ? PERPS_EVENT_VALUE.SCREEN_TYPE.EDIT_TPSL\n : PERPS_EVENT_VALUE.SCREEN_TYPE.CREATE_TPSL;\n\n // Determine if TP/SL are set\n const hasTakeProfit = Boolean(params.takeProfitPrice);\n const hasStopLoss = Boolean(params.stopLossPrice);\n\n // Determine TP/SL action type\n let tpslAction: string | undefined;\n if (hasTakeProfit && hasStopLoss) {\n tpslAction = PERPS_EVENT_VALUE.ACTION.TPSL;\n } else if (hasTakeProfit) {\n tpslAction = PERPS_EVENT_VALUE.ACTION.TP;\n } else if (hasStopLoss) {\n tpslAction = PERPS_EVENT_VALUE.ACTION.SL;\n }\n\n // Build comprehensive event properties\n const eventProperties = {\n [PERPS_EVENT_PROPERTY.STATUS]: result?.success\n ? PERPS_EVENT_VALUE.STATUS.EXECUTED\n : PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: params.symbol,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.SOURCE]: source,\n [PERPS_EVENT_PROPERTY.SCREEN_TYPE]: screenType,\n [PERPS_EVENT_PROPERTY.HAS_TAKE_PROFIT]: hasTakeProfit,\n [PERPS_EVENT_PROPERTY.HAS_STOP_LOSS]: hasStopLoss,\n ...(tpslAction && {\n [PERPS_EVENT_PROPERTY.ACTION]: tpslAction,\n }),\n ...(direction && {\n [PERPS_EVENT_PROPERTY.DIRECTION]:\n direction === 'long'\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n }),\n ...(positionSize !== undefined && {\n [PERPS_EVENT_PROPERTY.POSITION_SIZE]: positionSize,\n }),\n ...(params.takeProfitPrice && {\n [PERPS_EVENT_PROPERTY.TAKE_PROFIT_PRICE]: parseFloat(\n params.takeProfitPrice,\n ),\n }),\n ...(params.stopLossPrice && {\n [PERPS_EVENT_PROPERTY.STOP_LOSS_PRICE]: parseFloat(\n params.stopLossPrice,\n ),\n }),\n ...(takeProfitPercentage !== undefined && {\n [PERPS_EVENT_PROPERTY.TAKE_PROFIT_PERCENTAGE]: takeProfitPercentage,\n }),\n ...(stopLossPercentage !== undefined && {\n [PERPS_EVENT_PROPERTY.STOP_LOSS_PERCENTAGE]: stopLossPercentage,\n }),\n ...(errorMessage && {\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: errorMessage,\n }),\n // Discovery attribution\n ...this.#buildAttributionProperties(params.trackingData),\n };\n\n // Track event once with all properties\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.RiskManagement,\n eventProperties,\n );\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.UpdateTpsl,\n id: traceId,\n data: traceData,\n });\n }\n }\n\n /**\n * Update margin for an existing position (add or remove)\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.symbol - The trading pair symbol.\n * @param options.amount - The amount value.\n * @param options.context - The service context for dependencies.\n * @returns The result of the operation.\n */\n async updateMargin(options: {\n provider: PerpsProvider;\n symbol: string;\n amount: string;\n context: ServiceContext;\n }): Promise<{ success: boolean; error?: string }> {\n const { provider, symbol, amount, context } = options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n\n try {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.UpdateMargin,\n id: traceId,\n op: PerpsTraceOperations.PositionManagement,\n tags: {\n provider: context.tracingContext.provider,\n symbol,\n isAdd: String(parseFloat(amount) > 0),\n isTestnet: String(context.tracingContext.isTestnet),\n },\n });\n\n // Call provider method\n const result = await provider.updateMargin?.({ symbol, amount });\n\n if (!result) {\n throw new Error('Provider does not support margin adjustment');\n }\n\n const completionDuration = this.#deps.performance.now() - startTime;\n\n if (result.success) {\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n\n // Track success analytics\n this.#deps.metrics.trackPerpsEvent(PerpsAnalyticsEvent.RiskManagement, {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.EXECUTED,\n [PERPS_EVENT_PROPERTY.ASSET]: symbol,\n [PERPS_EVENT_PROPERTY.ACTION]:\n parseFloat(amount) > 0 ? 'add_margin' : 'remove_margin',\n [PERPS_EVENT_PROPERTY.MARGIN_USED]: Math.abs(parseFloat(amount)),\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n });\n\n // Invalidate standalone caches so external hooks refresh\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'positions' });\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'accountState' });\n } else {\n // Track failure analytics for a non-throwing provider failure so the\n // terminal Risk Management event is emitted exactly once here (the\n // thrown path below handles exceptions).\n this.#deps.metrics.trackPerpsEvent(PerpsAnalyticsEvent.RiskManagement, {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: symbol,\n [PERPS_EVENT_PROPERTY.ACTION]:\n parseFloat(amount) > 0 ? 'add_margin' : 'remove_margin',\n [PERPS_EVENT_PROPERTY.MARGIN_USED]: Math.abs(parseFloat(amount)),\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: result.error ?? 'Unknown error',\n });\n }\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.UpdateMargin,\n id: traceId,\n data: { success: result.success, error: result.error ?? '' },\n });\n\n return result;\n } catch (error) {\n const completionDuration = this.#deps.performance.now() - startTime;\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error';\n\n this.#deps.logger.error(\n ensureError(error, 'TradingService.updateMargin'),\n this.#getErrorContext('updateMargin', { symbol, amount }),\n );\n\n // Track failure analytics\n this.#deps.metrics.trackPerpsEvent(PerpsAnalyticsEvent.RiskManagement, {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: symbol,\n [PERPS_EVENT_PROPERTY.ACTION]:\n parseFloat(amount) > 0 ? 'add_margin' : 'remove_margin',\n [PERPS_EVENT_PROPERTY.MARGIN_USED]: Math.abs(parseFloat(amount)),\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: errorMessage,\n });\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.UpdateMargin,\n id: traceId,\n data: { success: false, error: errorMessage },\n });\n\n throw error;\n }\n }\n\n /**\n * Flip position (reverse direction while keeping size and leverage)\n *\n * @param options - The configuration options.\n * @param options.provider - The perps provider instance.\n * @param options.position - The position data.\n * @param options.trackingData - Optional tracking data for analytics events.\n * @param options.context - The service context for dependencies.\n * @returns The result of the operation.\n */\n async flipPosition(options: {\n provider: PerpsProvider;\n position: Position;\n trackingData?: TrackingData;\n context: ServiceContext;\n }): Promise<OrderResult> {\n const { provider, position, trackingData, context } = options;\n const traceId = uuidv4();\n const startTime = this.#deps.performance.now();\n\n try {\n this.#deps.tracer.trace({\n name: PerpsTraceNames.FlipPosition,\n id: traceId,\n op: PerpsTraceOperations.PositionManagement,\n tags: {\n provider: context.tracingContext.provider,\n symbol: position.symbol,\n isTestnet: String(context.tracingContext.isTestnet),\n },\n });\n\n // Calculate flip parameters\n const positionSize = Math.abs(parseFloat(position.size));\n const isCurrentlyLong = parseFloat(position.size) > 0;\n const oppositeDirection = !isCurrentlyLong;\n\n const flipSize = positionSize * 2;\n\n // Direction-specific flip action, shared by the submitted and terminal events\n const flipAction = isCurrentlyLong\n ? PERPS_EVENT_VALUE.ACTION.FLIP_LONG_TO_SHORT\n : PERPS_EVENT_VALUE.ACTION.FLIP_SHORT_TO_LONG;\n\n // Create order params for flip\n // Use 2x position size: 1x to close current position + 1x to open opposite position.\n // Do not pass the position entry price as currentPrice: the provider must fetch\n // live market data for validation and IOC pricing.\n const orderParams: OrderParams = {\n symbol: position.symbol,\n isBuy: oppositeDirection,\n size: flipSize.toString(),\n orderType: 'market',\n leverage: position.leverage?.value,\n };\n\n // Emit submitted event before the provider round-trip, keeping flip\n // trades aligned with the consolidated placeOrder pipeline.\n this.#trackSubmitted(PerpsAnalyticsEvent.TradeTransaction, {\n [PERPS_EVENT_PROPERTY.ASSET]: position.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: oppositeDirection\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: 'market',\n [PERPS_EVENT_PROPERTY.LEVERAGE]: position.leverage?.value || 1,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: positionSize,\n [PERPS_EVENT_PROPERTY.ACTION]: flipAction,\n ...this.#buildAttributionProperties(trackingData),\n });\n\n const feeResolution = await this.#calculateFeeDiscountWithMeasurement();\n // Place flip order (HyperLiquid handles margin transfer automatically)\n const result = await this.#withFeeDiscount({\n provider,\n feeResolution,\n operation: () => provider.placeOrder(orderParams),\n });\n\n const completionDuration = this.#deps.performance.now() - startTime;\n\n const executedPrice = parseFloat(\n result.averagePrice ?? position.entryPrice,\n );\n\n if (result.success) {\n // Update state on success\n if (context.stateManager) {\n context.stateManager.update((state) => {\n state.lastUpdateTimestamp = Date.now();\n });\n }\n\n // Track success analytics with direction-specific flip action\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.TradeTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.EXECUTED,\n [PERPS_EVENT_PROPERTY.ASSET]: position.symbol,\n [PERPS_EVENT_PROPERTY.DIRECTION]: oppositeDirection\n ? PERPS_EVENT_VALUE.DIRECTION.LONG\n : PERPS_EVENT_VALUE.DIRECTION.SHORT,\n [PERPS_EVENT_PROPERTY.ORDER_TYPE]: 'market',\n [PERPS_EVENT_PROPERTY.LEVERAGE]: position.leverage?.value || 1,\n [PERPS_EVENT_PROPERTY.ORDER_SIZE]: positionSize,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ACTION]: flipAction,\n [PERPS_EVENT_PROPERTY.ORDER_VALUE]: positionSize * executedPrice,\n // MetaMask fee on flip trades\n ...(trackingData?.metamaskFee !== undefined && {\n [PERPS_EVENT_PROPERTY.METAMASK_FEE]: trackingData.metamaskFee,\n }),\n ...(trackingData?.vipTier !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_TIER]: trackingData.vipTier,\n }),\n ...(trackingData?.vipDiscount !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_DISCOUNT]: trackingData.vipDiscount,\n }),\n ...this.#buildAttributionProperties(trackingData),\n },\n );\n\n // Invalidate standalone caches so external hooks refresh\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'positions' });\n this.#deps.cacheInvalidator.invalidate({ cacheType: 'accountState' });\n } else {\n // Provider rejected the flip without throwing: emit a terminal failed\n // event so every submitted flip is paired with executed or failed.\n this.#deps.metrics.trackPerpsEvent(\n PerpsAnalyticsEvent.TradeTransaction,\n {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: position.symbol,\n [PERPS_EVENT_PROPERTY.ACTION]: flipAction,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]:\n result.error ?? 'Unknown error',\n ...(trackingData?.vipTier !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_TIER]: trackingData.vipTier,\n }),\n ...(trackingData?.vipDiscount !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_DISCOUNT]: trackingData.vipDiscount,\n }),\n ...this.#buildAttributionProperties(trackingData),\n },\n );\n }\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.FlipPosition,\n id: traceId,\n data: { success: result.success ?? false, error: result.error ?? '' },\n });\n\n return result;\n } catch (error) {\n const completionDuration = this.#deps.performance.now() - startTime;\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error';\n\n this.#deps.logger.error(\n ensureError(error, 'TradingService.flipPosition'),\n this.#getErrorContext('flipPosition', { symbol: position.symbol }),\n );\n\n // Track failure analytics with direction-specific flip action\n const wasLong = parseFloat(position.size) > 0;\n const failFlipAction = wasLong\n ? PERPS_EVENT_VALUE.ACTION.FLIP_LONG_TO_SHORT\n : PERPS_EVENT_VALUE.ACTION.FLIP_SHORT_TO_LONG;\n\n this.#deps.metrics.trackPerpsEvent(PerpsAnalyticsEvent.TradeTransaction, {\n [PERPS_EVENT_PROPERTY.STATUS]: PERPS_EVENT_VALUE.STATUS.FAILED,\n [PERPS_EVENT_PROPERTY.ASSET]: position.symbol,\n [PERPS_EVENT_PROPERTY.ACTION]: failFlipAction,\n [PERPS_EVENT_PROPERTY.COMPLETION_DURATION]: completionDuration,\n [PERPS_EVENT_PROPERTY.ERROR_MESSAGE]: errorMessage,\n ...(trackingData?.vipTier !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_TIER]: trackingData.vipTier,\n }),\n ...(trackingData?.vipDiscount !== undefined && {\n [PERPS_EVENT_PROPERTY.VIP_DISCOUNT]: trackingData.vipDiscount,\n }),\n ...this.#buildAttributionProperties(trackingData),\n });\n\n this.#deps.tracer.endTrace({\n name: PerpsTraceNames.FlipPosition,\n id: traceId,\n data: { success: false, error: errorMessage },\n });\n\n throw error;\n }\n }\n}\n"]}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.cjs","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetId, CaipChainId, Hex } from '@metamask/utils';\n\n// WebSocket endpoints interface\nexport type HyperLiquidEndpoints = {\n mainnet: string;\n testnet: string;\n};\n\n// Asset configuration interface\nexport type AssetNetworkConfig = {\n mainnet: CaipAssetId;\n testnet: CaipAssetId;\n};\n\nexport type HyperLiquidAssetConfigs = {\n usdc: AssetNetworkConfig;\n};\n\n// Bridge contract configuration interface\nexport type BridgeContractConfig = {\n chainId: CaipChainId;\n contractAddress: Hex;\n};\n\nexport type HyperLiquidBridgeContracts = {\n mainnet: BridgeContractConfig;\n testnet: BridgeContractConfig;\n};\n\n// SDK transport configuration interface\nexport type TransportReconnectConfig = {\n maxRetries: number;\n connectionTimeout: number;\n};\n\nexport type TransportKeepAliveConfig = {\n interval: number;\n};\n\nexport type HyperLiquidTransportConfig = {\n timeout: number;\n keepAlive: TransportKeepAliveConfig;\n reconnect: TransportReconnectConfig;\n};\n\n// Trading configuration interface\nexport type TradingAmountConfig = {\n mainnet: number;\n testnet: number;\n};\n\nexport type TradingDefaultsConfig = {\n leverage: number;\n marginPercent: number;\n takeProfitPercent: number;\n stopLossPercent: number;\n amount: TradingAmountConfig;\n};\n\n// Fee configuration interface\nexport type FeeRatesConfig = {\n taker: number;\n maker: number;\n};\n\n// Network type helper\nexport type HyperLiquidNetwork = 'mainnet' | 'testnet';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.cts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,EAAE,wBAAwB;AAGrE,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAGF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,wBAAwB,CAAC;IACpC,SAAS,EAAE,wBAAwB,CAAC;CACrC,CAAC;AAGF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAGF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC"}
@@ -1,49 +0,0 @@
1
- import type { CaipAssetId, CaipChainId, Hex } from "@metamask/utils";
2
- export type HyperLiquidEndpoints = {
3
- mainnet: string;
4
- testnet: string;
5
- };
6
- export type AssetNetworkConfig = {
7
- mainnet: CaipAssetId;
8
- testnet: CaipAssetId;
9
- };
10
- export type HyperLiquidAssetConfigs = {
11
- usdc: AssetNetworkConfig;
12
- };
13
- export type BridgeContractConfig = {
14
- chainId: CaipChainId;
15
- contractAddress: Hex;
16
- };
17
- export type HyperLiquidBridgeContracts = {
18
- mainnet: BridgeContractConfig;
19
- testnet: BridgeContractConfig;
20
- };
21
- export type TransportReconnectConfig = {
22
- maxRetries: number;
23
- connectionTimeout: number;
24
- };
25
- export type TransportKeepAliveConfig = {
26
- interval: number;
27
- };
28
- export type HyperLiquidTransportConfig = {
29
- timeout: number;
30
- keepAlive: TransportKeepAliveConfig;
31
- reconnect: TransportReconnectConfig;
32
- };
33
- export type TradingAmountConfig = {
34
- mainnet: number;
35
- testnet: number;
36
- };
37
- export type TradingDefaultsConfig = {
38
- leverage: number;
39
- marginPercent: number;
40
- takeProfitPercent: number;
41
- stopLossPercent: number;
42
- amount: TradingAmountConfig;
43
- };
44
- export type FeeRatesConfig = {
45
- taker: number;
46
- maker: number;
47
- };
48
- export type HyperLiquidNetwork = 'mainnet' | 'testnet';
49
- //# sourceMappingURL=config.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=config.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.mjs","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetId, CaipChainId, Hex } from '@metamask/utils';\n\n// WebSocket endpoints interface\nexport type HyperLiquidEndpoints = {\n mainnet: string;\n testnet: string;\n};\n\n// Asset configuration interface\nexport type AssetNetworkConfig = {\n mainnet: CaipAssetId;\n testnet: CaipAssetId;\n};\n\nexport type HyperLiquidAssetConfigs = {\n usdc: AssetNetworkConfig;\n};\n\n// Bridge contract configuration interface\nexport type BridgeContractConfig = {\n chainId: CaipChainId;\n contractAddress: Hex;\n};\n\nexport type HyperLiquidBridgeContracts = {\n mainnet: BridgeContractConfig;\n testnet: BridgeContractConfig;\n};\n\n// SDK transport configuration interface\nexport type TransportReconnectConfig = {\n maxRetries: number;\n connectionTimeout: number;\n};\n\nexport type TransportKeepAliveConfig = {\n interval: number;\n};\n\nexport type HyperLiquidTransportConfig = {\n timeout: number;\n keepAlive: TransportKeepAliveConfig;\n reconnect: TransportReconnectConfig;\n};\n\n// Trading configuration interface\nexport type TradingAmountConfig = {\n mainnet: number;\n testnet: number;\n};\n\nexport type TradingDefaultsConfig = {\n leverage: number;\n marginPercent: number;\n takeProfitPercent: number;\n stopLossPercent: number;\n amount: TradingAmountConfig;\n};\n\n// Fee configuration interface\nexport type FeeRatesConfig = {\n taker: number;\n maker: number;\n};\n\n// Network type helper\nexport type HyperLiquidNetwork = 'mainnet' | 'testnet';\n"]}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hyperLiquidModeFoldsSpot = exports.HL_UNIFIED_ACCOUNT_MODE = exports.HL_ABSTRACTION_WIRE = void 0;
4
- /**
5
- * Wire codes accepted by `agentSetAbstraction({ abstraction })`. The SDK
6
- * types these as a `"i" | "u" | "p"` literal union with no exported constant.
7
- *
8
- * Only `unifiedAccount` is referenced by the current migration flow; the
9
- * other entries document the full SDK wire format so a future caller
10
- * (e.g. emergency rollback to `disabled`, or opting into `portfolioMargin`)
11
- * does not have to re-discover the codes.
12
- */
13
- exports.HL_ABSTRACTION_WIRE = {
14
- disabled: 'i',
15
- unifiedAccount: 'u',
16
- portfolioMargin: 'p',
17
- };
18
- /**
19
- * Long-form abstraction-mode value targeted by the migration. Used as the
20
- * `abstraction` parameter for `userSetAbstraction` and as the success / target
21
- * value reported by Account Setup analytics.
22
- */
23
- exports.HL_UNIFIED_ACCOUNT_MODE = 'unifiedAccount';
24
- /**
25
- * True when the given HL abstraction mode treats spot USDC as perps collateral.
26
- * Used by the provider + subscription service to gate `addSpotBalanceToAccountState`'s
27
- * `foldIntoCollateral` option.
28
- *
29
- * Fail-CLOSED on missing mode: until userAbstraction has been resolved we do
30
- * NOT fold spot, because over-reporting withdrawable funds for Standard /
31
- * dexAbstraction users (which `withdraw3` cannot actually draw) is worse than
32
- * briefly under-reporting for Unified users during the initial subscription
33
- * window or a transient REST outage.
34
- *
35
- * @param mode - Abstraction mode from `userAbstraction` endpoint; null/undefined means unknown.
36
- * @returns `true` when spot folds into spendable/withdrawable (Unified / Portfolio); `false` for Standard / DEX abstraction / unknown.
37
- */
38
- function hyperLiquidModeFoldsSpot(mode) {
39
- if (mode === null || mode === undefined) {
40
- return false;
41
- }
42
- return mode === 'unifiedAccount' || mode === 'portfolioMargin';
43
- }
44
- exports.hyperLiquidModeFoldsSpot = hyperLiquidModeFoldsSpot;
45
- //# sourceMappingURL=hyperliquid-types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hyperliquid-types.cjs","sourceRoot":"","sources":["../../src/types/hyperliquid-types.ts"],"names":[],"mappings":";;;AAmCA;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAG;IACjC,QAAQ,EAAE,GAAG;IACb,cAAc,EAAE,GAAG;IACnB,eAAe,EAAE,GAAG;CACZ,CAAC;AAEX;;;;GAIG;AACU,QAAA,uBAAuB,GAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,SAAgB,wBAAwB,CACtC,IAAwC;IAExC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,KAAK,gBAAgB,IAAI,IAAI,KAAK,iBAAiB,CAAC;AACjE,CAAC;AAPD,4DAOC","sourcesContent":["/**\n * HyperLiquid SDK Type Aliases\n *\n * The @nktkas/hyperliquid SDK only exports Response types (e.g., ClearinghouseStateResponse).\n * We extract commonly-used nested types here to avoid repetitive type extraction syntax.\n *\n * Pattern: Import Response types, extract nested types using TypeScript index access.\n * This is the SDK's intentional design - not bad practice!\n */\nimport type {\n ClearinghouseStateResponse,\n SpotClearinghouseStateResponse,\n MetaResponse,\n FrontendOpenOrdersResponse,\n MetaAndAssetCtxsResponse,\n AllMidsResponse,\n PredictedFundingsResponse,\n OrderParameters,\n SpotMetaResponse,\n UserAbstractionResponse,\n} from '@nktkas/hyperliquid';\n\n/**\n * HL account abstraction mode returned by the `userAbstraction` info endpoint.\n * Re-exported here to keep HL-specific types centralised.\n *\n * `unifiedAccount` / `portfolioMargin`: spot is unified with perps;\n * `withdraw3` draws from the unified ledger, spot folds into perps collateral.\n *\n * `disabled` (Standard) / `dexAbstraction` (deprecated) / `default` (unset):\n * spot and perps are separate ledgers; spot is NOT auto-collateral until the\n * user is migrated to unified mode.\n */\nexport type HyperLiquidAbstractionMode = UserAbstractionResponse;\n\n/**\n * Wire codes accepted by `agentSetAbstraction({ abstraction })`. The SDK\n * types these as a `\"i\" | \"u\" | \"p\"` literal union with no exported constant.\n *\n * Only `unifiedAccount` is referenced by the current migration flow; the\n * other entries document the full SDK wire format so a future caller\n * (e.g. emergency rollback to `disabled`, or opting into `portfolioMargin`)\n * does not have to re-discover the codes.\n */\nexport const HL_ABSTRACTION_WIRE = {\n disabled: 'i',\n unifiedAccount: 'u',\n portfolioMargin: 'p',\n} as const;\n\n/**\n * Long-form abstraction-mode value targeted by the migration. Used as the\n * `abstraction` parameter for `userSetAbstraction` and as the success / target\n * value reported by Account Setup analytics.\n */\nexport const HL_UNIFIED_ACCOUNT_MODE = 'unifiedAccount' as const;\n\n/**\n * True when the given HL abstraction mode treats spot USDC as perps collateral.\n * Used by the provider + subscription service to gate `addSpotBalanceToAccountState`'s\n * `foldIntoCollateral` option.\n *\n * Fail-CLOSED on missing mode: until userAbstraction has been resolved we do\n * NOT fold spot, because over-reporting withdrawable funds for Standard /\n * dexAbstraction users (which `withdraw3` cannot actually draw) is worse than\n * briefly under-reporting for Unified users during the initial subscription\n * window or a transient REST outage.\n *\n * @param mode - Abstraction mode from `userAbstraction` endpoint; null/undefined means unknown.\n * @returns `true` when spot folds into spendable/withdrawable (Unified / Portfolio); `false` for Standard / DEX abstraction / unknown.\n */\nexport function hyperLiquidModeFoldsSpot(\n mode?: HyperLiquidAbstractionMode | null,\n): boolean {\n if (mode === null || mode === undefined) {\n return false;\n }\n return mode === 'unifiedAccount' || mode === 'portfolioMargin';\n}\n\n// Clearinghouse (Account) Types\nexport type AssetPosition =\n ClearinghouseStateResponse['assetPositions'][number];\nexport type SpotBalance = SpotClearinghouseStateResponse['balances'][number];\n\n// Market/Asset Types\nexport type PerpsUniverse = MetaResponse['universe'][number];\nexport type PerpsAssetCtx = MetaAndAssetCtxsResponse[1][number];\nexport type PredictedFunding = PredictedFundingsResponse[number];\n\n// Order Types\nexport type FrontendOrder = FrontendOpenOrdersResponse[number];\nexport type SDKOrderParams = OrderParameters['orders'][number];\nexport type OrderType = FrontendOrder['orderType'];\n\n// Re-export Response types for convenience\nexport type {\n ClearinghouseStateResponse,\n SpotClearinghouseStateResponse,\n MetaResponse,\n FrontendOpenOrdersResponse,\n AllMidsResponse,\n MetaAndAssetCtxsResponse,\n PredictedFundingsResponse,\n SpotMetaResponse,\n UserAbstractionResponse,\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hyperliquid-types.d.cts","sourceRoot":"","sources":["../../src/types/hyperliquid-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EACV,0BAA0B,EAC1B,8BAA8B,EAC9B,YAAY,EACZ,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,4BAA4B;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAEjE;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,kBAA4B,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,CAAC,EAAE,0BAA0B,GAAG,IAAI,GACvC,OAAO,CAKT;AAGD,MAAM,MAAM,aAAa,GACvB,0BAA0B,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,8BAA8B,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAG7E,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAGjE,MAAM,MAAM,aAAa,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAC/D,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAGnD,YAAY,EACV,0BAA0B,EAC1B,8BAA8B,EAC9B,YAAY,EACZ,0BAA0B,EAC1B,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,GACxB,CAAC"}
@@ -1,67 +0,0 @@
1
- /**
2
- * HyperLiquid SDK Type Aliases
3
- *
4
- * The @nktkas/hyperliquid SDK only exports Response types (e.g., ClearinghouseStateResponse).
5
- * We extract commonly-used nested types here to avoid repetitive type extraction syntax.
6
- *
7
- * Pattern: Import Response types, extract nested types using TypeScript index access.
8
- * This is the SDK's intentional design - not bad practice!
9
- */
10
- import type { ClearinghouseStateResponse, SpotClearinghouseStateResponse, MetaResponse, FrontendOpenOrdersResponse, MetaAndAssetCtxsResponse, AllMidsResponse, PredictedFundingsResponse, OrderParameters, SpotMetaResponse, UserAbstractionResponse } from "@nktkas/hyperliquid";
11
- /**
12
- * HL account abstraction mode returned by the `userAbstraction` info endpoint.
13
- * Re-exported here to keep HL-specific types centralised.
14
- *
15
- * `unifiedAccount` / `portfolioMargin`: spot is unified with perps;
16
- * `withdraw3` draws from the unified ledger, spot folds into perps collateral.
17
- *
18
- * `disabled` (Standard) / `dexAbstraction` (deprecated) / `default` (unset):
19
- * spot and perps are separate ledgers; spot is NOT auto-collateral until the
20
- * user is migrated to unified mode.
21
- */
22
- export type HyperLiquidAbstractionMode = UserAbstractionResponse;
23
- /**
24
- * Wire codes accepted by `agentSetAbstraction({ abstraction })`. The SDK
25
- * types these as a `"i" | "u" | "p"` literal union with no exported constant.
26
- *
27
- * Only `unifiedAccount` is referenced by the current migration flow; the
28
- * other entries document the full SDK wire format so a future caller
29
- * (e.g. emergency rollback to `disabled`, or opting into `portfolioMargin`)
30
- * does not have to re-discover the codes.
31
- */
32
- export declare const HL_ABSTRACTION_WIRE: {
33
- readonly disabled: "i";
34
- readonly unifiedAccount: "u";
35
- readonly portfolioMargin: "p";
36
- };
37
- /**
38
- * Long-form abstraction-mode value targeted by the migration. Used as the
39
- * `abstraction` parameter for `userSetAbstraction` and as the success / target
40
- * value reported by Account Setup analytics.
41
- */
42
- export declare const HL_UNIFIED_ACCOUNT_MODE: "unifiedAccount";
43
- /**
44
- * True when the given HL abstraction mode treats spot USDC as perps collateral.
45
- * Used by the provider + subscription service to gate `addSpotBalanceToAccountState`'s
46
- * `foldIntoCollateral` option.
47
- *
48
- * Fail-CLOSED on missing mode: until userAbstraction has been resolved we do
49
- * NOT fold spot, because over-reporting withdrawable funds for Standard /
50
- * dexAbstraction users (which `withdraw3` cannot actually draw) is worse than
51
- * briefly under-reporting for Unified users during the initial subscription
52
- * window or a transient REST outage.
53
- *
54
- * @param mode - Abstraction mode from `userAbstraction` endpoint; null/undefined means unknown.
55
- * @returns `true` when spot folds into spendable/withdrawable (Unified / Portfolio); `false` for Standard / DEX abstraction / unknown.
56
- */
57
- export declare function hyperLiquidModeFoldsSpot(mode?: HyperLiquidAbstractionMode | null): boolean;
58
- export type AssetPosition = ClearinghouseStateResponse['assetPositions'][number];
59
- export type SpotBalance = SpotClearinghouseStateResponse['balances'][number];
60
- export type PerpsUniverse = MetaResponse['universe'][number];
61
- export type PerpsAssetCtx = MetaAndAssetCtxsResponse[1][number];
62
- export type PredictedFunding = PredictedFundingsResponse[number];
63
- export type FrontendOrder = FrontendOpenOrdersResponse[number];
64
- export type SDKOrderParams = OrderParameters['orders'][number];
65
- export type OrderType = FrontendOrder['orderType'];
66
- export type { ClearinghouseStateResponse, SpotClearinghouseStateResponse, MetaResponse, FrontendOpenOrdersResponse, AllMidsResponse, MetaAndAssetCtxsResponse, PredictedFundingsResponse, SpotMetaResponse, UserAbstractionResponse, };
67
- //# sourceMappingURL=hyperliquid-types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hyperliquid-types.d.mts","sourceRoot":"","sources":["../../src/types/hyperliquid-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAA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version":3,"file":"hyperliquid-types.mjs","sourceRoot":"","sources":["../../src/types/hyperliquid-types.ts"],"names":[],"mappings":"AAmCA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ,EAAE,GAAG;IACb,cAAc,EAAE,GAAG;IACnB,eAAe,EAAE,GAAG;CACZ,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAyB,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAwC;IAExC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,KAAK,gBAAgB,IAAI,IAAI,KAAK,iBAAiB,CAAC;AACjE,CAAC","sourcesContent":["/**\n * HyperLiquid SDK Type Aliases\n *\n * The @nktkas/hyperliquid SDK only exports Response types (e.g., ClearinghouseStateResponse).\n * We extract commonly-used nested types here to avoid repetitive type extraction syntax.\n *\n * Pattern: Import Response types, extract nested types using TypeScript index access.\n * This is the SDK's intentional design - not bad practice!\n */\nimport type {\n ClearinghouseStateResponse,\n SpotClearinghouseStateResponse,\n MetaResponse,\n FrontendOpenOrdersResponse,\n MetaAndAssetCtxsResponse,\n AllMidsResponse,\n PredictedFundingsResponse,\n OrderParameters,\n SpotMetaResponse,\n UserAbstractionResponse,\n} from '@nktkas/hyperliquid';\n\n/**\n * HL account abstraction mode returned by the `userAbstraction` info endpoint.\n * Re-exported here to keep HL-specific types centralised.\n *\n * `unifiedAccount` / `portfolioMargin`: spot is unified with perps;\n * `withdraw3` draws from the unified ledger, spot folds into perps collateral.\n *\n * `disabled` (Standard) / `dexAbstraction` (deprecated) / `default` (unset):\n * spot and perps are separate ledgers; spot is NOT auto-collateral until the\n * user is migrated to unified mode.\n */\nexport type HyperLiquidAbstractionMode = UserAbstractionResponse;\n\n/**\n * Wire codes accepted by `agentSetAbstraction({ abstraction })`. The SDK\n * types these as a `\"i\" | \"u\" | \"p\"` literal union with no exported constant.\n *\n * Only `unifiedAccount` is referenced by the current migration flow; the\n * other entries document the full SDK wire format so a future caller\n * (e.g. emergency rollback to `disabled`, or opting into `portfolioMargin`)\n * does not have to re-discover the codes.\n */\nexport const HL_ABSTRACTION_WIRE = {\n disabled: 'i',\n unifiedAccount: 'u',\n portfolioMargin: 'p',\n} as const;\n\n/**\n * Long-form abstraction-mode value targeted by the migration. Used as the\n * `abstraction` parameter for `userSetAbstraction` and as the success / target\n * value reported by Account Setup analytics.\n */\nexport const HL_UNIFIED_ACCOUNT_MODE = 'unifiedAccount' as const;\n\n/**\n * True when the given HL abstraction mode treats spot USDC as perps collateral.\n * Used by the provider + subscription service to gate `addSpotBalanceToAccountState`'s\n * `foldIntoCollateral` option.\n *\n * Fail-CLOSED on missing mode: until userAbstraction has been resolved we do\n * NOT fold spot, because over-reporting withdrawable funds for Standard /\n * dexAbstraction users (which `withdraw3` cannot actually draw) is worse than\n * briefly under-reporting for Unified users during the initial subscription\n * window or a transient REST outage.\n *\n * @param mode - Abstraction mode from `userAbstraction` endpoint; null/undefined means unknown.\n * @returns `true` when spot folds into spendable/withdrawable (Unified / Portfolio); `false` for Standard / DEX abstraction / unknown.\n */\nexport function hyperLiquidModeFoldsSpot(\n mode?: HyperLiquidAbstractionMode | null,\n): boolean {\n if (mode === null || mode === undefined) {\n return false;\n }\n return mode === 'unifiedAccount' || mode === 'portfolioMargin';\n}\n\n// Clearinghouse (Account) Types\nexport type AssetPosition =\n ClearinghouseStateResponse['assetPositions'][number];\nexport type SpotBalance = SpotClearinghouseStateResponse['balances'][number];\n\n// Market/Asset Types\nexport type PerpsUniverse = MetaResponse['universe'][number];\nexport type PerpsAssetCtx = MetaAndAssetCtxsResponse[1][number];\nexport type PredictedFunding = PredictedFundingsResponse[number];\n\n// Order Types\nexport type FrontendOrder = FrontendOpenOrdersResponse[number];\nexport type SDKOrderParams = OrderParameters['orders'][number];\nexport type OrderType = FrontendOrder['orderType'];\n\n// Re-export Response types for convenience\nexport type {\n ClearinghouseStateResponse,\n SpotClearinghouseStateResponse,\n MetaResponse,\n FrontendOpenOrdersResponse,\n AllMidsResponse,\n MetaAndAssetCtxsResponse,\n PredictedFundingsResponse,\n SpotMetaResponse,\n UserAbstractionResponse,\n};\n"]}