@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,301 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hashTriggerOrders = exports.toSDKTimeInForce = exports.buildTriggerOrderType = exports.resolvePositionTriggerSummaryPrice = exports.buildPositionTriggerOrderFromOrder = exports.classifyTriggerDirection = exports.getTriggerDirection = exports.getTriggerExecution = exports.isLimitExecutionOrderType = exports.isStrategyOrderType = exports.isTriggerOrderType = exports.SCALE_ORDER_COUNT = exports.STRATEGY_ORDER_TYPES = exports.TRIGGER_ORDER_TYPES = void 0;
4
- /**
5
- * All trigger placement types, in a stable order suitable for iteration
6
- * (validation tables, e2e matrices).
7
- */
8
- exports.TRIGGER_ORDER_TYPES = [
9
- 'stop_market',
10
- 'stop_limit',
11
- 'take_profit_market',
12
- 'take_profit_limit',
13
- ];
14
- /**
15
- * All strategy placement types, in a stable order suitable for iteration
16
- * (validation tables, e2e matrices).
17
- */
18
- exports.STRATEGY_ORDER_TYPES = [
19
- 'twap',
20
- 'scale',
21
- 'chase',
22
- ];
23
- /**
24
- * Bounds on how many limit orders a scale placement may fan out into.
25
- *
26
- * A ladder needs at least two rungs to span a range at all; the upper bound
27
- * keeps a single placement from consuming a venue's per-account open-order
28
- * budget. Protocol-agnostic: a provider whose venue is stricter narrows this
29
- * further in its own validation.
30
- */
31
- exports.SCALE_ORDER_COUNT = { min: 2, max: 20 };
32
- /**
33
- * Order types whose price field (`OrderParams.price`) is a real limit price the
34
- * exchange must honour, as opposed to a slippage cap derived from the market.
35
- */
36
- const LIMIT_EXECUTION_ORDER_TYPES = [
37
- 'limit',
38
- 'stop_limit',
39
- 'take_profit_limit',
40
- ];
41
- /**
42
- * Order types that rest limit orders on the book, whatever decides their price.
43
- *
44
- * A superset of `LIMIT_EXECUTION_ORDER_TYPES`: a scale ladder and a chase both
45
- * rest limit orders, but they derive their own prices rather than taking one
46
- * from `OrderParams.price`, so they are limit *execution* without being
47
- * limit-*priced*. A TWAP is absent because its suborders cross the book.
48
- *
49
- * The distinction matters wherever execution is what is being charged or
50
- * bounded — fee tier, max order value — as opposed to where the caller's price
51
- * field is being read.
52
- */
53
- const LIMIT_RESTING_ORDER_TYPES = [
54
- ...LIMIT_EXECUTION_ORDER_TYPES,
55
- 'scale',
56
- 'chase',
57
- ];
58
- /**
59
- * Check whether an order type is a trigger placement (stop / take profit).
60
- *
61
- * @param orderType - Order type to check.
62
- * @returns True when the type requires `OrderParams.triggerPrice`.
63
- */
64
- function isTriggerOrderType(orderType) {
65
- return exports.TRIGGER_ORDER_TYPES.includes(orderType);
66
- }
67
- exports.isTriggerOrderType = isTriggerOrderType;
68
- /**
69
- * Check whether an order type is a strategy placement (TWAP / scale / chase).
70
- *
71
- * @param orderType - Order type to check.
72
- * @returns True when the placement expands into an execution schedule rather
73
- * than a single order.
74
- */
75
- function isStrategyOrderType(orderType) {
76
- return exports.STRATEGY_ORDER_TYPES.includes(orderType);
77
- }
78
- exports.isStrategyOrderType = isStrategyOrderType;
79
- /**
80
- * Check whether an order type executes as a limit order.
81
- *
82
- * Covers plain limit orders and the `*_limit` trigger types, both of which
83
- * require `OrderParams.price`.
84
- *
85
- * @param orderType - Order type to check.
86
- * @returns True when the order executes as a limit order.
87
- */
88
- function isLimitExecutionOrderType(orderType) {
89
- return LIMIT_EXECUTION_ORDER_TYPES.includes(orderType);
90
- }
91
- exports.isLimitExecutionOrderType = isLimitExecutionOrderType;
92
- /**
93
- * Get how an order executes, ignoring whether it is trigger-gated.
94
- *
95
- * This is also the coarse execution type that consumers predating trigger orders
96
- * understand (fee tiers, max order value, analytics). It answers "does this rest
97
- * on the book or cross it", which is not the same question as
98
- * `isLimitExecutionOrderType` — a scale ladder and a chase rest limit orders
99
- * without carrying an `OrderParams.price`.
100
- *
101
- * @param orderType - Order type to inspect.
102
- * @returns `'limit'` for limit, `*_limit`, `scale` and `chase`; `'market'`
103
- * otherwise, including `twap`, whose suborders cross the book.
104
- */
105
- function getTriggerExecution(orderType) {
106
- return LIMIT_RESTING_ORDER_TYPES.includes(orderType)
107
- ? 'limit'
108
- : 'market';
109
- }
110
- exports.getTriggerExecution = getTriggerExecution;
111
- /**
112
- * Get the direction a trigger order fires in.
113
- *
114
- * @param orderType - Trigger order type.
115
- * @returns `'stop'` for `stop_*`, `'take_profit'` for `take_profit_*`.
116
- */
117
- function getTriggerDirection(orderType) {
118
- return orderType === 'stop_market' || orderType === 'stop_limit'
119
- ? 'stop'
120
- : 'take_profit';
121
- }
122
- exports.getTriggerDirection = getTriggerDirection;
123
- /**
124
- * Recover which way a trigger fires from its price relative to the entry.
125
- *
126
- * Used when the exchange reports a trigger without naming its placement type:
127
- * a long takes profit above its entry and stops out below, a short the other
128
- * way round. Shared by both transports so they classify identically.
129
- *
130
- * @param params - Classification parameters
131
- * @param params.triggerPrice - Price at which the order activates
132
- * @param params.entryPrice - Entry price of the position it is attached to
133
- * @param params.positionSize - Signed position size; its sign gives the side
134
- * @returns The direction, or undefined when there is nothing to compare against
135
- */
136
- function classifyTriggerDirection(params) {
137
- const { triggerPrice, entryPrice, positionSize } = params;
138
- const trigger = parseFloat(triggerPrice ?? '');
139
- const entry = parseFloat(entryPrice ?? '');
140
- const signedSize = parseFloat(positionSize || '0');
141
- if (!Number.isFinite(trigger) || !Number.isFinite(entry) || entry <= 0) {
142
- return undefined;
143
- }
144
- // A long takes profit above its entry and stops out below; a short is the
145
- // mirror image. A trigger sitting exactly at entry is neither, so both sides
146
- // fall to 'stop' — matching the legacy price fallback the scalar
147
- // takeProfitPrice/stopLossPrice fields still use. Splitting that tie the
148
- // other way would file the order under takeProfitOrders while the scalar
149
- // still reported it as a stop.
150
- const isLong = signedSize > 0;
151
- if (isLong) {
152
- return trigger > entry ? 'take_profit' : 'stop';
153
- }
154
- return trigger < entry ? 'take_profit' : 'stop';
155
- }
156
- exports.classifyTriggerDirection = classifyTriggerDirection;
157
- /**
158
- * Project a normalized open order onto the position-state view of a trigger order.
159
- *
160
- * Returns undefined when the order is not a trigger, or when its direction can
161
- * be established neither from a named placement type nor from its price.
162
- *
163
- * @param params - Mapping parameters
164
- * @param params.order - Normalized open order
165
- * @param params.positionSize - Size of the position the trigger is attached to
166
- * @param params.entryPrice - Entry price, used to classify an unnamed trigger
167
- * @returns The position trigger order, or undefined
168
- */
169
- function buildPositionTriggerOrderFromOrder(params) {
170
- const { order, positionSize, entryPrice } = params;
171
- if (!order.isTrigger) {
172
- return undefined;
173
- }
174
- // HyperLiquid sometimes reports a bare 'Trigger', naming neither direction
175
- // nor execution. The direction is still recoverable from the trigger price
176
- // against the entry, and it is what decides which array the order belongs
177
- // to — so an unnamed trigger is kept rather than dropped, with its execution
178
- // mode left unstated. Without a position to compare against there is nothing
179
- // to recover, and it is dropped.
180
- const direction = order.triggerOrderType === undefined
181
- ? classifyTriggerDirection({
182
- triggerPrice: order.triggerPrice ?? order.price,
183
- entryPrice,
184
- positionSize,
185
- })
186
- : getTriggerDirection(order.triggerOrderType);
187
- if (!direction) {
188
- return undefined;
189
- }
190
- const absolutePositionSize = Math.abs(parseFloat(positionSize || '0'));
191
- const rawSize = Math.abs(parseFloat(order.size || '0'));
192
- // A position-bound TP/SL covers whatever the position currently is. The
193
- // exchange encodes that as size 0, but `adaptOrderFromSDK` has already
194
- // resolved it against the position as it stood when the order was adapted,
195
- // so the size carried here goes stale as soon as the position is resized.
196
- // The flag is the durable statement of what the trigger covers; the number
197
- // is not. Reading the number instead would report the old size, and would
198
- // call the order partial whenever the position had since grown.
199
- const isPositionBound = order.isPositionTpsl === true;
200
- const size = isPositionBound || rawSize === 0 ? absolutePositionSize : rawSize;
201
- return {
202
- orderId: order.orderId,
203
- direction,
204
- orderType: order.triggerOrderType,
205
- triggerPrice: order.triggerPrice ?? order.price,
206
- size: size.toString(),
207
- isPartial: !isPositionBound &&
208
- rawSize > 0 &&
209
- absolutePositionSize > 0 &&
210
- rawSize < absolutePositionSize,
211
- reduceOnly: Boolean(order.reduceOnly),
212
- };
213
- }
214
- exports.buildPositionTriggerOrderFromOrder = buildPositionTriggerOrderFromOrder;
215
- /**
216
- * Resolve the scalar TP/SL summary price a position reports for one direction.
217
- *
218
- * The scalar fields are only ever scanned from position-bound triggers, so a
219
- * position whose only take profit (or stop loss) is quantity-scoped reported a
220
- * count of 1 with no price — and a client that renders the scalar showed
221
- * nothing. When the direction has exactly one trigger order, that order is the
222
- * price, whether or not it is position-bound.
223
- *
224
- * Two or more triggers keep the scanned value: no single price describes them,
225
- * and clients render the count instead. Zero triggers keep it too, because it
226
- * still carries the TP/SL of a *pending* order on the market, which the arrays
227
- * deliberately exclude.
228
- *
229
- * @param params - Resolution parameters
230
- * @param params.triggerOrders - Trigger orders attached to the position for one direction
231
- * @param params.scannedPrice - Price scanned from position-bound triggers, if any
232
- * @returns The price to report, or undefined when there is none
233
- */
234
- function resolvePositionTriggerSummaryPrice(params) {
235
- const { triggerOrders, scannedPrice } = params;
236
- if (triggerOrders.length === 1) {
237
- return triggerOrders[0].triggerPrice;
238
- }
239
- return scannedPrice;
240
- }
241
- exports.resolvePositionTriggerSummaryPrice = resolvePositionTriggerSummaryPrice;
242
- /**
243
- * Build a trigger order type from its two independent dimensions.
244
- *
245
- * @param params - Trigger dimensions.
246
- * @param params.direction - Whether the trigger is a stop or a take profit.
247
- * @param params.execution - How the order executes once triggered.
248
- * @returns The matching trigger order type.
249
- */
250
- function buildTriggerOrderType(params) {
251
- const { direction, execution } = params;
252
- if (direction === 'stop') {
253
- return execution === 'limit' ? 'stop_limit' : 'stop_market';
254
- }
255
- return execution === 'limit' ? 'take_profit_limit' : 'take_profit_market';
256
- }
257
- exports.buildTriggerOrderType = buildTriggerOrderType;
258
- /**
259
- * Map the controller's time in force onto the exchange's spelling.
260
- *
261
- * Shared by the two order-building paths so they cannot drift apart.
262
- *
263
- * @param timeInForce - Requested time in force; defaults to GTC.
264
- * @returns The SDK time-in-force value.
265
- */
266
- function toSDKTimeInForce(timeInForce) {
267
- switch (timeInForce) {
268
- case 'IOC':
269
- return 'Ioc';
270
- case 'ALO':
271
- return 'Alo';
272
- default:
273
- return 'Gtc';
274
- }
275
- }
276
- exports.toSDKTimeInForce = toSDKTimeInForce;
277
- /**
278
- * Hash the identity of a position's trigger orders for change detection.
279
- *
280
- * Streamed positions only re-emit when their hash changes, so this has to move
281
- * when a trigger is added, removed, repriced, resized, or retyped — otherwise
282
- * subscribers never receive the updated arrays.
283
- *
284
- * The placement type is part of the identity because a trigger can be modified
285
- * in place: switching a stop from market to limit execution keeps its order ID,
286
- * trigger price, and size, so nothing else here would move even though the
287
- * execution semantics subscribers rely on have changed.
288
- *
289
- * @param orders - Trigger orders attached to a position, if any.
290
- * @returns A stable string; `'0'` for both empty and absent.
291
- */
292
- function hashTriggerOrders(orders) {
293
- if (!orders || orders.length === 0) {
294
- return '0';
295
- }
296
- return orders
297
- .map((order) => `${order.orderId}:${order.direction}:${order.orderType ?? '?'}@${order.triggerPrice}x${order.size}${order.isPartial ? 'p' : ''}`)
298
- .join(',');
299
- }
300
- exports.hashTriggerOrders = hashTriggerOrders;
301
- //# sourceMappingURL=orderTypes.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orderTypes.cjs","sourceRoot":"","sources":["../../src/utils/orderTypes.ts"],"names":[],"mappings":";;;AASA;;;GAGG;AACU,QAAA,mBAAmB,GAAG;IACjC,aAAa;IACb,YAAY;IACZ,oBAAoB;IACpB,mBAAmB;CAC2B,CAAC;AAEjD;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,MAAM;IACN,OAAO;IACP,OAAO;CACwC,CAAC;AAElD;;;;;;;GAOG;AACU,QAAA,iBAAiB,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAW,CAAC;AAE9D;;;GAGG;AACH,MAAM,2BAA2B,GAAG;IAClC,OAAO;IACP,YAAY;IACZ,mBAAmB;CACoB,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,MAAM,yBAAyB,GAAG;IAChC,GAAG,2BAA2B;IAC9B,OAAO;IACP,OAAO;CACgC,CAAC;AAE1C;;;;;GAKG;AACH,SAAgB,kBAAkB,CAChC,SAAoB;IAEpB,OAAQ,2BAA4C,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC3E,CAAC;AAJD,gDAIC;AAED;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;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC9B,WAAmC;IAEnC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAXD,4CAWC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iBAAiB,CAAC,MAA+B;IAC/D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,MAAM;SACV,GAAG,CACF,CAAC,KAAK,EAAE,EAAE,CACR,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,IAAI,GAAG,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACnI;SACA,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAVD,8CAUC","sourcesContent":["import type { Order, PositionTriggerOrder } from '../types/index.js';\nimport type {\n OrderExecution,\n OrderType,\n StrategyOrderType,\n TriggerDirection,\n TriggerOrderType,\n} from '../types/perps-types.js';\n\n/**\n * All trigger placement types, in a stable order suitable for iteration\n * (validation tables, e2e matrices).\n */\nexport const TRIGGER_ORDER_TYPES = [\n 'stop_market',\n 'stop_limit',\n 'take_profit_market',\n 'take_profit_limit',\n] as const satisfies readonly TriggerOrderType[];\n\n/**\n * All strategy placement types, in a stable order suitable for iteration\n * (validation tables, e2e matrices).\n */\nexport const STRATEGY_ORDER_TYPES = [\n 'twap',\n 'scale',\n 'chase',\n] as const satisfies readonly StrategyOrderType[];\n\n/**\n * Bounds on how many limit orders a scale placement may fan out into.\n *\n * A ladder needs at least two rungs to span a range at all; the upper bound\n * keeps a single placement from consuming a venue's per-account open-order\n * budget. Protocol-agnostic: a provider whose venue is stricter narrows this\n * further in its own validation.\n */\nexport const SCALE_ORDER_COUNT = { min: 2, max: 20 } as const;\n\n/**\n * Order types whose price field (`OrderParams.price`) is a real limit price the\n * exchange must honour, as opposed to a slippage cap derived from the market.\n */\nconst LIMIT_EXECUTION_ORDER_TYPES = [\n 'limit',\n 'stop_limit',\n 'take_profit_limit',\n] as const satisfies readonly OrderType[];\n\n/**\n * Order types that rest limit orders on the book, whatever decides their price.\n *\n * A superset of `LIMIT_EXECUTION_ORDER_TYPES`: a scale ladder and a chase both\n * rest limit orders, but they derive their own prices rather than taking one\n * from `OrderParams.price`, so they are limit *execution* without being\n * limit-*priced*. A TWAP is absent because its suborders cross the book.\n *\n * The distinction matters wherever execution is what is being charged or\n * bounded — fee tier, max order value — as opposed to where the caller's price\n * field is being read.\n */\nconst LIMIT_RESTING_ORDER_TYPES = [\n ...LIMIT_EXECUTION_ORDER_TYPES,\n 'scale',\n 'chase',\n] as const satisfies readonly OrderType[];\n\n/**\n * Check whether an order type is a trigger placement (stop / take profit).\n *\n * @param orderType - Order type to check.\n * @returns True when the type requires `OrderParams.triggerPrice`.\n */\nexport function isTriggerOrderType(\n orderType: OrderType,\n): orderType is TriggerOrderType {\n return (TRIGGER_ORDER_TYPES as readonly OrderType[]).includes(orderType);\n}\n\n/**\n * Check whether an order type is a strategy placement (TWAP / scale / chase).\n *\n * @param orderType - Order type to check.\n * @returns True when the placement expands into an execution schedule rather\n * than a single order.\n */\nexport function isStrategyOrderType(\n orderType: OrderType,\n): orderType is StrategyOrderType {\n return (STRATEGY_ORDER_TYPES as readonly OrderType[]).includes(orderType);\n}\n\n/**\n * Check whether an order type executes as a limit order.\n *\n * Covers plain limit orders and the `*_limit` trigger types, both of which\n * require `OrderParams.price`.\n *\n * @param orderType - Order type to check.\n * @returns True when the order executes as a limit order.\n */\nexport function isLimitExecutionOrderType(orderType: OrderType): boolean {\n return (LIMIT_EXECUTION_ORDER_TYPES as readonly OrderType[]).includes(\n orderType,\n );\n}\n\n/**\n * Get how an order executes, ignoring whether it is trigger-gated.\n *\n * This is also the coarse execution type that consumers predating trigger orders\n * understand (fee tiers, max order value, analytics). It answers \"does this rest\n * on the book or cross it\", which is not the same question as\n * `isLimitExecutionOrderType` — a scale ladder and a chase rest limit orders\n * without carrying an `OrderParams.price`.\n *\n * @param orderType - Order type to inspect.\n * @returns `'limit'` for limit, `*_limit`, `scale` and `chase`; `'market'`\n * otherwise, including `twap`, whose suborders cross the book.\n */\nexport function getTriggerExecution(orderType: OrderType): OrderExecution {\n return (LIMIT_RESTING_ORDER_TYPES as readonly OrderType[]).includes(orderType)\n ? 'limit'\n : 'market';\n}\n\n/**\n * Get the direction a trigger order fires in.\n *\n * @param orderType - Trigger order type.\n * @returns `'stop'` for `stop_*`, `'take_profit'` for `take_profit_*`.\n */\nexport function getTriggerDirection(\n orderType: TriggerOrderType,\n): TriggerDirection {\n return orderType === 'stop_market' || orderType === 'stop_limit'\n ? 'stop'\n : 'take_profit';\n}\n\n/**\n * Recover which way a trigger fires from its price relative to the entry.\n *\n * Used when the exchange reports a trigger without naming its placement type:\n * a long takes profit above its entry and stops out below, a short the other\n * way round. Shared by both transports so they classify identically.\n *\n * @param params - Classification parameters\n * @param params.triggerPrice - Price at which the order activates\n * @param params.entryPrice - Entry price of the position it is attached to\n * @param params.positionSize - Signed position size; its sign gives the side\n * @returns The direction, or undefined when there is nothing to compare against\n */\nexport function classifyTriggerDirection(params: {\n triggerPrice?: string;\n entryPrice?: string;\n positionSize: string;\n}): TriggerDirection | undefined {\n const { triggerPrice, entryPrice, positionSize } = params;\n\n const trigger = parseFloat(triggerPrice ?? '');\n const entry = parseFloat(entryPrice ?? '');\n const signedSize = parseFloat(positionSize || '0');\n\n if (!Number.isFinite(trigger) || !Number.isFinite(entry) || entry <= 0) {\n return undefined;\n }\n\n // A long takes profit above its entry and stops out below; a short is the\n // mirror image. A trigger sitting exactly at entry is neither, so both sides\n // fall to 'stop' — matching the legacy price fallback the scalar\n // takeProfitPrice/stopLossPrice fields still use. Splitting that tie the\n // other way would file the order under takeProfitOrders while the scalar\n // still reported it as a stop.\n const isLong = signedSize > 0;\n\n if (isLong) {\n return trigger > entry ? 'take_profit' : 'stop';\n }\n return trigger < entry ? 'take_profit' : 'stop';\n}\n\n/**\n * Project a normalized open order onto the position-state view of a trigger order.\n *\n * Returns undefined when the order is not a trigger, or when its direction can\n * be established neither from a named placement type nor from its price.\n *\n * @param params - Mapping parameters\n * @param params.order - Normalized open order\n * @param params.positionSize - Size of the position the trigger is attached to\n * @param params.entryPrice - Entry price, used to classify an unnamed trigger\n * @returns The position trigger order, or undefined\n */\nexport function buildPositionTriggerOrderFromOrder(params: {\n order: Order;\n positionSize: string;\n entryPrice?: string;\n}): PositionTriggerOrder | undefined {\n const { order, positionSize, entryPrice } = params;\n\n if (!order.isTrigger) {\n return undefined;\n }\n\n // HyperLiquid sometimes reports a bare 'Trigger', naming neither direction\n // nor execution. The direction is still recoverable from the trigger price\n // against the entry, and it is what decides which array the order belongs\n // to — so an unnamed trigger is kept rather than dropped, with its execution\n // mode left unstated. Without a position to compare against there is nothing\n // to recover, and it is dropped.\n const direction =\n order.triggerOrderType === undefined\n ? classifyTriggerDirection({\n triggerPrice: order.triggerPrice ?? order.price,\n entryPrice,\n positionSize,\n })\n : getTriggerDirection(order.triggerOrderType);\n\n if (!direction) {\n return undefined;\n }\n\n const absolutePositionSize = Math.abs(parseFloat(positionSize || '0'));\n const rawSize = Math.abs(parseFloat(order.size || '0'));\n\n // A position-bound TP/SL covers whatever the position currently is. The\n // exchange encodes that as size 0, but `adaptOrderFromSDK` has already\n // resolved it against the position as it stood when the order was adapted,\n // so the size carried here goes stale as soon as the position is resized.\n // The flag is the durable statement of what the trigger covers; the number\n // is not. Reading the number instead would report the old size, and would\n // call the order partial whenever the position had since grown.\n const isPositionBound = order.isPositionTpsl === true;\n const size =\n isPositionBound || rawSize === 0 ? absolutePositionSize : rawSize;\n\n return {\n orderId: order.orderId,\n direction,\n orderType: order.triggerOrderType,\n triggerPrice: order.triggerPrice ?? order.price,\n size: size.toString(),\n isPartial:\n !isPositionBound &&\n rawSize > 0 &&\n absolutePositionSize > 0 &&\n rawSize < absolutePositionSize,\n reduceOnly: Boolean(order.reduceOnly),\n };\n}\n\n/**\n * Resolve the scalar TP/SL summary price a position reports for one direction.\n *\n * The scalar fields are only ever scanned from position-bound triggers, so a\n * position whose only take profit (or stop loss) is quantity-scoped reported a\n * count of 1 with no price — and a client that renders the scalar showed\n * nothing. When the direction has exactly one trigger order, that order is the\n * price, whether or not it is position-bound.\n *\n * Two or more triggers keep the scanned value: no single price describes them,\n * and clients render the count instead. Zero triggers keep it too, because it\n * still carries the TP/SL of a *pending* order on the market, which the arrays\n * deliberately exclude.\n *\n * @param params - Resolution parameters\n * @param params.triggerOrders - Trigger orders attached to the position for one direction\n * @param params.scannedPrice - Price scanned from position-bound triggers, if any\n * @returns The price to report, or undefined when there is none\n */\nexport function resolvePositionTriggerSummaryPrice(params: {\n triggerOrders: PositionTriggerOrder[];\n scannedPrice?: string;\n}): string | undefined {\n const { triggerOrders, scannedPrice } = params;\n\n if (triggerOrders.length === 1) {\n return triggerOrders[0].triggerPrice;\n }\n\n return scannedPrice;\n}\n\n/**\n * Build a trigger order type from its two independent dimensions.\n *\n * @param params - Trigger dimensions.\n * @param params.direction - Whether the trigger is a stop or a take profit.\n * @param params.execution - How the order executes once triggered.\n * @returns The matching trigger order type.\n */\nexport function buildTriggerOrderType(params: {\n direction: TriggerDirection;\n execution: OrderExecution;\n}): TriggerOrderType {\n const { direction, execution } = params;\n\n if (direction === 'stop') {\n return execution === 'limit' ? 'stop_limit' : 'stop_market';\n }\n\n return execution === 'limit' ? 'take_profit_limit' : 'take_profit_market';\n}\n\n/**\n * Map the controller's time in force onto the exchange's spelling.\n *\n * Shared by the two order-building paths so they cannot drift apart.\n *\n * @param timeInForce - Requested time in force; defaults to GTC.\n * @returns The SDK time-in-force value.\n */\nexport function toSDKTimeInForce(\n timeInForce?: 'GTC' | 'IOC' | 'ALO',\n): 'Gtc' | 'Ioc' | 'Alo' {\n switch (timeInForce) {\n case 'IOC':\n return 'Ioc';\n case 'ALO':\n return 'Alo';\n default:\n return 'Gtc';\n }\n}\n\n/**\n * Hash the identity of a position's trigger orders for change detection.\n *\n * Streamed positions only re-emit when their hash changes, so this has to move\n * when a trigger is added, removed, repriced, resized, or retyped — otherwise\n * subscribers never receive the updated arrays.\n *\n * The placement type is part of the identity because a trigger can be modified\n * in place: switching a stop from market to limit execution keeps its order ID,\n * trigger price, and size, so nothing else here would move even though the\n * execution semantics subscribers rely on have changed.\n *\n * @param orders - Trigger orders attached to a position, if any.\n * @returns A stable string; `'0'` for both empty and absent.\n */\nexport function hashTriggerOrders(orders?: PositionTriggerOrder[]): string {\n if (!orders || orders.length === 0) {\n return '0';\n }\n return orders\n .map(\n (order) =>\n `${order.orderId}:${order.direction}:${order.orderType ?? '?'}@${order.triggerPrice}x${order.size}${order.isPartial ? 'p' : ''}`,\n )\n .join(',');\n}\n"]}
@@ -1,166 +0,0 @@
1
- import type { Order, PositionTriggerOrder } from "../types/index.cjs";
2
- import type { OrderExecution, OrderType, StrategyOrderType, TriggerDirection, TriggerOrderType } from "../types/perps-types.cjs";
3
- /**
4
- * All trigger placement types, in a stable order suitable for iteration
5
- * (validation tables, e2e matrices).
6
- */
7
- export declare const TRIGGER_ORDER_TYPES: readonly ["stop_market", "stop_limit", "take_profit_market", "take_profit_limit"];
8
- /**
9
- * All strategy placement types, in a stable order suitable for iteration
10
- * (validation tables, e2e matrices).
11
- */
12
- export declare const STRATEGY_ORDER_TYPES: readonly ["twap", "scale", "chase"];
13
- /**
14
- * Bounds on how many limit orders a scale placement may fan out into.
15
- *
16
- * A ladder needs at least two rungs to span a range at all; the upper bound
17
- * keeps a single placement from consuming a venue's per-account open-order
18
- * budget. Protocol-agnostic: a provider whose venue is stricter narrows this
19
- * further in its own validation.
20
- */
21
- export declare const SCALE_ORDER_COUNT: {
22
- readonly min: 2;
23
- readonly max: 20;
24
- };
25
- /**
26
- * Check whether an order type is a trigger placement (stop / take profit).
27
- *
28
- * @param orderType - Order type to check.
29
- * @returns True when the type requires `OrderParams.triggerPrice`.
30
- */
31
- export declare function isTriggerOrderType(orderType: OrderType): orderType is TriggerOrderType;
32
- /**
33
- * Check whether an order type is a strategy placement (TWAP / scale / chase).
34
- *
35
- * @param orderType - Order type to check.
36
- * @returns True when the placement expands into an execution schedule rather
37
- * than a single order.
38
- */
39
- export declare function isStrategyOrderType(orderType: OrderType): orderType is StrategyOrderType;
40
- /**
41
- * Check whether an order type executes as a limit order.
42
- *
43
- * Covers plain limit orders and the `*_limit` trigger types, both of which
44
- * require `OrderParams.price`.
45
- *
46
- * @param orderType - Order type to check.
47
- * @returns True when the order executes as a limit order.
48
- */
49
- export declare function isLimitExecutionOrderType(orderType: OrderType): boolean;
50
- /**
51
- * Get how an order executes, ignoring whether it is trigger-gated.
52
- *
53
- * This is also the coarse execution type that consumers predating trigger orders
54
- * understand (fee tiers, max order value, analytics). It answers "does this rest
55
- * on the book or cross it", which is not the same question as
56
- * `isLimitExecutionOrderType` — a scale ladder and a chase rest limit orders
57
- * without carrying an `OrderParams.price`.
58
- *
59
- * @param orderType - Order type to inspect.
60
- * @returns `'limit'` for limit, `*_limit`, `scale` and `chase`; `'market'`
61
- * otherwise, including `twap`, whose suborders cross the book.
62
- */
63
- export declare function getTriggerExecution(orderType: OrderType): OrderExecution;
64
- /**
65
- * Get the direction a trigger order fires in.
66
- *
67
- * @param orderType - Trigger order type.
68
- * @returns `'stop'` for `stop_*`, `'take_profit'` for `take_profit_*`.
69
- */
70
- export declare function getTriggerDirection(orderType: TriggerOrderType): TriggerDirection;
71
- /**
72
- * Recover which way a trigger fires from its price relative to the entry.
73
- *
74
- * Used when the exchange reports a trigger without naming its placement type:
75
- * a long takes profit above its entry and stops out below, a short the other
76
- * way round. Shared by both transports so they classify identically.
77
- *
78
- * @param params - Classification parameters
79
- * @param params.triggerPrice - Price at which the order activates
80
- * @param params.entryPrice - Entry price of the position it is attached to
81
- * @param params.positionSize - Signed position size; its sign gives the side
82
- * @returns The direction, or undefined when there is nothing to compare against
83
- */
84
- export declare function classifyTriggerDirection(params: {
85
- triggerPrice?: string;
86
- entryPrice?: string;
87
- positionSize: string;
88
- }): TriggerDirection | undefined;
89
- /**
90
- * Project a normalized open order onto the position-state view of a trigger order.
91
- *
92
- * Returns undefined when the order is not a trigger, or when its direction can
93
- * be established neither from a named placement type nor from its price.
94
- *
95
- * @param params - Mapping parameters
96
- * @param params.order - Normalized open order
97
- * @param params.positionSize - Size of the position the trigger is attached to
98
- * @param params.entryPrice - Entry price, used to classify an unnamed trigger
99
- * @returns The position trigger order, or undefined
100
- */
101
- export declare function buildPositionTriggerOrderFromOrder(params: {
102
- order: Order;
103
- positionSize: string;
104
- entryPrice?: string;
105
- }): PositionTriggerOrder | undefined;
106
- /**
107
- * Resolve the scalar TP/SL summary price a position reports for one direction.
108
- *
109
- * The scalar fields are only ever scanned from position-bound triggers, so a
110
- * position whose only take profit (or stop loss) is quantity-scoped reported a
111
- * count of 1 with no price — and a client that renders the scalar showed
112
- * nothing. When the direction has exactly one trigger order, that order is the
113
- * price, whether or not it is position-bound.
114
- *
115
- * Two or more triggers keep the scanned value: no single price describes them,
116
- * and clients render the count instead. Zero triggers keep it too, because it
117
- * still carries the TP/SL of a *pending* order on the market, which the arrays
118
- * deliberately exclude.
119
- *
120
- * @param params - Resolution parameters
121
- * @param params.triggerOrders - Trigger orders attached to the position for one direction
122
- * @param params.scannedPrice - Price scanned from position-bound triggers, if any
123
- * @returns The price to report, or undefined when there is none
124
- */
125
- export declare function resolvePositionTriggerSummaryPrice(params: {
126
- triggerOrders: PositionTriggerOrder[];
127
- scannedPrice?: string;
128
- }): string | undefined;
129
- /**
130
- * Build a trigger order type from its two independent dimensions.
131
- *
132
- * @param params - Trigger dimensions.
133
- * @param params.direction - Whether the trigger is a stop or a take profit.
134
- * @param params.execution - How the order executes once triggered.
135
- * @returns The matching trigger order type.
136
- */
137
- export declare function buildTriggerOrderType(params: {
138
- direction: TriggerDirection;
139
- execution: OrderExecution;
140
- }): TriggerOrderType;
141
- /**
142
- * Map the controller's time in force onto the exchange's spelling.
143
- *
144
- * Shared by the two order-building paths so they cannot drift apart.
145
- *
146
- * @param timeInForce - Requested time in force; defaults to GTC.
147
- * @returns The SDK time-in-force value.
148
- */
149
- export declare function toSDKTimeInForce(timeInForce?: 'GTC' | 'IOC' | 'ALO'): 'Gtc' | 'Ioc' | 'Alo';
150
- /**
151
- * Hash the identity of a position's trigger orders for change detection.
152
- *
153
- * Streamed positions only re-emit when their hash changes, so this has to move
154
- * when a trigger is added, removed, repriced, resized, or retyped — otherwise
155
- * subscribers never receive the updated arrays.
156
- *
157
- * The placement type is part of the identity because a trigger can be modified
158
- * in place: switching a stop from market to limit execution keeps its order ID,
159
- * trigger price, and size, so nothing else here would move even though the
160
- * execution semantics subscribers rely on have changed.
161
- *
162
- * @param orders - Trigger orders attached to a position, if any.
163
- * @returns A stable string; `'0'` for both empty and absent.
164
- */
165
- export declare function hashTriggerOrders(orders?: PositionTriggerOrder[]): string;
166
- //# sourceMappingURL=orderTypes.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orderTypes.d.cts","sourceRoot":"","sources":["../../src/utils/orderTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE,2BAA0B;AACrE,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EACjB,iCAAgC;AAEjC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,mFAKgB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,qCAIgB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;CAA+B,CAAC;AA8B9D;;;;;GAKG;AACH,wBAA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AE,GAAG,MAAM,CAAC;IAExC,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,OAAO,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC;IAC9D,CAAC;IAED,OAAO,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAC5E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAAmC;IAEnC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA+B;IAC/D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,MAAM;SACV,GAAG,CACF,CAAC,KAAK,EAAE,EAAE,CACR,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,IAAI,GAAG,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACnI;SACA,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import type { Order, PositionTriggerOrder } from '../types/index.js';\nimport type {\n OrderExecution,\n OrderType,\n StrategyOrderType,\n TriggerDirection,\n TriggerOrderType,\n} from '../types/perps-types.js';\n\n/**\n * All trigger placement types, in a stable order suitable for iteration\n * (validation tables, e2e matrices).\n */\nexport const TRIGGER_ORDER_TYPES = [\n 'stop_market',\n 'stop_limit',\n 'take_profit_market',\n 'take_profit_limit',\n] as const satisfies readonly TriggerOrderType[];\n\n/**\n * All strategy placement types, in a stable order suitable for iteration\n * (validation tables, e2e matrices).\n */\nexport const STRATEGY_ORDER_TYPES = [\n 'twap',\n 'scale',\n 'chase',\n] as const satisfies readonly StrategyOrderType[];\n\n/**\n * Bounds on how many limit orders a scale placement may fan out into.\n *\n * A ladder needs at least two rungs to span a range at all; the upper bound\n * keeps a single placement from consuming a venue's per-account open-order\n * budget. Protocol-agnostic: a provider whose venue is stricter narrows this\n * further in its own validation.\n */\nexport const SCALE_ORDER_COUNT = { min: 2, max: 20 } as const;\n\n/**\n * Order types whose price field (`OrderParams.price`) is a real limit price the\n * exchange must honour, as opposed to a slippage cap derived from the market.\n */\nconst LIMIT_EXECUTION_ORDER_TYPES = [\n 'limit',\n 'stop_limit',\n 'take_profit_limit',\n] as const satisfies readonly OrderType[];\n\n/**\n * Order types that rest limit orders on the book, whatever decides their price.\n *\n * A superset of `LIMIT_EXECUTION_ORDER_TYPES`: a scale ladder and a chase both\n * rest limit orders, but they derive their own prices rather than taking one\n * from `OrderParams.price`, so they are limit *execution* without being\n * limit-*priced*. A TWAP is absent because its suborders cross the book.\n *\n * The distinction matters wherever execution is what is being charged or\n * bounded — fee tier, max order value — as opposed to where the caller's price\n * field is being read.\n */\nconst LIMIT_RESTING_ORDER_TYPES = [\n ...LIMIT_EXECUTION_ORDER_TYPES,\n 'scale',\n 'chase',\n] as const satisfies readonly OrderType[];\n\n/**\n * Check whether an order type is a trigger placement (stop / take profit).\n *\n * @param orderType - Order type to check.\n * @returns True when the type requires `OrderParams.triggerPrice`.\n */\nexport function isTriggerOrderType(\n orderType: OrderType,\n): orderType is TriggerOrderType {\n return (TRIGGER_ORDER_TYPES as readonly OrderType[]).includes(orderType);\n}\n\n/**\n * Check whether an order type is a strategy placement (TWAP / scale / chase).\n *\n * @param orderType - Order type to check.\n * @returns True when the placement expands into an execution schedule rather\n * than a single order.\n */\nexport function isStrategyOrderType(\n orderType: OrderType,\n): orderType is StrategyOrderType {\n return (STRATEGY_ORDER_TYPES as readonly OrderType[]).includes(orderType);\n}\n\n/**\n * Check whether an order type executes as a limit order.\n *\n * Covers plain limit orders and the `*_limit` trigger types, both of which\n * require `OrderParams.price`.\n *\n * @param orderType - Order type to check.\n * @returns True when the order executes as a limit order.\n */\nexport function isLimitExecutionOrderType(orderType: OrderType): boolean {\n return (LIMIT_EXECUTION_ORDER_TYPES as readonly OrderType[]).includes(\n orderType,\n );\n}\n\n/**\n * Get how an order executes, ignoring whether it is trigger-gated.\n *\n * This is also the coarse execution type that consumers predating trigger orders\n * understand (fee tiers, max order value, analytics). It answers \"does this rest\n * on the book or cross it\", which is not the same question as\n * `isLimitExecutionOrderType` — a scale ladder and a chase rest limit orders\n * without carrying an `OrderParams.price`.\n *\n * @param orderType - Order type to inspect.\n * @returns `'limit'` for limit, `*_limit`, `scale` and `chase`; `'market'`\n * otherwise, including `twap`, whose suborders cross the book.\n */\nexport function getTriggerExecution(orderType: OrderType): OrderExecution {\n return (LIMIT_RESTING_ORDER_TYPES as readonly OrderType[]).includes(orderType)\n ? 'limit'\n : 'market';\n}\n\n/**\n * Get the direction a trigger order fires in.\n *\n * @param orderType - Trigger order type.\n * @returns `'stop'` for `stop_*`, `'take_profit'` for `take_profit_*`.\n */\nexport function getTriggerDirection(\n orderType: TriggerOrderType,\n): TriggerDirection {\n return orderType === 'stop_market' || orderType === 'stop_limit'\n ? 'stop'\n : 'take_profit';\n}\n\n/**\n * Recover which way a trigger fires from its price relative to the entry.\n *\n * Used when the exchange reports a trigger without naming its placement type:\n * a long takes profit above its entry and stops out below, a short the other\n * way round. Shared by both transports so they classify identically.\n *\n * @param params - Classification parameters\n * @param params.triggerPrice - Price at which the order activates\n * @param params.entryPrice - Entry price of the position it is attached to\n * @param params.positionSize - Signed position size; its sign gives the side\n * @returns The direction, or undefined when there is nothing to compare against\n */\nexport function classifyTriggerDirection(params: {\n triggerPrice?: string;\n entryPrice?: string;\n positionSize: string;\n}): TriggerDirection | undefined {\n const { triggerPrice, entryPrice, positionSize } = params;\n\n const trigger = parseFloat(triggerPrice ?? '');\n const entry = parseFloat(entryPrice ?? '');\n const signedSize = parseFloat(positionSize || '0');\n\n if (!Number.isFinite(trigger) || !Number.isFinite(entry) || entry <= 0) {\n return undefined;\n }\n\n // A long takes profit above its entry and stops out below; a short is the\n // mirror image. A trigger sitting exactly at entry is neither, so both sides\n // fall to 'stop' — matching the legacy price fallback the scalar\n // takeProfitPrice/stopLossPrice fields still use. Splitting that tie the\n // other way would file the order under takeProfitOrders while the scalar\n // still reported it as a stop.\n const isLong = signedSize > 0;\n\n if (isLong) {\n return trigger > entry ? 'take_profit' : 'stop';\n }\n return trigger < entry ? 'take_profit' : 'stop';\n}\n\n/**\n * Project a normalized open order onto the position-state view of a trigger order.\n *\n * Returns undefined when the order is not a trigger, or when its direction can\n * be established neither from a named placement type nor from its price.\n *\n * @param params - Mapping parameters\n * @param params.order - Normalized open order\n * @param params.positionSize - Size of the position the trigger is attached to\n * @param params.entryPrice - Entry price, used to classify an unnamed trigger\n * @returns The position trigger order, or undefined\n */\nexport function buildPositionTriggerOrderFromOrder(params: {\n order: Order;\n positionSize: string;\n entryPrice?: string;\n}): PositionTriggerOrder | undefined {\n const { order, positionSize, entryPrice } = params;\n\n if (!order.isTrigger) {\n return undefined;\n }\n\n // HyperLiquid sometimes reports a bare 'Trigger', naming neither direction\n // nor execution. The direction is still recoverable from the trigger price\n // against the entry, and it is what decides which array the order belongs\n // to — so an unnamed trigger is kept rather than dropped, with its execution\n // mode left unstated. Without a position to compare against there is nothing\n // to recover, and it is dropped.\n const direction =\n order.triggerOrderType === undefined\n ? classifyTriggerDirection({\n triggerPrice: order.triggerPrice ?? order.price,\n entryPrice,\n positionSize,\n })\n : getTriggerDirection(order.triggerOrderType);\n\n if (!direction) {\n return undefined;\n }\n\n const absolutePositionSize = Math.abs(parseFloat(positionSize || '0'));\n const rawSize = Math.abs(parseFloat(order.size || '0'));\n\n // A position-bound TP/SL covers whatever the position currently is. The\n // exchange encodes that as size 0, but `adaptOrderFromSDK` has already\n // resolved it against the position as it stood when the order was adapted,\n // so the size carried here goes stale as soon as the position is resized.\n // The flag is the durable statement of what the trigger covers; the number\n // is not. Reading the number instead would report the old size, and would\n // call the order partial whenever the position had since grown.\n const isPositionBound = order.isPositionTpsl === true;\n const size =\n isPositionBound || rawSize === 0 ? absolutePositionSize : rawSize;\n\n return {\n orderId: order.orderId,\n direction,\n orderType: order.triggerOrderType,\n triggerPrice: order.triggerPrice ?? order.price,\n size: size.toString(),\n isPartial:\n !isPositionBound &&\n rawSize > 0 &&\n absolutePositionSize > 0 &&\n rawSize < absolutePositionSize,\n reduceOnly: Boolean(order.reduceOnly),\n };\n}\n\n/**\n * Resolve the scalar TP/SL summary price a position reports for one direction.\n *\n * The scalar fields are only ever scanned from position-bound triggers, so a\n * position whose only take profit (or stop loss) is quantity-scoped reported a\n * count of 1 with no price — and a client that renders the scalar showed\n * nothing. When the direction has exactly one trigger order, that order is the\n * price, whether or not it is position-bound.\n *\n * Two or more triggers keep the scanned value: no single price describes them,\n * and clients render the count instead. Zero triggers keep it too, because it\n * still carries the TP/SL of a *pending* order on the market, which the arrays\n * deliberately exclude.\n *\n * @param params - Resolution parameters\n * @param params.triggerOrders - Trigger orders attached to the position for one direction\n * @param params.scannedPrice - Price scanned from position-bound triggers, if any\n * @returns The price to report, or undefined when there is none\n */\nexport function resolvePositionTriggerSummaryPrice(params: {\n triggerOrders: PositionTriggerOrder[];\n scannedPrice?: string;\n}): string | undefined {\n const { triggerOrders, scannedPrice } = params;\n\n if (triggerOrders.length === 1) {\n return triggerOrders[0].triggerPrice;\n }\n\n return scannedPrice;\n}\n\n/**\n * Build a trigger order type from its two independent dimensions.\n *\n * @param params - Trigger dimensions.\n * @param params.direction - Whether the trigger is a stop or a take profit.\n * @param params.execution - How the order executes once triggered.\n * @returns The matching trigger order type.\n */\nexport function buildTriggerOrderType(params: {\n direction: TriggerDirection;\n execution: OrderExecution;\n}): TriggerOrderType {\n const { direction, execution } = params;\n\n if (direction === 'stop') {\n return execution === 'limit' ? 'stop_limit' : 'stop_market';\n }\n\n return execution === 'limit' ? 'take_profit_limit' : 'take_profit_market';\n}\n\n/**\n * Map the controller's time in force onto the exchange's spelling.\n *\n * Shared by the two order-building paths so they cannot drift apart.\n *\n * @param timeInForce - Requested time in force; defaults to GTC.\n * @returns The SDK time-in-force value.\n */\nexport function toSDKTimeInForce(\n timeInForce?: 'GTC' | 'IOC' | 'ALO',\n): 'Gtc' | 'Ioc' | 'Alo' {\n switch (timeInForce) {\n case 'IOC':\n return 'Ioc';\n case 'ALO':\n return 'Alo';\n default:\n return 'Gtc';\n }\n}\n\n/**\n * Hash the identity of a position's trigger orders for change detection.\n *\n * Streamed positions only re-emit when their hash changes, so this has to move\n * when a trigger is added, removed, repriced, resized, or retyped — otherwise\n * subscribers never receive the updated arrays.\n *\n * The placement type is part of the identity because a trigger can be modified\n * in place: switching a stop from market to limit execution keeps its order ID,\n * trigger price, and size, so nothing else here would move even though the\n * execution semantics subscribers rely on have changed.\n *\n * @param orders - Trigger orders attached to a position, if any.\n * @returns A stable string; `'0'` for both empty and absent.\n */\nexport function hashTriggerOrders(orders?: PositionTriggerOrder[]): string {\n if (!orders || orders.length === 0) {\n return '0';\n }\n return orders\n .map(\n (order) =>\n `${order.orderId}:${order.direction}:${order.orderType ?? '?'}@${order.triggerPrice}x${order.size}${order.isPartial ? 'p' : ''}`,\n )\n .join(',');\n}\n"]}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withPerpsConnectionAttemptContext = exports.getPerpsConnectionAttemptContext = void 0;
4
- let currentAttemptContext = null;
5
- function getPerpsConnectionAttemptContext() {
6
- return currentAttemptContext;
7
- }
8
- exports.getPerpsConnectionAttemptContext = getPerpsConnectionAttemptContext;
9
- async function withPerpsConnectionAttemptContext(context, callback) {
10
- const previousContext = currentAttemptContext;
11
- currentAttemptContext = context;
12
- try {
13
- return await callback();
14
- }
15
- finally {
16
- currentAttemptContext = previousContext;
17
- }
18
- }
19
- exports.withPerpsConnectionAttemptContext = withPerpsConnectionAttemptContext;
20
- //# sourceMappingURL=perpsConnectionAttemptContext.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perpsConnectionAttemptContext.cjs","sourceRoot":"","sources":["../../src/utils/perpsConnectionAttemptContext.ts"],"names":[],"mappings":";;;AAKA,IAAI,qBAAqB,GAAyC,IAAI,CAAC;AAEvE,SAAgB,gCAAgC;IAC9C,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAFD,4EAEC;AAEM,KAAK,UAAU,iCAAiC,CACrD,OAAsC,EACtC,QAAkC;IAElC,MAAM,eAAe,GAAG,qBAAqB,CAAC;IAC9C,qBAAqB,GAAG,OAAO,CAAC;IAEhC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,EAAE,CAAC;IAC1B,CAAC;YAAS,CAAC;QACT,qBAAqB,GAAG,eAAe,CAAC;IAC1C,CAAC;AACH,CAAC;AAZD,8EAYC","sourcesContent":["export type PerpsConnectionAttemptContext = {\n source: string;\n suppressError: boolean;\n};\n\nlet currentAttemptContext: PerpsConnectionAttemptContext | null = null;\n\nexport function getPerpsConnectionAttemptContext(): PerpsConnectionAttemptContext | null {\n return currentAttemptContext;\n}\n\nexport async function withPerpsConnectionAttemptContext<ValueType>(\n context: PerpsConnectionAttemptContext,\n callback: () => Promise<ValueType>,\n): Promise<ValueType> {\n const previousContext = currentAttemptContext;\n currentAttemptContext = context;\n\n try {\n return await callback();\n } finally {\n currentAttemptContext = previousContext;\n }\n}\n"]}
@@ -1,7 +0,0 @@
1
- export type PerpsConnectionAttemptContext = {
2
- source: string;
3
- suppressError: boolean;
4
- };
5
- export declare function getPerpsConnectionAttemptContext(): PerpsConnectionAttemptContext | null;
6
- export declare function withPerpsConnectionAttemptContext<ValueType>(context: PerpsConnectionAttemptContext, callback: () => Promise<ValueType>): Promise<ValueType>;
7
- //# sourceMappingURL=perpsConnectionAttemptContext.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perpsConnectionAttemptContext.d.cts","sourceRoot":"","sources":["../../src/utils/perpsConnectionAttemptContext.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAIF,wBAAgB,gCAAgC,IAAI,6BAA6B,GAAG,IAAI,CAEvF;AAED,wBAAsB,iCAAiC,CAAC,SAAS,EAC/D,OAAO,EAAE,6BAA6B,EACtC,QAAQ,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GACjC,OAAO,CAAC,SAAS,CAAC,CASpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"perpsConnectionAttemptContext.d.mts","sourceRoot":"","sources":["../../src/utils/perpsConnectionAttemptContext.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAIF,wBAAgB,gCAAgC,IAAI,6BAA6B,GAAG,IAAI,CAEvF;AAED,wBAAsB,iCAAiC,CAAC,SAAS,EAC/D,OAAO,EAAE,6BAA6B,EACtC,QAAQ,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GACjC,OAAO,CAAC,SAAS,CAAC,CASpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"perpsConnectionAttemptContext.mjs","sourceRoot":"","sources":["../../src/utils/perpsConnectionAttemptContext.ts"],"names":[],"mappings":"AAKA,IAAI,qBAAqB,GAAyC,IAAI,CAAC;AAEvE,MAAM,UAAU,gCAAgC;IAC9C,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,OAAsC,EACtC,QAAkC;IAElC,MAAM,eAAe,GAAG,qBAAqB,CAAC;IAC9C,qBAAqB,GAAG,OAAO,CAAC;IAEhC,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,EAAE,CAAC;IAC1B,CAAC;YAAS,CAAC;QACT,qBAAqB,GAAG,eAAe,CAAC;IAC1C,CAAC;AACH,CAAC","sourcesContent":["export type PerpsConnectionAttemptContext = {\n source: string;\n suppressError: boolean;\n};\n\nlet currentAttemptContext: PerpsConnectionAttemptContext | null = null;\n\nexport function getPerpsConnectionAttemptContext(): PerpsConnectionAttemptContext | null {\n return currentAttemptContext;\n}\n\nexport async function withPerpsConnectionAttemptContext<ValueType>(\n context: PerpsConnectionAttemptContext,\n callback: () => Promise<ValueType>,\n): Promise<ValueType> {\n const previousContext = currentAttemptContext;\n currentAttemptContext = context;\n\n try {\n return await callback();\n } finally {\n currentAttemptContext = previousContext;\n }\n}\n"]}