@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,823 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildOrdersArray = exports.formatPartialTpslSize = exports.validateOrderPrecision = exports.calculateOrderPriceAndSize = exports.calculateFinalPositionSize = exports.splitScaleSizes = exports.computeScalePriceLadder = exports.computeChaseQuotePrice = exports.getPriceTick = exports.floorToSizeDecimals = exports.getMaxAllowedAmount = exports.calculateMarginRequired = exports.calculatePositionSize = void 0;
4
- const hyperLiquidConfig_js_1 = require("../constants/hyperLiquidConfig.cjs");
5
- const perpsConfig_js_1 = require("../constants/perpsConfig.cjs");
6
- const perpsErrorCodes_js_1 = require("../perpsErrorCodes.cjs");
7
- const hyperLiquidAdapter_js_1 = require("./hyperLiquidAdapter.cjs");
8
- const orderTypes_js_1 = require("./orderTypes.cjs");
9
- /**
10
- * Tolerance used when deciding whether a scaled size is already on the size
11
- * grid, guarding against floating-point representation error.
12
- */
13
- const FLOAT_TOLERANCE = 1e-6;
14
- /**
15
- * Calculate position size based on USD amount and asset price
16
- *
17
- * @param params - Amount in USD, current asset price, and required decimal precision
18
- * @returns Position size formatted to the asset's decimal precision
19
- */
20
- function calculatePositionSize(params) {
21
- const { amount, price, szDecimals } = params;
22
- // Validate required parameters
23
- if (szDecimals === undefined || szDecimals === null) {
24
- throw new Error('szDecimals is required for position size calculation');
25
- }
26
- if (szDecimals < 0) {
27
- throw new Error(`szDecimals must be >= 0, got: ${szDecimals}`);
28
- }
29
- const amountNum = parseFloat(amount || '0');
30
- if (isNaN(amountNum) || isNaN(price) || amountNum === 0 || price === 0) {
31
- return (0).toFixed(szDecimals);
32
- }
33
- const positionSize = amountNum / price;
34
- const multiplier = Math.pow(10, szDecimals);
35
- let rounded = Math.round(positionSize * multiplier) / multiplier;
36
- // Ensure rounded size meets requested USD (fix validation gap)
37
- const actualUsd = rounded * price;
38
- if (actualUsd < amountNum) {
39
- rounded += 1 / multiplier;
40
- }
41
- return rounded.toFixed(szDecimals);
42
- }
43
- exports.calculatePositionSize = calculatePositionSize;
44
- /**
45
- * Calculate margin required for a position
46
- *
47
- * @param params - Position amount and leverage
48
- * @returns Margin required formatted to 2 decimal places
49
- */
50
- function calculateMarginRequired(params) {
51
- const { amount, leverage } = params;
52
- const amountNum = parseFloat(amount || '0');
53
- if (isNaN(amountNum) ||
54
- isNaN(leverage) ||
55
- amountNum === 0 ||
56
- leverage === 0) {
57
- return '0.00';
58
- }
59
- return (amountNum / leverage).toFixed(2);
60
- }
61
- exports.calculateMarginRequired = calculateMarginRequired;
62
- function getMaxAllowedAmount(params) {
63
- const { spendableBalance, assetPrice, assetSzDecimals, leverage, orderType = 'market', limitPrice, } = params;
64
- if (spendableBalance === 0 || !assetPrice || assetSzDecimals === undefined) {
65
- return 0;
66
- }
67
- // HyperLiquid reserves initial margin for a RESTING order against the price
68
- // the order is submitted at, not the market price its size was derived from.
69
- // A limit order resting above the market price - typically a sell - therefore
70
- // needs more margin than a market-priced notional budgets for, and the
71
- // exchange refuses it with "insufficient margin to place order". Price the max
72
- // off that submitted price instead. A marketable order is charged at the fill
73
- // price, so it needs no adjustment.
74
- const executionPriceRatio = orderType === 'limit' && limitPrice && limitPrice > assetPrice
75
- ? limitPrice / assetPrice
76
- : 1;
77
- // The theoretical maximum is spendableBalance * leverage, expressed in the
78
- // market-price notional the caller works with.
79
- const theoreticalMax = (spendableBalance * leverage) / executionPriceRatio;
80
- // But we need to account for position size rounding
81
- // Find the largest whole dollar amount that fits within this limit
82
- let maxAmount = Math.floor(theoreticalMax);
83
- // Verify this amount doesn't exceed available balance after rounding
84
- const testPositionSize = calculatePositionSize({
85
- amount: maxAmount.toString(),
86
- price: assetPrice,
87
- szDecimals: assetSzDecimals,
88
- });
89
- const actualNotionalValue = parseFloat(testPositionSize) * assetPrice * executionPriceRatio;
90
- const requiredMargin = actualNotionalValue / leverage;
91
- // If rounding caused us to exceed available balance, step down by one position increment
92
- if (requiredMargin > spendableBalance) {
93
- const minPositionSizeIncrement = 1 / Math.pow(10, assetSzDecimals);
94
- const positionSizeIncrementUsd = Math.ceil(minPositionSizeIncrement * assetPrice);
95
- maxAmount -= positionSizeIncrementUsd;
96
- }
97
- // Apply margin buffer to reduce "Insufficient margin" rejections from the exchange
98
- // (fees, rounding, and exchange-side checks can make 100% theoretical max fail)
99
- const bufferedMax = maxAmount * (1 - perpsConfig_js_1.MAX_ORDER_MARGIN_BUFFER);
100
- return Math.max(0, Math.floor(bufferedMax));
101
- }
102
- exports.getMaxAllowedAmount = getMaxAllowedAmount;
103
- /**
104
- * Round a size down onto the asset's size grid.
105
- *
106
- * Used for reduce-only orders, where rounding up would push the size past the
107
- * live position size. Values already on the grid are snapped rather than
108
- * truncated, because floating-point math can leave them just below a grid
109
- * point (0.0123 * 10000 === 122.99999999999999) and truncating would drop a
110
- * whole increment.
111
- *
112
- * The result is never greater than `size`, for negative sizes as well as
113
- * positive: the snap only ever recovers a grid point the input already
114
- * represents, so a value genuinely below a grid point is stepped down even when
115
- * the tolerance would have reached the point above it.
116
- *
117
- * A size whose scaled form reaches `2^53` is returned unchanged: doubles cannot
118
- * represent consecutive integers there, so the grid is finer than the spacing
119
- * between representable values and there is nothing to round down to.
120
- *
121
- * @param size - Size to round down.
122
- * @param szDecimals - The asset's size decimal precision.
123
- * @returns The size rounded down onto the size grid, never exceeding `size`.
124
- */
125
- function floorToSizeDecimals(size, szDecimals) {
126
- const multiplier = Math.pow(10, szDecimals);
127
- const scaled = size * multiplier;
128
- // Past 2^53 a double cannot represent consecutive integers, so `units -= 1`
129
- // below would be a no-op and the step-down loop would never terminate. The
130
- // size grid is finer than the spacing between representable values at that
131
- // magnitude, so there is no increment to shave: return the input unchanged.
132
- if (!Number.isFinite(scaled) || Math.abs(scaled) >= Number.MAX_SAFE_INTEGER) {
133
- return size;
134
- }
135
- const nearest = Math.round(scaled);
136
- // The tolerance scales with the magnitude, because double-precision error
137
- // does too: a fixed epsilon would stop absorbing representation error for
138
- // sizes that scale past ~1e10 and would then shave off a whole increment.
139
- const tolerance = Math.max(FLOAT_TOLERANCE, Math.abs(scaled) * Number.EPSILON * 8);
140
- let units = Math.abs(scaled - nearest) < tolerance ? nearest : Math.floor(scaled);
141
- // Step down until the result no longer exceeds the input. One pass is not
142
- // enough: a tolerance wide enough to absorb representation error at large
143
- // magnitudes also reaches the next grid point, and for an input less than half
144
- // an ulp below a grid point `size * multiplier` evaluates to exactly that grid
145
- // integer, so flooring the scaled value returns the same too-large result.
146
- // The comparison alone is the whole termination condition: for a non-negative
147
- // size the loop stops at or before zero, and for a negative size it stops once
148
- // the value is no longer above the input. Guarding on `units` instead would
149
- // skip a negative size below the tolerance, which snaps to `-0` — and
150
- // `-0 !== 0` is false. The 2^53 bail-out above keeps this bounded.
151
- while (units / multiplier > size) {
152
- units -= 1;
153
- }
154
- return units / multiplier;
155
- }
156
- exports.floorToSizeDecimals = floorToSizeDecimals;
157
- /**
158
- * The smallest price increment the venue will represent at a given price.
159
- *
160
- * HyperLiquid bounds a perp price two ways at once — a decimal-place cap that
161
- * depends on the asset's size precision, and a significant-figure cap — so the
162
- * tick widens as the price grows. Whichever bound is coarser at this price is
163
- * the tick.
164
- *
165
- * @param params - Tick parameters.
166
- * @param params.price - Price to measure the increment at.
167
- * @param params.szDecimals - The asset's size decimal precision.
168
- * @returns The tick size at that price.
169
- */
170
- function getPriceTick(params) {
171
- const { price, szDecimals } = params;
172
- const byDecimals = Math.pow(10, -(perpsConfig_js_1.DECIMAL_PRECISION_CONFIG.MaxPriceDecimals - szDecimals));
173
- const bySignificantFigures = Math.pow(10, Math.floor(Math.log10(Math.abs(price))) -
174
- (perpsConfig_js_1.DECIMAL_PRECISION_CONFIG.MaxSignificantFigures - 1));
175
- return Math.max(byDecimals, bySignificantFigures);
176
- }
177
- exports.getPriceTick = getPriceTick;
178
- /**
179
- * Price a chase order against the book it is chasing.
180
- *
181
- * The venue's own definition: a chase rests one tick *inside* the spread —
182
- * above the best bid for a buy, below the best ask for a sell — except when the
183
- * spread is already a single tick, where there is no room to improve and the
184
- * order joins the touch instead.
185
- *
186
- * Rests inside rather than at the touch because a chase is post-only: sitting
187
- * one tick ahead of the rest of the queue is the whole point, and joining the
188
- * touch would leave it behind every order already resting there.
189
- *
190
- * @param params - Quote parameters.
191
- * @param params.bestBid - Best bid, excluding the chase's own resting order.
192
- * @param params.bestAsk - Best ask, excluding the chase's own resting order.
193
- * @param params.isBuy - Which side the chase rests on.
194
- * @param params.szDecimals - The asset's size decimal precision.
195
- * @returns The formatted price the chase should rest at.
196
- */
197
- function computeChaseQuotePrice(params) {
198
- const { bestBid, bestAsk, isBuy, szDecimals } = params;
199
- const reference = isBuy ? bestBid : bestAsk;
200
- const tick = getPriceTick({ price: reference, szDecimals });
201
- const improved = isBuy ? bestBid + tick : bestAsk - tick;
202
- // A single-tick spread leaves nowhere to improve to: the improved price would
203
- // cross, which a post-only order cannot do. Join the touch instead.
204
- const crosses = isBuy ? improved >= bestAsk : improved <= bestBid;
205
- return (0, hyperLiquidAdapter_js_1.formatHyperLiquidPrice)({
206
- price: crosses ? reference : improved,
207
- szDecimals,
208
- });
209
- }
210
- exports.computeChaseQuotePrice = computeChaseQuotePrice;
211
- /**
212
- * Compute the price ladder a scale placement fans out over.
213
- *
214
- * The ladder is inclusive of both ends — the first rung sits exactly on
215
- * `minPrice`, the last exactly on `maxPrice` — so the range the caller asked
216
- * for is the range that actually reaches the exchange.
217
- *
218
- * @param params - Ladder parameters.
219
- * @param params.minPrice - Lowest price in the ladder.
220
- * @param params.maxPrice - Highest price in the ladder; must exceed `minPrice`.
221
- * @param params.count - Number of rungs.
222
- * @returns The rung prices, ascending.
223
- */
224
- function computeScalePriceLadder(params) {
225
- const { minPrice, maxPrice, count } = params;
226
- if (!Number.isInteger(count) ||
227
- count < orderTypes_js_1.SCALE_ORDER_COUNT.min ||
228
- count > orderTypes_js_1.SCALE_ORDER_COUNT.max) {
229
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SCALE_COUNT_INVALID);
230
- }
231
- if (!Number.isFinite(minPrice) ||
232
- !Number.isFinite(maxPrice) ||
233
- minPrice <= 0 ||
234
- maxPrice <= minPrice) {
235
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SCALE_RANGE_INVALID);
236
- }
237
- const step = (maxPrice - minPrice) / (count - 1);
238
- // The top rung is assigned rather than accumulated: `minPrice + step * n`
239
- // drifts, and a ladder that stops short of the caller's maxPrice would quietly
240
- // narrow the range they asked for.
241
- return Array.from({ length: count }, (_unused, index) => index === count - 1 ? maxPrice : minPrice + step * index);
242
- }
243
- exports.computeScalePriceLadder = computeScalePriceLadder;
244
- /**
245
- * Split a scale placement's total size across its ladder rungs.
246
- *
247
- * The split is done in whole units of the asset's size grid rather than in
248
- * decimal sizes: dividing and re-flooring in floating point loses a sub-unit of
249
- * dust on every rung, and a ladder that submits less than the size that was
250
- * validated is not the order the caller placed. Either allocation below sums to
251
- * exactly `totalSize` in grid units.
252
- *
253
- * This is the one place the ladder's sizes are decided. Clients previewing a
254
- * scale placement must call it rather than reproduce the ramp, or the preview
255
- * and the placement will disagree at the rounding.
256
- *
257
- * **Even (no `skew`, or `skew` exactly 1).** Every rung gets `floor(total /
258
- * count)` units and whatever does not divide evenly goes onto the first rung —
259
- * 11 units across 3 rungs is `5, 3, 3`, not three equal slices.
260
- *
261
- * **Skewed.** Rung weights ramp linearly from 1 at index 0 to `skew` at the last
262
- * index, in ladder order — which is ascending price, `scaleMinPrice` to
263
- * `scaleMaxPrice`, for a buy and a sell alike. Each rung takes
264
- * `floor(weight / sumOfWeights * totalUnits)` units, and the units left over go
265
- * to the rungs with the largest discarded fraction, ties broken by ascending
266
- * index. The leftover is deliberately *not* dumped on the first rung the way the
267
- * even split does it: on a `skew` above 1 that would push size back to the end
268
- * of the ladder the caller weighted away from.
269
- *
270
- * The total is expected to sit on the grid already — `calculateFinalPositionSize`
271
- * floors it there — so rounding onto the grid here only absorbs representation
272
- * error. A total too small to give every rung a whole unit is rejected: placing
273
- * fewer orders than asked for would silently change the strategy. A `skew` far
274
- * enough from 1 can starve a rung the same way, and is rejected the same way.
275
- *
276
- * @param params - Split parameters.
277
- * @param params.totalSize - Total size to distribute.
278
- * @param params.count - Number of rungs.
279
- * @param params.szDecimals - The asset's size decimal precision.
280
- * @param params.skew - Optional size weighting across the ladder; any finite
281
- * value above 0, used exactly as given.
282
- * @returns One size string per rung, in ladder order.
283
- */
284
- function splitScaleSizes(params) {
285
- const { totalSize, count, szDecimals, skew } = params;
286
- // Checked here as well as in `computeScalePriceLadder`: this is exported on
287
- // its own, and a count of zero would otherwise return an empty split while a
288
- // fractional one would return slices that do not sum to the total.
289
- if (!Number.isInteger(count) ||
290
- count < orderTypes_js_1.SCALE_ORDER_COUNT.min ||
291
- count > orderTypes_js_1.SCALE_ORDER_COUNT.max) {
292
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SCALE_COUNT_INVALID);
293
- }
294
- // Checked here rather than left to the arithmetic: a non-finite or
295
- // non-positive skew produces weights that are NaN or run negative, and either
296
- // one would come back as a ladder of zero-size rungs instead of a rejection.
297
- if (skew !== undefined && (!Number.isFinite(skew) || skew <= 0)) {
298
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SCALE_RANGE_INVALID);
299
- }
300
- const multiplier = Math.pow(10, szDecimals);
301
- const totalUnits = Math.round(totalSize * multiplier);
302
- if (!Number.isSafeInteger(totalUnits) || totalUnits < count) {
303
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SCALE_SIZE_TOO_SMALL);
304
- }
305
- const unitsPerRung = skew === undefined || skew === 1
306
- ? splitUnitsEvenly({ totalUnits, count })
307
- : splitUnitsBySkew({ totalUnits, count, skew });
308
- // A rung the ramp starved of every unit would be submitted as a zero-size
309
- // order. That is the same failure the total-size check above rejects, and it
310
- // is reported the same way, so a caller reads one reason for "this ladder
311
- // cannot be cut this finely" rather than two.
312
- if (unitsPerRung.some((units) => units === 0)) {
313
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SCALE_SIZE_TOO_SMALL);
314
- }
315
- return unitsPerRung.map((units) => (0, hyperLiquidAdapter_js_1.formatHyperLiquidSize)({ size: units / multiplier, szDecimals }));
316
- }
317
- exports.splitScaleSizes = splitScaleSizes;
318
- /**
319
- * Spread the ladder's units evenly, leftover on the first rung.
320
- *
321
- * @param params - Split parameters.
322
- * @param params.totalUnits - Total size, in whole size-grid units.
323
- * @param params.count - Number of rungs.
324
- * @returns Units per rung, in ladder order.
325
- */
326
- function splitUnitsEvenly(params) {
327
- const { totalUnits, count } = params;
328
- const sliceUnits = Math.floor(totalUnits / count);
329
- const remainderUnits = totalUnits - sliceUnits * count;
330
- return Array.from({ length: count }, (_unused, index) => index === 0 ? sliceUnits + remainderUnits : sliceUnits);
331
- }
332
- /**
333
- * Spread the ladder's units along a linear weight ramp.
334
- *
335
- * Flooring every rung leaves up to `count - 1` units unallocated, and they go to
336
- * the rungs that lost the most to the floor — the standard largest-remainder
337
- * allocation. Ties go to the lower index, which keeps the result a function of
338
- * the inputs alone rather than of sort stability.
339
- *
340
- * @param params - Split parameters.
341
- * @param params.totalUnits - Total size, in whole size-grid units.
342
- * @param params.count - Number of rungs.
343
- * @param params.skew - Weight of the last rung relative to the first.
344
- * @returns Units per rung, in ladder order.
345
- */
346
- function splitUnitsBySkew(params) {
347
- const { totalUnits, count, skew } = params;
348
- const weights = Array.from({ length: count }, (_unused, index) => 1 + ((skew - 1) * index) / (count - 1));
349
- const weightSum = weights.reduce((sum, weight) => sum + weight, 0);
350
- const ideal = weights.map((weight) => (weight / weightSum) * totalUnits);
351
- const unitsPerRung = ideal.map((units) => Math.floor(units));
352
- const leftoverUnits = totalUnits - unitsPerRung.reduce((sum, units) => sum + units, 0);
353
- Array.from({ length: count }, (_unused, index) => index)
354
- .sort((left, right) => {
355
- const fractionDelta = ideal[right] - unitsPerRung[right] - (ideal[left] - unitsPerRung[left]);
356
- return fractionDelta === 0 ? left - right : fractionDelta;
357
- })
358
- .slice(0, leftoverUnits)
359
- .forEach((index) => {
360
- unitsPerRung[index] += 1;
361
- });
362
- return unitsPerRung;
363
- }
364
- /**
365
- * Calculates final position size using USD as source of truth with price validation
366
- *
367
- * This function implements the hybrid approach where USD is the source of truth,
368
- * but includes price staleness validation and proper rounding to prevent precision loss.
369
- *
370
- * @param params - USD amount, size, prices, and configuration
371
- * @returns Final position size as a number
372
- */
373
- function calculateFinalPositionSize(params) {
374
- const { usdAmount, size, currentPrice, priceAtCalculation, maxSlippageBps, szDecimals, leverage, reduceOnly, debugLogger, } = params;
375
- let finalPositionSize;
376
- // Validate price staleness whenever the caller supplied a calculation-time
377
- // price. This runs before the sizing branches on purpose: a full close submits
378
- // the exact live position size rather than a USD-derived one, and it must still
379
- // be rejected when the price has moved past the caller's tolerance.
380
- if (priceAtCalculation) {
381
- const priceDeltaBps = Math.abs(((currentPrice - priceAtCalculation) / priceAtCalculation) * 10000);
382
- const maxSlippageBpsValue = maxSlippageBps ?? perpsConfig_js_1.ORDER_SLIPPAGE_CONFIG.DefaultMarketSlippageBps;
383
- if (priceDeltaBps > maxSlippageBpsValue) {
384
- throw new Error(`Price moved too much: ${priceDeltaBps.toFixed(0)} bps (max: ${maxSlippageBpsValue} bps). ` +
385
- `Expected: ${priceAtCalculation.toFixed(2)}, Current: ${currentPrice.toFixed(2)}`);
386
- }
387
- debugLogger?.log('Price validation passed:', {
388
- priceAtCalculation,
389
- currentPrice,
390
- deltaBps: priceDeltaBps.toFixed(2),
391
- maxSlippageBps: maxSlippageBpsValue,
392
- });
393
- }
394
- if (usdAmount && parseFloat(usdAmount) > 0) {
395
- // USD amount provided - use it as source of truth
396
- const usdValue = parseFloat(usdAmount);
397
- // Recalculate position size with fresh price
398
- finalPositionSize = usdValue / currentPrice;
399
- // A reduce-only order may never exceed the size the caller asked to close:
400
- // that size is already clamped to the live position, while the USD amount was
401
- // computed against an older price and can imply a larger size after an
402
- // adverse move. Capping here keeps USD accuracy in the common case and makes
403
- // the caller's clamp binding.
404
- if (reduceOnly && size) {
405
- const requestedSize = parseFloat(size);
406
- // A supplied size must be positive, or the cap below would submit a
407
- // zero/negative order. Reject it rather than silently falling back to the
408
- // USD-derived size, matching how closePosition treats the same input.
409
- if (!Number.isFinite(requestedSize) || requestedSize <= 0) {
410
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SIZE_POSITIVE);
411
- }
412
- finalPositionSize = Math.min(finalPositionSize, requestedSize);
413
- }
414
- // 3. Apply size decimals rounding (reduce-only never rounds up)
415
- const multiplier = Math.pow(10, szDecimals);
416
- const sizeBeforeRounding = finalPositionSize;
417
- finalPositionSize = reduceOnly
418
- ? floorToSizeDecimals(finalPositionSize, szDecimals)
419
- : Math.round(finalPositionSize * multiplier) / multiplier;
420
- // Rounding down can zero out a reduce-only order whose USD value is worth
421
- // less than one size increment. Fail with a clear error instead of
422
- // submitting a size of "0" the exchange will reject.
423
- if (reduceOnly && finalPositionSize <= 0 && sizeBeforeRounding > 0) {
424
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SIZE_POSITIVE);
425
- }
426
- // 4. Ensure rounded size meets requested USD (fix validation gap).
427
- // Skipped for reduce-only orders: adding an increment there would submit
428
- // more than the position holds and HyperLiquid rejects the order.
429
- let actualNotionalValue = finalPositionSize * currentPrice;
430
- if (!reduceOnly && actualNotionalValue < usdValue) {
431
- // Add 1 minimum increment to meet requested USD
432
- finalPositionSize += 1 / multiplier;
433
- actualNotionalValue = finalPositionSize * currentPrice;
434
- debugLogger?.log('Position size adjusted to meet USD minimum:', {
435
- requestedUsd: usdValue,
436
- beforeAdjustment: finalPositionSize - 1 / multiplier,
437
- afterAdjustment: finalPositionSize,
438
- actualUsd: actualNotionalValue,
439
- });
440
- }
441
- const requiredMargin = actualNotionalValue / (leverage ?? 1);
442
- // Log if rounding caused significant difference
443
- const usdDifference = Math.abs(actualNotionalValue - usdValue);
444
- if (usdDifference > 0.01) {
445
- debugLogger?.log('Position size rounding caused USD difference (acceptable):', {
446
- requestedUsd: usdValue,
447
- actualUsd: actualNotionalValue,
448
- difference: usdDifference,
449
- positionSize: finalPositionSize,
450
- });
451
- }
452
- debugLogger?.log('Recalculated position size with fresh price:', {
453
- usdAmount: usdValue,
454
- priceAtCalculation,
455
- currentPrice,
456
- originalSize: size,
457
- recalculatedSize: finalPositionSize,
458
- requiredMargin,
459
- minIncrement: 1 / multiplier,
460
- });
461
- }
462
- else {
463
- // Legacy: Use provided size (backward compatibility)
464
- finalPositionSize = parseFloat(size ?? '0');
465
- // Reduce-only sizes are formatted with toFixed() further down, which rounds
466
- // up; truncate onto the size grid first so a close can never exceed the
467
- // position it is closing.
468
- if (reduceOnly) {
469
- // A supplied size must be positive, or formatHyperLiquidSize would render
470
- // a zero or negative order size. The USD branch above rejects the same
471
- // input.
472
- if (size && !(finalPositionSize > 0)) {
473
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SIZE_POSITIVE);
474
- }
475
- const sizeBeforeFlooring = finalPositionSize;
476
- finalPositionSize = floorToSizeDecimals(finalPositionSize, szDecimals);
477
- // A positive size that floors to zero is worth less than one increment
478
- if (finalPositionSize <= 0 && sizeBeforeFlooring > 0) {
479
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_SIZE_POSITIVE);
480
- }
481
- }
482
- debugLogger?.log('Using legacy size calculation (no USD amount provided):', {
483
- providedSize: size,
484
- finalSize: finalPositionSize,
485
- });
486
- }
487
- return { finalPositionSize };
488
- }
489
- exports.calculateFinalPositionSize = calculateFinalPositionSize;
490
- /**
491
- * Calculates order price and formatted size based on order type
492
- *
493
- * @param params - Order parameters including type, direction, size, and prices
494
- * @returns Formatted order price, size, and price string
495
- */
496
- function calculateOrderPriceAndSize(params) {
497
- const { orderType, isBuy, finalPositionSize, currentPrice, limitPrice, triggerPrice, maxSlippageBps, szDecimals, } = params;
498
- let orderPrice;
499
- let formattedSize;
500
- if ((0, orderTypes_js_1.isTriggerOrderType)(orderType)) {
501
- // Trigger placements price off the trigger, not the live market: the order
502
- // rests off-book until the trigger fires.
503
- if (!triggerPrice) {
504
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_REQUIRED);
505
- }
506
- const triggerPriceNum = parseFloat(triggerPrice);
507
- if (isNaN(triggerPriceNum) || triggerPriceNum <= 0) {
508
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_POSITIVE);
509
- }
510
- if ((0, orderTypes_js_1.isLimitExecutionOrderType)(orderType)) {
511
- if (!limitPrice) {
512
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_LIMIT_PRICE_REQUIRED);
513
- }
514
- orderPrice = parseFloat(limitPrice);
515
- }
516
- else {
517
- // Market execution on trigger: HyperLiquid still needs a limit price, used
518
- // as a slippage cap. The caller's tolerance wins when supplied; otherwise
519
- // the 10% convention of the existing TP/SL children applies.
520
- const effectiveBps = maxSlippageBps ?? perpsConfig_js_1.ORDER_SLIPPAGE_CONFIG.DefaultTpslSlippageBps;
521
- const slippageValue = effectiveBps / hyperLiquidConfig_js_1.BASIS_POINTS_DIVISOR;
522
- orderPrice = isBuy
523
- ? triggerPriceNum * (1 + slippageValue)
524
- : triggerPriceNum * (1 - slippageValue);
525
- }
526
- formattedSize = (0, hyperLiquidAdapter_js_1.formatHyperLiquidSize)({
527
- size: finalPositionSize,
528
- szDecimals,
529
- });
530
- }
531
- else if (orderType === 'market') {
532
- // Market orders: apply slippage buffer to the live price so HyperLiquid
533
- // receives a worst-case acceptable limit price. Falls back to the
534
- // documented default if the caller does not provide one.
535
- const effectiveBps = maxSlippageBps ?? perpsConfig_js_1.ORDER_SLIPPAGE_CONFIG.DefaultMarketSlippageBps;
536
- const slippageValue = effectiveBps / hyperLiquidConfig_js_1.BASIS_POINTS_DIVISOR;
537
- orderPrice = isBuy
538
- ? currentPrice * (1 + slippageValue)
539
- : currentPrice * (1 - slippageValue);
540
- formattedSize = (0, hyperLiquidAdapter_js_1.formatHyperLiquidSize)({
541
- size: finalPositionSize,
542
- szDecimals,
543
- });
544
- }
545
- else {
546
- // Limit orders: use provided price (no slippage applied)
547
- if (!limitPrice) {
548
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_LIMIT_PRICE_REQUIRED);
549
- }
550
- orderPrice = parseFloat(limitPrice);
551
- formattedSize = (0, hyperLiquidAdapter_js_1.formatHyperLiquidSize)({
552
- size: finalPositionSize,
553
- szDecimals,
554
- });
555
- }
556
- const formattedPrice = (0, hyperLiquidAdapter_js_1.formatHyperLiquidPrice)({
557
- price: orderPrice,
558
- szDecimals,
559
- });
560
- return { orderPrice, formattedSize, formattedPrice };
561
- }
562
- exports.calculateOrderPriceAndSize = calculateOrderPriceAndSize;
563
- /**
564
- * Build the SDK order-type field for the main order.
565
- *
566
- * Trigger placements map to the SDK's trigger shape; everything else keeps the
567
- * existing Gtc/FrontendMarket limit shape.
568
- *
569
- * @param params - Order type parameters
570
- * @param params.orderType - Placement type
571
- * @param params.timeInForce - Time in force; only limit orders may carry one
572
- * @param params.triggerPrice - Trigger price (required for trigger placements)
573
- * @param params.szDecimals - Asset size decimals, for price formatting
574
- * @returns The SDK `t` field for the main order
575
- */
576
- function buildMainOrderTypeField(params) {
577
- const { orderType, timeInForce, triggerPrice, szDecimals } = params;
578
- if (!(0, orderTypes_js_1.isTriggerOrderType)(orderType)) {
579
- if (orderType === 'limit') {
580
- return { limit: { tif: (0, orderTypes_js_1.toSDKTimeInForce)(timeInForce) } };
581
- }
582
- if (timeInForce !== undefined) {
583
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TIME_IN_FORCE_NOT_SUPPORTED);
584
- }
585
- return { limit: { tif: 'FrontendMarket' } };
586
- }
587
- if (timeInForce !== undefined) {
588
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TIME_IN_FORCE_NOT_SUPPORTED);
589
- }
590
- if (!triggerPrice) {
591
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_REQUIRED);
592
- }
593
- return {
594
- trigger: {
595
- isMarket: !(0, orderTypes_js_1.isLimitExecutionOrderType)(orderType),
596
- triggerPx: formatTriggerPrice({
597
- price: triggerPrice,
598
- szDecimals,
599
- error: perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_POSITIVE,
600
- }),
601
- tpsl: (0, orderTypes_js_1.getTriggerDirection)(orderType) === 'stop' ? 'sl' : 'tp',
602
- },
603
- };
604
- }
605
- /**
606
- * Format a price that becomes a `triggerPx`, rejecting one that disappears at
607
- * the asset's precision.
608
- *
609
- * A positive price below the asset's tick (`0.0004` where the asset quotes to
610
- * three places) formats to `'0'`, which the exchange rejects. Callers validate
611
- * this up front via `validateOrderPrecision`; this is the guard on the build
612
- * path itself, so no caller can assemble an order that cannot be accepted.
613
- *
614
- * @param params - Price parameters
615
- * @param params.price - The requested price
616
- * @param params.szDecimals - Asset size decimals
617
- * @param params.error - Typed error to throw when the price rounds away
618
- * @returns The exchange-formatted price, guaranteed positive.
619
- */
620
- function formatTriggerPrice(params) {
621
- const { price, szDecimals, error } = params;
622
- const formatted = (0, hyperLiquidAdapter_js_1.formatHyperLiquidPrice)({ price, szDecimals });
623
- if (parseFloat(formatted) <= 0) {
624
- throw new Error(error);
625
- }
626
- return formatted;
627
- }
628
- /**
629
- * Resolve the size of an attached TP/SL order.
630
- *
631
- * @param params - Size parameters
632
- * @param params.tpslSize - Requested partial size, if any
633
- * @param params.formattedSize - Full order size, used when no partial size is given
634
- * @param params.szDecimals - Asset size decimals
635
- * @returns The exchange-formatted TP/SL order size
636
- */
637
- function formatTpslSize(params) {
638
- const { tpslSize, formattedSize, szDecimals } = params;
639
- if (tpslSize === undefined) {
640
- return formattedSize;
641
- }
642
- // Validation compares the requested size against `params.size`, but a
643
- // usdAmount-based order is finally sized from a fresher price, so the parent
644
- // can end up smaller than the child that validated cleanly. Clamp so the
645
- // attached TP/SL never exceeds the order it protects.
646
- const requested = parseFloat(tpslSize);
647
- const parentSize = parseFloat(formattedSize);
648
- const size = Number.isFinite(parentSize) && Number.isFinite(requested)
649
- ? Math.min(requested, parentSize)
650
- : requested;
651
- return formatPartialTpslSize({ size, szDecimals });
652
- }
653
- /**
654
- * Check that an order's prices and partial sizes survive the asset's precision.
655
- *
656
- * Validation elsewhere sees the values the caller supplied; this sees what the
657
- * exchange will actually receive. A positive value below the asset's tick
658
- * formats to `'0'`, which either changes the order's meaning (a zero-sized
659
- * trigger covers the whole position) or is rejected outright (a zero
660
- * `triggerPx`).
661
- *
662
- * Callers run this before taking any side effect — cancelling the position's
663
- * existing triggers, changing leverage, moving HIP-3 margin — so a value that
664
- * would only fail once the orders are built cannot leave a position stripped of
665
- * its protection, or an account with leverage moved, for an order that was
666
- * never going to be accepted.
667
- *
668
- * @param params - Price and size parameters
669
- * @param params.triggerPrice - Trigger price for a trigger placement, if any
670
- * @param params.takeProfitPrice - Attached take profit price, if any
671
- * @param params.stopLossPrice - Attached stop loss price, if any
672
- * @param params.takeProfitSize - Requested partial take profit size, if any
673
- * @param params.stopLossSize - Requested partial stop loss size, if any
674
- * @param params.szDecimals - Asset size decimals
675
- * @returns Validation result with isValid flag and optional error message
676
- */
677
- function validateOrderPrecision(params) {
678
- const { triggerPrice, takeProfitPrice, stopLossPrice, takeProfitSize, stopLossSize, szDecimals, } = params;
679
- for (const size of [takeProfitSize, stopLossSize]) {
680
- if (size === undefined) {
681
- continue;
682
- }
683
- if (parseFloat((0, hyperLiquidAdapter_js_1.formatHyperLiquidSize)({ size, szDecimals })) <= 0) {
684
- return {
685
- isValid: false,
686
- error: perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TPSL_SIZE_INVALID,
687
- };
688
- }
689
- }
690
- // Prices carry their own precision: an asset quotes to
691
- // `MaxPriceDecimals - szDecimals` places, so a positive price under that tick
692
- // formats to '0'. Every one of these becomes a `triggerPx` the exchange
693
- // rejects outright.
694
- const priceChecks = [
695
- [triggerPrice, perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TRIGGER_PRICE_POSITIVE],
696
- [takeProfitPrice, perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_PRICE_POSITIVE],
697
- [stopLossPrice, perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_PRICE_POSITIVE],
698
- ];
699
- for (const [price, error] of priceChecks) {
700
- if (price === undefined) {
701
- continue;
702
- }
703
- if (parseFloat((0, hyperLiquidAdapter_js_1.formatHyperLiquidPrice)({ price, szDecimals })) <= 0) {
704
- return { isValid: false, error };
705
- }
706
- }
707
- return { isValid: true };
708
- }
709
- exports.validateOrderPrecision = validateOrderPrecision;
710
- /**
711
- * Format a partial TP/SL size, rejecting one that disappears at the asset
712
- * precision.
713
- *
714
- * Validation only sees the requested size, so a positive value below the
715
- * asset's precision (0.0004 against `szDecimals: 3`) passes and then formats to
716
- * `'0'`. HyperLiquid reads a zero-sized trigger as covering the whole position,
717
- * which would silently turn a partial TP/SL into a full close.
718
- *
719
- * @param params - Size parameters
720
- * @param params.size - The requested partial size
721
- * @param params.szDecimals - Asset size decimals
722
- * @returns The exchange-formatted size, guaranteed positive.
723
- */
724
- function formatPartialTpslSize(params) {
725
- const formatted = (0, hyperLiquidAdapter_js_1.formatHyperLiquidSize)(params);
726
- if (parseFloat(formatted) <= 0) {
727
- throw new Error(perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_TPSL_SIZE_INVALID);
728
- }
729
- return formatted;
730
- }
731
- exports.formatPartialTpslSize = formatPartialTpslSize;
732
- /**
733
- * Builds orders array including main order and optional TP/SL orders
734
- *
735
- * @param params - Order construction parameters
736
- * @returns Array of SDK order params and grouping type
737
- */
738
- function buildOrdersArray(params) {
739
- const { assetId, isBuy, formattedPrice, formattedSize, reduceOnly, orderType, timeInForce, clientOrderId, triggerPrice, takeProfitPrice, stopLossPrice, takeProfitSize, stopLossSize, szDecimals, grouping, } = params;
740
- const orders = [];
741
- // 1. Main order
742
- const mainOrder = {
743
- a: assetId,
744
- b: isBuy,
745
- p: formattedPrice,
746
- s: formattedSize,
747
- r: reduceOnly || false,
748
- t: buildMainOrderTypeField({
749
- orderType,
750
- timeInForce,
751
- triggerPrice,
752
- szDecimals,
753
- }),
754
- c: clientOrderId ? clientOrderId : undefined,
755
- };
756
- orders.push(mainOrder);
757
- // 2. Take Profit order
758
- if (takeProfitPrice) {
759
- const tpOrder = {
760
- a: assetId,
761
- b: !isBuy,
762
- p: (0, hyperLiquidAdapter_js_1.formatHyperLiquidPrice)({
763
- price: parseFloat(takeProfitPrice),
764
- szDecimals,
765
- }),
766
- s: formatTpslSize({
767
- tpslSize: takeProfitSize,
768
- formattedSize,
769
- szDecimals,
770
- }),
771
- r: true,
772
- t: {
773
- trigger: {
774
- isMarket: false,
775
- triggerPx: formatTriggerPrice({
776
- price: takeProfitPrice,
777
- szDecimals,
778
- error: perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_PRICE_POSITIVE,
779
- }),
780
- tpsl: 'tp',
781
- },
782
- },
783
- };
784
- orders.push(tpOrder);
785
- }
786
- // 3. Stop Loss order
787
- if (stopLossPrice) {
788
- // Apply 10% slippage to SL limit price (executes as market order when triggered)
789
- // HyperLiquid recommended: 10% for TP/SL orders
790
- const stopLossPriceNum = parseFloat(stopLossPrice);
791
- const slippageValue = perpsConfig_js_1.ORDER_SLIPPAGE_CONFIG.DefaultTpslSlippageBps / 10000;
792
- const limitPriceWithSlippage = isBuy
793
- ? stopLossPriceNum * (1 - slippageValue) // Selling to close long: willing to accept LESS (slippage protection)
794
- : stopLossPriceNum * (1 + slippageValue); // Buying to close short: willing to pay MORE (slippage protection)
795
- const slOrder = {
796
- a: assetId,
797
- b: !isBuy,
798
- p: (0, hyperLiquidAdapter_js_1.formatHyperLiquidPrice)({
799
- price: limitPriceWithSlippage,
800
- szDecimals,
801
- }),
802
- s: formatTpslSize({ tpslSize: stopLossSize, formattedSize, szDecimals }),
803
- r: true,
804
- t: {
805
- trigger: {
806
- isMarket: true,
807
- triggerPx: formatTriggerPrice({
808
- price: stopLossPrice,
809
- szDecimals,
810
- error: perpsErrorCodes_js_1.PERPS_ERROR_CODES.ORDER_PRICE_POSITIVE,
811
- }),
812
- tpsl: 'sl',
813
- },
814
- },
815
- };
816
- orders.push(slOrder);
817
- }
818
- // Determine grouping
819
- const finalGrouping = grouping ?? ((takeProfitPrice ?? stopLossPrice) ? 'normalTpsl' : 'na');
820
- return { orders, grouping: finalGrouping };
821
- }
822
- exports.buildOrdersArray = buildOrdersArray;
823
- //# sourceMappingURL=orderCalculations.cjs.map