@metamask-previews/perps-controller 0.0.0-preview-685dbf46b → 1.0.0-preview-bc00f2c

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 (482) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/PerpsController.cjs +3077 -65
  3. package/dist/PerpsController.cjs.map +1 -1
  4. package/dist/PerpsController.d.cts +969 -82
  5. package/dist/PerpsController.d.cts.map +1 -1
  6. package/dist/PerpsController.d.mts +969 -82
  7. package/dist/PerpsController.d.mts.map +1 -1
  8. package/dist/PerpsController.mjs +3073 -62
  9. package/dist/PerpsController.mjs.map +1 -1
  10. package/dist/aggregation/SubscriptionMultiplexer.cjs +441 -0
  11. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +1 -0
  12. package/dist/aggregation/SubscriptionMultiplexer.d.cts +171 -0
  13. package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +1 -0
  14. package/dist/aggregation/SubscriptionMultiplexer.d.mts +171 -0
  15. package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +1 -0
  16. package/dist/aggregation/SubscriptionMultiplexer.mjs +437 -0
  17. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +1 -0
  18. package/dist/aggregation/index.cjs +9 -0
  19. package/dist/aggregation/index.cjs.map +1 -0
  20. package/dist/aggregation/index.d.cts +6 -0
  21. package/dist/aggregation/index.d.cts.map +1 -0
  22. package/dist/aggregation/index.d.mts +6 -0
  23. package/dist/aggregation/index.d.mts.map +1 -0
  24. package/dist/aggregation/index.mjs +5 -0
  25. package/dist/aggregation/index.mjs.map +1 -0
  26. package/dist/constants/chartConfig.cjs +227 -0
  27. package/dist/constants/chartConfig.cjs.map +1 -0
  28. package/dist/constants/chartConfig.d.cts +216 -0
  29. package/dist/constants/chartConfig.d.cts.map +1 -0
  30. package/dist/constants/chartConfig.d.mts +216 -0
  31. package/dist/constants/chartConfig.d.mts.map +1 -0
  32. package/dist/constants/chartConfig.mjs +221 -0
  33. package/dist/constants/chartConfig.mjs.map +1 -0
  34. package/dist/constants/eventNames.cjs +436 -0
  35. package/dist/constants/eventNames.cjs.map +1 -0
  36. package/dist/constants/eventNames.d.cts +387 -0
  37. package/dist/constants/eventNames.d.cts.map +1 -0
  38. package/dist/constants/eventNames.d.mts +387 -0
  39. package/dist/constants/eventNames.d.mts.map +1 -0
  40. package/dist/constants/eventNames.mjs +433 -0
  41. package/dist/constants/eventNames.mjs.map +1 -0
  42. package/dist/constants/hyperLiquidConfig.cjs +380 -0
  43. package/dist/constants/hyperLiquidConfig.cjs.map +1 -0
  44. package/dist/constants/hyperLiquidConfig.d.cts +236 -0
  45. package/dist/constants/hyperLiquidConfig.d.cts.map +1 -0
  46. package/dist/constants/hyperLiquidConfig.d.mts +236 -0
  47. package/dist/constants/hyperLiquidConfig.d.mts.map +1 -0
  48. package/dist/constants/hyperLiquidConfig.mjs +371 -0
  49. package/dist/constants/hyperLiquidConfig.mjs.map +1 -0
  50. package/dist/constants/index.cjs +28 -0
  51. package/dist/constants/index.cjs.map +1 -0
  52. package/dist/constants/index.d.cts +12 -0
  53. package/dist/constants/index.d.cts.map +1 -0
  54. package/dist/constants/index.d.mts +12 -0
  55. package/dist/constants/index.d.mts.map +1 -0
  56. package/dist/constants/index.mjs +12 -0
  57. package/dist/constants/index.mjs.map +1 -0
  58. package/dist/constants/myxConfig.cjs +229 -0
  59. package/dist/constants/myxConfig.cjs.map +1 -0
  60. package/dist/constants/myxConfig.d.cts +106 -0
  61. package/dist/constants/myxConfig.d.cts.map +1 -0
  62. package/dist/constants/myxConfig.d.mts +106 -0
  63. package/dist/constants/myxConfig.d.mts.map +1 -0
  64. package/dist/constants/myxConfig.mjs +219 -0
  65. package/dist/constants/myxConfig.mjs.map +1 -0
  66. package/dist/constants/orderTypes.cjs +31 -0
  67. package/dist/constants/orderTypes.cjs.map +1 -0
  68. package/dist/constants/orderTypes.d.cts +19 -0
  69. package/dist/constants/orderTypes.d.cts.map +1 -0
  70. package/dist/constants/orderTypes.d.mts +19 -0
  71. package/dist/constants/orderTypes.d.mts.map +1 -0
  72. package/dist/constants/orderTypes.mjs +27 -0
  73. package/dist/constants/orderTypes.mjs.map +1 -0
  74. package/dist/constants/performanceMetrics.cjs +63 -0
  75. package/dist/constants/performanceMetrics.cjs.map +1 -0
  76. package/dist/constants/performanceMetrics.d.cts +46 -0
  77. package/dist/constants/performanceMetrics.d.cts.map +1 -0
  78. package/dist/constants/performanceMetrics.d.mts +46 -0
  79. package/dist/constants/performanceMetrics.d.mts.map +1 -0
  80. package/dist/constants/performanceMetrics.mjs +60 -0
  81. package/dist/constants/performanceMetrics.mjs.map +1 -0
  82. package/dist/constants/perpsConfig.cjs +295 -0
  83. package/dist/constants/perpsConfig.cjs.map +1 -0
  84. package/dist/constants/perpsConfig.d.cts +221 -0
  85. package/dist/constants/perpsConfig.d.cts.map +1 -0
  86. package/dist/constants/perpsConfig.d.mts +221 -0
  87. package/dist/constants/perpsConfig.d.mts.map +1 -0
  88. package/dist/constants/perpsConfig.mjs +292 -0
  89. package/dist/constants/perpsConfig.mjs.map +1 -0
  90. package/dist/constants/transactionsHistoryConfig.cjs +19 -0
  91. package/dist/constants/transactionsHistoryConfig.cjs.map +1 -0
  92. package/dist/constants/transactionsHistoryConfig.d.cts +16 -0
  93. package/dist/constants/transactionsHistoryConfig.d.cts.map +1 -0
  94. package/dist/constants/transactionsHistoryConfig.d.mts +16 -0
  95. package/dist/constants/transactionsHistoryConfig.d.mts.map +1 -0
  96. package/dist/constants/transactionsHistoryConfig.mjs +16 -0
  97. package/dist/constants/transactionsHistoryConfig.mjs.map +1 -0
  98. package/dist/index.cjs +63 -1
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.d.cts +38 -2
  101. package/dist/index.d.cts.map +1 -1
  102. package/dist/index.d.mts +38 -2
  103. package/dist/index.d.mts.map +1 -1
  104. package/dist/index.mjs +46 -1
  105. package/dist/index.mjs.map +1 -1
  106. package/dist/perpsErrorCodes.cjs +80 -0
  107. package/dist/perpsErrorCodes.cjs.map +1 -0
  108. package/dist/perpsErrorCodes.d.cts +65 -0
  109. package/dist/perpsErrorCodes.d.cts.map +1 -0
  110. package/dist/perpsErrorCodes.d.mts +65 -0
  111. package/dist/perpsErrorCodes.d.mts.map +1 -0
  112. package/dist/perpsErrorCodes.mjs +77 -0
  113. package/dist/perpsErrorCodes.mjs.map +1 -0
  114. package/dist/providers/AggregatedPerpsProvider.cjs +508 -0
  115. package/dist/providers/AggregatedPerpsProvider.cjs.map +1 -0
  116. package/dist/providers/AggregatedPerpsProvider.d.cts +171 -0
  117. package/dist/providers/AggregatedPerpsProvider.d.cts.map +1 -0
  118. package/dist/providers/AggregatedPerpsProvider.d.mts +171 -0
  119. package/dist/providers/AggregatedPerpsProvider.d.mts.map +1 -0
  120. package/dist/providers/AggregatedPerpsProvider.mjs +504 -0
  121. package/dist/providers/AggregatedPerpsProvider.mjs.map +1 -0
  122. package/dist/providers/HyperLiquidProvider.cjs +5679 -0
  123. package/dist/providers/HyperLiquidProvider.cjs.map +1 -0
  124. package/dist/providers/HyperLiquidProvider.d.cts +516 -0
  125. package/dist/providers/HyperLiquidProvider.d.cts.map +1 -0
  126. package/dist/providers/HyperLiquidProvider.d.mts +516 -0
  127. package/dist/providers/HyperLiquidProvider.d.mts.map +1 -0
  128. package/dist/providers/HyperLiquidProvider.mjs +5675 -0
  129. package/dist/providers/HyperLiquidProvider.mjs.map +1 -0
  130. package/dist/providers/MYXProvider.cjs +514 -0
  131. package/dist/providers/MYXProvider.cjs.map +1 -0
  132. package/dist/providers/MYXProvider.d.cts +105 -0
  133. package/dist/providers/MYXProvider.d.cts.map +1 -0
  134. package/dist/providers/MYXProvider.d.mts +105 -0
  135. package/dist/providers/MYXProvider.d.mts.map +1 -0
  136. package/dist/providers/MYXProvider.mjs +510 -0
  137. package/dist/providers/MYXProvider.mjs.map +1 -0
  138. package/dist/routing/ProviderRouter.cjs +154 -0
  139. package/dist/routing/ProviderRouter.cjs.map +1 -0
  140. package/dist/routing/ProviderRouter.d.cts +112 -0
  141. package/dist/routing/ProviderRouter.d.cts.map +1 -0
  142. package/dist/routing/ProviderRouter.d.mts +112 -0
  143. package/dist/routing/ProviderRouter.d.mts.map +1 -0
  144. package/dist/routing/ProviderRouter.mjs +150 -0
  145. package/dist/routing/ProviderRouter.mjs.map +1 -0
  146. package/dist/routing/index.cjs +9 -0
  147. package/dist/routing/index.cjs.map +1 -0
  148. package/dist/routing/index.d.cts +6 -0
  149. package/dist/routing/index.d.cts.map +1 -0
  150. package/dist/routing/index.d.mts +6 -0
  151. package/dist/routing/index.d.mts.map +1 -0
  152. package/dist/routing/index.mjs +5 -0
  153. package/dist/routing/index.mjs.map +1 -0
  154. package/dist/selectors.cjs +166 -0
  155. package/dist/selectors.cjs.map +1 -0
  156. package/dist/selectors.d.cts +362 -0
  157. package/dist/selectors.d.cts.map +1 -0
  158. package/dist/selectors.d.mts +362 -0
  159. package/dist/selectors.d.mts.map +1 -0
  160. package/dist/selectors.mjs +158 -0
  161. package/dist/selectors.mjs.map +1 -0
  162. package/dist/services/AccountService.cjs +324 -0
  163. package/dist/services/AccountService.cjs.map +1 -0
  164. package/dist/services/AccountService.d.cts +56 -0
  165. package/dist/services/AccountService.d.cts.map +1 -0
  166. package/dist/services/AccountService.d.mts +56 -0
  167. package/dist/services/AccountService.d.mts.map +1 -0
  168. package/dist/services/AccountService.mjs +320 -0
  169. package/dist/services/AccountService.mjs.map +1 -0
  170. package/dist/services/DataLakeService.cjs +233 -0
  171. package/dist/services/DataLakeService.cjs.map +1 -0
  172. package/dist/services/DataLakeService.d.cts +51 -0
  173. package/dist/services/DataLakeService.d.cts.map +1 -0
  174. package/dist/services/DataLakeService.d.mts +51 -0
  175. package/dist/services/DataLakeService.d.mts.map +1 -0
  176. package/dist/services/DataLakeService.mjs +229 -0
  177. package/dist/services/DataLakeService.mjs.map +1 -0
  178. package/dist/services/DepositService.cjs +98 -0
  179. package/dist/services/DepositService.cjs.map +1 -0
  180. package/dist/services/DepositService.d.cts +39 -0
  181. package/dist/services/DepositService.d.cts.map +1 -0
  182. package/dist/services/DepositService.d.mts +39 -0
  183. package/dist/services/DepositService.d.mts.map +1 -0
  184. package/dist/services/DepositService.mjs +94 -0
  185. package/dist/services/DepositService.mjs.map +1 -0
  186. package/dist/services/EligibilityService.cjs +173 -0
  187. package/dist/services/EligibilityService.cjs.map +1 -0
  188. package/dist/services/EligibilityService.d.cts +39 -0
  189. package/dist/services/EligibilityService.d.cts.map +1 -0
  190. package/dist/services/EligibilityService.d.mts +39 -0
  191. package/dist/services/EligibilityService.d.mts.map +1 -0
  192. package/dist/services/EligibilityService.mjs +169 -0
  193. package/dist/services/EligibilityService.mjs.map +1 -0
  194. package/dist/services/FeatureFlagConfigurationService.cjs +257 -0
  195. package/dist/services/FeatureFlagConfigurationService.cjs.map +1 -0
  196. package/dist/services/FeatureFlagConfigurationService.d.cts +73 -0
  197. package/dist/services/FeatureFlagConfigurationService.d.cts.map +1 -0
  198. package/dist/services/FeatureFlagConfigurationService.d.mts +73 -0
  199. package/dist/services/FeatureFlagConfigurationService.d.mts.map +1 -0
  200. package/dist/services/FeatureFlagConfigurationService.mjs +253 -0
  201. package/dist/services/FeatureFlagConfigurationService.mjs.map +1 -0
  202. package/dist/services/HyperLiquidClientService.cjs +867 -0
  203. package/dist/services/HyperLiquidClientService.cjs.map +1 -0
  204. package/dist/services/HyperLiquidClientService.d.cts +214 -0
  205. package/dist/services/HyperLiquidClientService.d.cts.map +1 -0
  206. package/dist/services/HyperLiquidClientService.d.mts +214 -0
  207. package/dist/services/HyperLiquidClientService.d.mts.map +1 -0
  208. package/dist/services/HyperLiquidClientService.mjs +862 -0
  209. package/dist/services/HyperLiquidClientService.mjs.map +1 -0
  210. package/dist/services/HyperLiquidSubscriptionService.cjs +2199 -0
  211. package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -0
  212. package/dist/services/HyperLiquidSubscriptionService.d.cts +187 -0
  213. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -0
  214. package/dist/services/HyperLiquidSubscriptionService.d.mts +187 -0
  215. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -0
  216. package/dist/services/HyperLiquidSubscriptionService.mjs +2195 -0
  217. package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -0
  218. package/dist/services/HyperLiquidWalletService.cjs +163 -0
  219. package/dist/services/HyperLiquidWalletService.cjs.map +1 -0
  220. package/dist/services/HyperLiquidWalletService.d.cts +78 -0
  221. package/dist/services/HyperLiquidWalletService.d.cts.map +1 -0
  222. package/dist/services/HyperLiquidWalletService.d.mts +78 -0
  223. package/dist/services/HyperLiquidWalletService.d.mts.map +1 -0
  224. package/dist/services/HyperLiquidWalletService.mjs +159 -0
  225. package/dist/services/HyperLiquidWalletService.mjs.map +1 -0
  226. package/dist/services/MYXClientService.cjs +304 -0
  227. package/dist/services/MYXClientService.cjs.map +1 -0
  228. package/dist/services/MYXClientService.d.cts +81 -0
  229. package/dist/services/MYXClientService.d.cts.map +1 -0
  230. package/dist/services/MYXClientService.d.mts +81 -0
  231. package/dist/services/MYXClientService.d.mts.map +1 -0
  232. package/dist/services/MYXClientService.mjs +300 -0
  233. package/dist/services/MYXClientService.mjs.map +1 -0
  234. package/dist/services/MarketDataService.cjs +848 -0
  235. package/dist/services/MarketDataService.cjs.map +1 -0
  236. package/dist/services/MarketDataService.d.cts +291 -0
  237. package/dist/services/MarketDataService.d.cts.map +1 -0
  238. package/dist/services/MarketDataService.d.mts +291 -0
  239. package/dist/services/MarketDataService.d.mts.map +1 -0
  240. package/dist/services/MarketDataService.mjs +844 -0
  241. package/dist/services/MarketDataService.mjs.map +1 -0
  242. package/dist/services/RewardsIntegrationService.cjs +120 -0
  243. package/dist/services/RewardsIntegrationService.cjs.map +1 -0
  244. package/dist/services/RewardsIntegrationService.d.cts +28 -0
  245. package/dist/services/RewardsIntegrationService.d.cts.map +1 -0
  246. package/dist/services/RewardsIntegrationService.d.mts +28 -0
  247. package/dist/services/RewardsIntegrationService.d.mts.map +1 -0
  248. package/dist/services/RewardsIntegrationService.mjs +116 -0
  249. package/dist/services/RewardsIntegrationService.mjs.map +1 -0
  250. package/dist/services/ServiceContext.cjs +3 -0
  251. package/dist/services/ServiceContext.cjs.map +1 -0
  252. package/dist/services/ServiceContext.d.cts +86 -0
  253. package/dist/services/ServiceContext.d.cts.map +1 -0
  254. package/dist/services/ServiceContext.d.mts +86 -0
  255. package/dist/services/ServiceContext.d.mts.map +1 -0
  256. package/dist/services/ServiceContext.mjs +2 -0
  257. package/dist/services/ServiceContext.mjs.map +1 -0
  258. package/dist/services/TradingReadinessCache.cjs +288 -0
  259. package/dist/services/TradingReadinessCache.cjs.map +1 -0
  260. package/dist/services/TradingReadinessCache.d.cts +174 -0
  261. package/dist/services/TradingReadinessCache.d.cts.map +1 -0
  262. package/dist/services/TradingReadinessCache.d.mts +174 -0
  263. package/dist/services/TradingReadinessCache.d.mts.map +1 -0
  264. package/dist/services/TradingReadinessCache.mjs +285 -0
  265. package/dist/services/TradingReadinessCache.mjs.map +1 -0
  266. package/dist/services/TradingService.cjs +1457 -0
  267. package/dist/services/TradingService.cjs.map +1 -0
  268. package/dist/services/TradingService.d.cts +195 -0
  269. package/dist/services/TradingService.d.cts.map +1 -0
  270. package/dist/services/TradingService.d.mts +195 -0
  271. package/dist/services/TradingService.d.mts.map +1 -0
  272. package/dist/services/TradingService.mjs +1453 -0
  273. package/dist/services/TradingService.mjs.map +1 -0
  274. package/dist/types/config.cjs +3 -0
  275. package/dist/types/config.cjs.map +1 -0
  276. package/dist/types/config.d.cts +49 -0
  277. package/dist/types/config.d.cts.map +1 -0
  278. package/dist/types/config.d.mts +49 -0
  279. package/dist/types/config.d.mts.map +1 -0
  280. package/dist/types/config.mjs +2 -0
  281. package/dist/types/config.mjs.map +1 -0
  282. package/dist/types/hyperliquid-types.cjs +3 -0
  283. package/dist/types/hyperliquid-types.cjs.map +1 -0
  284. package/dist/types/hyperliquid-types.d.cts +20 -0
  285. package/dist/types/hyperliquid-types.d.cts.map +1 -0
  286. package/dist/types/hyperliquid-types.d.mts +20 -0
  287. package/dist/types/hyperliquid-types.d.mts.map +1 -0
  288. package/dist/types/hyperliquid-types.mjs +2 -0
  289. package/dist/types/hyperliquid-types.mjs.map +1 -0
  290. package/dist/types/index.cjs +115 -0
  291. package/dist/types/index.cjs.map +1 -0
  292. package/dist/types/index.d.cts +1262 -0
  293. package/dist/types/index.d.cts.map +1 -0
  294. package/dist/types/index.d.mts +1262 -0
  295. package/dist/types/index.d.mts.map +1 -0
  296. package/dist/types/index.mjs +97 -0
  297. package/dist/types/index.mjs.map +1 -0
  298. package/dist/types/messenger.cjs +3 -0
  299. package/dist/types/messenger.cjs.map +1 -0
  300. package/dist/types/messenger.d.cts +27 -0
  301. package/dist/types/messenger.d.cts.map +1 -0
  302. package/dist/types/messenger.d.mts +27 -0
  303. package/dist/types/messenger.d.mts.map +1 -0
  304. package/dist/types/messenger.mjs +2 -0
  305. package/dist/types/messenger.mjs.map +1 -0
  306. package/dist/types/myx-types.cjs +25 -0
  307. package/dist/types/myx-types.cjs.map +1 -0
  308. package/dist/types/myx-types.d.cts +63 -0
  309. package/dist/types/myx-types.d.cts.map +1 -0
  310. package/dist/types/myx-types.d.mts +63 -0
  311. package/dist/types/myx-types.d.mts.map +1 -0
  312. package/dist/types/myx-types.mjs +22 -0
  313. package/dist/types/myx-types.mjs.map +1 -0
  314. package/dist/types/perps-types.cjs +4 -0
  315. package/dist/types/perps-types.cjs.map +1 -0
  316. package/dist/types/perps-types.d.cts +105 -0
  317. package/dist/types/perps-types.d.cts.map +1 -0
  318. package/dist/types/perps-types.d.mts +105 -0
  319. package/dist/types/perps-types.d.mts.map +1 -0
  320. package/dist/types/perps-types.mjs +2 -0
  321. package/dist/types/perps-types.mjs.map +1 -0
  322. package/dist/types/token.cjs +3 -0
  323. package/dist/types/token.cjs.map +1 -0
  324. package/dist/types/token.d.cts +25 -0
  325. package/dist/types/token.d.cts.map +1 -0
  326. package/dist/types/token.d.mts +25 -0
  327. package/dist/types/token.d.mts.map +1 -0
  328. package/dist/types/token.mjs +2 -0
  329. package/dist/types/token.mjs.map +1 -0
  330. package/dist/types/transactionTypes.cjs +28 -0
  331. package/dist/types/transactionTypes.cjs.map +1 -0
  332. package/dist/types/transactionTypes.d.cts +64 -0
  333. package/dist/types/transactionTypes.d.cts.map +1 -0
  334. package/dist/types/transactionTypes.d.mts +64 -0
  335. package/dist/types/transactionTypes.d.mts.map +1 -0
  336. package/dist/types/transactionTypes.mjs +23 -0
  337. package/dist/types/transactionTypes.mjs.map +1 -0
  338. package/dist/utils/accountUtils.cjs +100 -0
  339. package/dist/utils/accountUtils.cjs.map +1 -0
  340. package/dist/utils/accountUtils.d.cts +30 -0
  341. package/dist/utils/accountUtils.d.cts.map +1 -0
  342. package/dist/utils/accountUtils.d.mts +30 -0
  343. package/dist/utils/accountUtils.d.mts.map +1 -0
  344. package/dist/utils/accountUtils.mjs +92 -0
  345. package/dist/utils/accountUtils.mjs.map +1 -0
  346. package/dist/utils/errorUtils.cjs +35 -0
  347. package/dist/utils/errorUtils.cjs.map +1 -0
  348. package/dist/utils/errorUtils.d.cts +15 -0
  349. package/dist/utils/errorUtils.d.cts.map +1 -0
  350. package/dist/utils/errorUtils.d.mts +15 -0
  351. package/dist/utils/errorUtils.d.mts.map +1 -0
  352. package/dist/utils/errorUtils.mjs +31 -0
  353. package/dist/utils/errorUtils.mjs.map +1 -0
  354. package/dist/utils/hyperLiquidAdapter.cjs +331 -0
  355. package/dist/utils/hyperLiquidAdapter.cjs.map +1 -0
  356. package/dist/utils/hyperLiquidAdapter.d.cts +42 -0
  357. package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -0
  358. package/dist/utils/hyperLiquidAdapter.d.mts +42 -0
  359. package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -0
  360. package/dist/utils/hyperLiquidAdapter.mjs +316 -0
  361. package/dist/utils/hyperLiquidAdapter.mjs.map +1 -0
  362. package/dist/utils/hyperLiquidOrderBookProcessor.cjs +83 -0
  363. package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +1 -0
  364. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +55 -0
  365. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +1 -0
  366. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +55 -0
  367. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +1 -0
  368. package/dist/utils/hyperLiquidOrderBookProcessor.mjs +78 -0
  369. package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +1 -0
  370. package/dist/utils/hyperLiquidValidation.cjs +426 -0
  371. package/dist/utils/hyperLiquidValidation.cjs.map +1 -0
  372. package/dist/utils/hyperLiquidValidation.d.cts +143 -0
  373. package/dist/utils/hyperLiquidValidation.d.cts.map +1 -0
  374. package/dist/utils/hyperLiquidValidation.d.mts +143 -0
  375. package/dist/utils/hyperLiquidValidation.d.mts.map +1 -0
  376. package/dist/utils/hyperLiquidValidation.mjs +413 -0
  377. package/dist/utils/hyperLiquidValidation.mjs.map +1 -0
  378. package/dist/utils/idUtils.cjs +18 -0
  379. package/dist/utils/idUtils.cjs.map +1 -0
  380. package/dist/utils/idUtils.d.cts +6 -0
  381. package/dist/utils/idUtils.d.cts.map +1 -0
  382. package/dist/utils/idUtils.d.mts +6 -0
  383. package/dist/utils/idUtils.d.mts.map +1 -0
  384. package/dist/utils/idUtils.mjs +10 -0
  385. package/dist/utils/idUtils.mjs.map +1 -0
  386. package/dist/utils/index.cjs +59 -0
  387. package/dist/utils/index.cjs.map +1 -0
  388. package/dist/utils/index.d.cts +25 -0
  389. package/dist/utils/index.d.cts.map +1 -0
  390. package/dist/utils/index.d.mts +25 -0
  391. package/dist/utils/index.d.mts.map +1 -0
  392. package/dist/utils/index.mjs +30 -0
  393. package/dist/utils/index.mjs.map +1 -0
  394. package/dist/utils/marketDataTransform.cjs +211 -0
  395. package/dist/utils/marketDataTransform.cjs.map +1 -0
  396. package/dist/utils/marketDataTransform.d.cts +40 -0
  397. package/dist/utils/marketDataTransform.d.cts.map +1 -0
  398. package/dist/utils/marketDataTransform.d.mts +40 -0
  399. package/dist/utils/marketDataTransform.d.mts.map +1 -0
  400. package/dist/utils/marketDataTransform.mjs +205 -0
  401. package/dist/utils/marketDataTransform.mjs.map +1 -0
  402. package/dist/utils/marketUtils.cjs +151 -0
  403. package/dist/utils/marketUtils.cjs.map +1 -0
  404. package/dist/utils/marketUtils.d.cts +30 -0
  405. package/dist/utils/marketUtils.d.cts.map +1 -0
  406. package/dist/utils/marketUtils.d.mts +30 -0
  407. package/dist/utils/marketUtils.d.mts.map +1 -0
  408. package/dist/utils/marketUtils.mjs +138 -0
  409. package/dist/utils/marketUtils.mjs.map +1 -0
  410. package/dist/utils/myxAdapter.cjs +224 -0
  411. package/dist/utils/myxAdapter.cjs.map +1 -0
  412. package/dist/utils/myxAdapter.d.cts +81 -0
  413. package/dist/utils/myxAdapter.d.cts.map +1 -0
  414. package/dist/utils/myxAdapter.d.mts +81 -0
  415. package/dist/utils/myxAdapter.d.mts.map +1 -0
  416. package/dist/utils/myxAdapter.mjs +213 -0
  417. package/dist/utils/myxAdapter.mjs.map +1 -0
  418. package/dist/utils/orderCalculations.cjs +283 -0
  419. package/dist/utils/orderCalculations.cjs.map +1 -0
  420. package/dist/utils/orderCalculations.d.cts +107 -0
  421. package/dist/utils/orderCalculations.d.cts.map +1 -0
  422. package/dist/utils/orderCalculations.d.mts +107 -0
  423. package/dist/utils/orderCalculations.d.mts.map +1 -0
  424. package/dist/utils/orderCalculations.mjs +274 -0
  425. package/dist/utils/orderCalculations.mjs.map +1 -0
  426. package/dist/utils/rewardsUtils.cjs +98 -0
  427. package/dist/utils/rewardsUtils.cjs.map +1 -0
  428. package/dist/utils/rewardsUtils.d.cts +33 -0
  429. package/dist/utils/rewardsUtils.d.cts.map +1 -0
  430. package/dist/utils/rewardsUtils.d.mts +33 -0
  431. package/dist/utils/rewardsUtils.d.mts.map +1 -0
  432. package/dist/utils/rewardsUtils.mjs +92 -0
  433. package/dist/utils/rewardsUtils.mjs.map +1 -0
  434. package/dist/utils/significantFigures.cjs +88 -0
  435. package/dist/utils/significantFigures.cjs.map +1 -0
  436. package/dist/utils/significantFigures.d.cts +25 -0
  437. package/dist/utils/significantFigures.d.cts.map +1 -0
  438. package/dist/utils/significantFigures.d.mts +25 -0
  439. package/dist/utils/significantFigures.d.mts.map +1 -0
  440. package/dist/utils/significantFigures.mjs +82 -0
  441. package/dist/utils/significantFigures.mjs.map +1 -0
  442. package/dist/utils/sortMarkets.cjs +93 -0
  443. package/dist/utils/sortMarkets.cjs.map +1 -0
  444. package/dist/utils/sortMarkets.d.cts +27 -0
  445. package/dist/utils/sortMarkets.d.cts.map +1 -0
  446. package/dist/utils/sortMarkets.d.mts +27 -0
  447. package/dist/utils/sortMarkets.d.mts.map +1 -0
  448. package/dist/utils/sortMarkets.mjs +88 -0
  449. package/dist/utils/sortMarkets.mjs.map +1 -0
  450. package/dist/utils/standaloneInfoClient.cjs +70 -0
  451. package/dist/utils/standaloneInfoClient.cjs.map +1 -0
  452. package/dist/utils/standaloneInfoClient.d.cts +37 -0
  453. package/dist/utils/standaloneInfoClient.d.cts.map +1 -0
  454. package/dist/utils/standaloneInfoClient.d.mts +37 -0
  455. package/dist/utils/standaloneInfoClient.d.mts.map +1 -0
  456. package/dist/utils/standaloneInfoClient.mjs +64 -0
  457. package/dist/utils/standaloneInfoClient.mjs.map +1 -0
  458. package/dist/utils/stringParseUtils.cjs +18 -0
  459. package/dist/utils/stringParseUtils.cjs.map +1 -0
  460. package/dist/utils/stringParseUtils.d.cts +3 -0
  461. package/dist/utils/stringParseUtils.d.cts.map +1 -0
  462. package/dist/utils/stringParseUtils.d.mts +3 -0
  463. package/dist/utils/stringParseUtils.d.mts.map +1 -0
  464. package/dist/utils/stringParseUtils.mjs +13 -0
  465. package/dist/utils/stringParseUtils.mjs.map +1 -0
  466. package/dist/utils/transferData.cjs +33 -0
  467. package/dist/utils/transferData.cjs.map +1 -0
  468. package/dist/utils/transferData.d.cts +9 -0
  469. package/dist/utils/transferData.d.cts.map +1 -0
  470. package/dist/utils/transferData.d.mts +9 -0
  471. package/dist/utils/transferData.d.mts.map +1 -0
  472. package/dist/utils/transferData.mjs +29 -0
  473. package/dist/utils/transferData.mjs.map +1 -0
  474. package/dist/utils/wait.cjs +6 -0
  475. package/dist/utils/wait.cjs.map +1 -0
  476. package/dist/utils/wait.d.cts +2 -0
  477. package/dist/utils/wait.d.cts.map +1 -0
  478. package/dist/utils/wait.d.mts +2 -0
  479. package/dist/utils/wait.d.mts.map +1 -0
  480. package/dist/utils/wait.mjs +2 -0
  481. package/dist/utils/wait.mjs.map +1 -0
  482. package/package.json +16 -2
@@ -0,0 +1,37 @@
1
+ import { InfoClient } from "@nktkas/hyperliquid";
2
+ import type { ClearinghouseStateResponse, FrontendOpenOrdersResponse } from "../types/hyperliquid-types.cjs";
3
+ export type StandaloneInfoClientOptions = {
4
+ /** Whether to use testnet API endpoint */
5
+ isTestnet: boolean;
6
+ /** Request timeout in ms (default: CONNECTION_TIMEOUT_MS) */
7
+ timeout?: number;
8
+ };
9
+ /**
10
+ * Creates a standalone InfoClient for lightweight read-only queries.
11
+ * Does not require full perps initialization (no wallet, WebSocket, etc.)
12
+ *
13
+ * @param options - The configuration options for the standalone client.
14
+ * @returns A new InfoClient instance configured for read-only queries.
15
+ */
16
+ export declare const createStandaloneInfoClient: (options: StandaloneInfoClientOptions) => InfoClient;
17
+ /**
18
+ * Query clearinghouseState across multiple DEXs in parallel.
19
+ * Used by standalone mode to aggregate positions/account state across HIP-3 DEXs.
20
+ *
21
+ * @param infoClient - The HyperLiquid InfoClient instance to use for queries.
22
+ * @param userAddress - The user's wallet address to query state for.
23
+ * @param dexs - The array of DEX identifiers to query (null for main DEX).
24
+ * @returns A promise that resolves to an array of clearinghouse state responses.
25
+ */
26
+ export declare const queryStandaloneClearinghouseStates: (infoClient: InfoClient, userAddress: string, dexs: (string | null)[]) => Promise<ClearinghouseStateResponse[]>;
27
+ /**
28
+ * Query frontendOpenOrders across multiple DEXs in parallel.
29
+ * Used by standalone mode to fetch open orders across HIP-3 DEXs.
30
+ *
31
+ * @param infoClient - The HyperLiquid InfoClient instance to use for queries.
32
+ * @param userAddress - The user's wallet address to query orders for.
33
+ * @param dexs - The array of DEX identifiers to query (null for main DEX).
34
+ * @returns A promise that resolves to an array of frontend open orders responses.
35
+ */
36
+ export declare const queryStandaloneOpenOrders: (infoClient: InfoClient, userAddress: string, dexs: (string | null)[]) => Promise<FrontendOpenOrdersResponse[]>;
37
+ //# sourceMappingURL=standaloneInfoClient.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standaloneInfoClient.d.cts","sourceRoot":"","sources":["../../src/utils/standaloneInfoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,4BAA4B;AAGhE,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,uCAAmC;AAEpC,MAAM,MAAM,2BAA2B,GAAG;IACxC,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,YAC5B,2BAA2B,KACnC,UASF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,eACjC,UAAU,eACT,MAAM,QACb,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,KACtB,QAAQ,0BAA0B,EAAE,CAmBtC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,eACxB,UAAU,eACT,MAAM,QACb,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,KACtB,QAAQ,0BAA0B,EAAE,CAmBtC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { InfoClient } from "@nktkas/hyperliquid";
2
+ import type { ClearinghouseStateResponse, FrontendOpenOrdersResponse } from "../types/hyperliquid-types.mjs";
3
+ export type StandaloneInfoClientOptions = {
4
+ /** Whether to use testnet API endpoint */
5
+ isTestnet: boolean;
6
+ /** Request timeout in ms (default: CONNECTION_TIMEOUT_MS) */
7
+ timeout?: number;
8
+ };
9
+ /**
10
+ * Creates a standalone InfoClient for lightweight read-only queries.
11
+ * Does not require full perps initialization (no wallet, WebSocket, etc.)
12
+ *
13
+ * @param options - The configuration options for the standalone client.
14
+ * @returns A new InfoClient instance configured for read-only queries.
15
+ */
16
+ export declare const createStandaloneInfoClient: (options: StandaloneInfoClientOptions) => InfoClient;
17
+ /**
18
+ * Query clearinghouseState across multiple DEXs in parallel.
19
+ * Used by standalone mode to aggregate positions/account state across HIP-3 DEXs.
20
+ *
21
+ * @param infoClient - The HyperLiquid InfoClient instance to use for queries.
22
+ * @param userAddress - The user's wallet address to query state for.
23
+ * @param dexs - The array of DEX identifiers to query (null for main DEX).
24
+ * @returns A promise that resolves to an array of clearinghouse state responses.
25
+ */
26
+ export declare const queryStandaloneClearinghouseStates: (infoClient: InfoClient, userAddress: string, dexs: (string | null)[]) => Promise<ClearinghouseStateResponse[]>;
27
+ /**
28
+ * Query frontendOpenOrders across multiple DEXs in parallel.
29
+ * Used by standalone mode to fetch open orders across HIP-3 DEXs.
30
+ *
31
+ * @param infoClient - The HyperLiquid InfoClient instance to use for queries.
32
+ * @param userAddress - The user's wallet address to query orders for.
33
+ * @param dexs - The array of DEX identifiers to query (null for main DEX).
34
+ * @returns A promise that resolves to an array of frontend open orders responses.
35
+ */
36
+ export declare const queryStandaloneOpenOrders: (infoClient: InfoClient, userAddress: string, dexs: (string | null)[]) => Promise<FrontendOpenOrdersResponse[]>;
37
+ //# sourceMappingURL=standaloneInfoClient.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standaloneInfoClient.d.mts","sourceRoot":"","sources":["../../src/utils/standaloneInfoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,4BAA4B;AAGhE,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,uCAAmC;AAEpC,MAAM,MAAM,2BAA2B,GAAG;IACxC,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,YAC5B,2BAA2B,KACnC,UASF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,eACjC,UAAU,eACT,MAAM,QACb,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,KACtB,QAAQ,0BAA0B,EAAE,CAmBtC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,eACxB,UAAU,eACT,MAAM,QACb,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,KACtB,QAAQ,0BAA0B,EAAE,CAmBtC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { HttpTransport, InfoClient } from "@nktkas/hyperliquid";
2
+ import { PERPS_CONSTANTS } from "../constants/perpsConfig.mjs";
3
+ /**
4
+ * Creates a standalone InfoClient for lightweight read-only queries.
5
+ * Does not require full perps initialization (no wallet, WebSocket, etc.)
6
+ *
7
+ * @param options - The configuration options for the standalone client.
8
+ * @returns A new InfoClient instance configured for read-only queries.
9
+ */
10
+ export const createStandaloneInfoClient = (options) => {
11
+ const { isTestnet, timeout = PERPS_CONSTANTS.ConnectionTimeoutMs } = options;
12
+ const httpTransport = new HttpTransport({
13
+ isTestnet,
14
+ timeout,
15
+ });
16
+ return new InfoClient({ transport: httpTransport });
17
+ };
18
+ /**
19
+ * Query clearinghouseState across multiple DEXs in parallel.
20
+ * Used by standalone mode to aggregate positions/account state across HIP-3 DEXs.
21
+ *
22
+ * @param infoClient - The HyperLiquid InfoClient instance to use for queries.
23
+ * @param userAddress - The user's wallet address to query state for.
24
+ * @param dexs - The array of DEX identifiers to query (null for main DEX).
25
+ * @returns A promise that resolves to an array of clearinghouse state responses.
26
+ */
27
+ export const queryStandaloneClearinghouseStates = async (infoClient, userAddress, dexs) => {
28
+ const results = await Promise.allSettled(dexs.map(async (dex) => {
29
+ const queryParams = {
30
+ user: userAddress,
31
+ };
32
+ if (dex) {
33
+ queryParams.dex = dex;
34
+ }
35
+ return infoClient.clearinghouseState(queryParams);
36
+ }));
37
+ return results
38
+ .filter((result) => result.status === 'fulfilled')
39
+ .map((result) => result.value);
40
+ };
41
+ /**
42
+ * Query frontendOpenOrders across multiple DEXs in parallel.
43
+ * Used by standalone mode to fetch open orders across HIP-3 DEXs.
44
+ *
45
+ * @param infoClient - The HyperLiquid InfoClient instance to use for queries.
46
+ * @param userAddress - The user's wallet address to query orders for.
47
+ * @param dexs - The array of DEX identifiers to query (null for main DEX).
48
+ * @returns A promise that resolves to an array of frontend open orders responses.
49
+ */
50
+ export const queryStandaloneOpenOrders = async (infoClient, userAddress, dexs) => {
51
+ const results = await Promise.allSettled(dexs.map(async (dex) => {
52
+ const queryParams = {
53
+ user: userAddress,
54
+ };
55
+ if (dex) {
56
+ queryParams.dex = dex;
57
+ }
58
+ return infoClient.frontendOpenOrders(queryParams);
59
+ }));
60
+ return results
61
+ .filter((result) => result.status === 'fulfilled')
62
+ .map((result) => result.value);
63
+ };
64
+ //# sourceMappingURL=standaloneInfoClient.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standaloneInfoClient.mjs","sourceRoot":"","sources":["../../src/utils/standaloneInfoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,4BAA4B;AAEhE,OAAO,EAAE,eAAe,EAAE,qCAAiC;AAa3D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,OAAoC,EACxB,EAAE;IACd,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,eAAe,CAAC,mBAAmB,EAAE,GAAG,OAAO,CAAC;IAE7E,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;QACtC,SAAS;QACT,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,IAAI,UAAU,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,KAAK,EACrD,UAAsB,EACtB,WAAmB,EACnB,IAAuB,EACgB,EAAE;IACzC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACtC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,WAAW,GAAmC;YAClD,IAAI,EAAE,WAAW;SAClB,CAAC;QACF,IAAI,GAAG,EAAE,CAAC;YACR,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC;QACxB,CAAC;QACD,OAAO,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,OAAO;SACX,MAAM,CACL,CAAC,MAAM,EAAgE,EAAE,CACvE,MAAM,CAAC,MAAM,KAAK,WAAW,CAChC;SACA,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,EAC5C,UAAsB,EACtB,WAAmB,EACnB,IAAuB,EACgB,EAAE;IACzC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACtC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,WAAW,GAAmC;YAClD,IAAI,EAAE,WAAW;SAClB,CAAC;QACF,IAAI,GAAG,EAAE,CAAC;YACR,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC;QACxB,CAAC;QACD,OAAO,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,OAAO;SACX,MAAM,CACL,CAAC,MAAM,EAAgE,EAAE,CACvE,MAAM,CAAC,MAAM,KAAK,WAAW,CAChC;SACA,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC","sourcesContent":["import { HttpTransport, InfoClient } from '@nktkas/hyperliquid';\n\nimport { PERPS_CONSTANTS } from '../constants/perpsConfig';\nimport type {\n ClearinghouseStateResponse,\n FrontendOpenOrdersResponse,\n} from '../types/hyperliquid-types';\n\nexport type StandaloneInfoClientOptions = {\n /** Whether to use testnet API endpoint */\n isTestnet: boolean;\n /** Request timeout in ms (default: CONNECTION_TIMEOUT_MS) */\n timeout?: number;\n};\n\n/**\n * Creates a standalone InfoClient for lightweight read-only queries.\n * Does not require full perps initialization (no wallet, WebSocket, etc.)\n *\n * @param options - The configuration options for the standalone client.\n * @returns A new InfoClient instance configured for read-only queries.\n */\nexport const createStandaloneInfoClient = (\n options: StandaloneInfoClientOptions,\n): InfoClient => {\n const { isTestnet, timeout = PERPS_CONSTANTS.ConnectionTimeoutMs } = options;\n\n const httpTransport = new HttpTransport({\n isTestnet,\n timeout,\n });\n\n return new InfoClient({ transport: httpTransport });\n};\n\n/**\n * Query clearinghouseState across multiple DEXs in parallel.\n * Used by standalone mode to aggregate positions/account state across HIP-3 DEXs.\n *\n * @param infoClient - The HyperLiquid InfoClient instance to use for queries.\n * @param userAddress - The user's wallet address to query state for.\n * @param dexs - The array of DEX identifiers to query (null for main DEX).\n * @returns A promise that resolves to an array of clearinghouse state responses.\n */\nexport const queryStandaloneClearinghouseStates = async (\n infoClient: InfoClient,\n userAddress: string,\n dexs: (string | null)[],\n): Promise<ClearinghouseStateResponse[]> => {\n const results = await Promise.allSettled(\n dexs.map(async (dex) => {\n const queryParams: { user: string; dex?: string } = {\n user: userAddress,\n };\n if (dex) {\n queryParams.dex = dex;\n }\n return infoClient.clearinghouseState(queryParams);\n }),\n );\n\n return results\n .filter(\n (result): result is PromiseFulfilledResult<ClearinghouseStateResponse> =>\n result.status === 'fulfilled',\n )\n .map((result) => result.value);\n};\n\n/**\n * Query frontendOpenOrders across multiple DEXs in parallel.\n * Used by standalone mode to fetch open orders across HIP-3 DEXs.\n *\n * @param infoClient - The HyperLiquid InfoClient instance to use for queries.\n * @param userAddress - The user's wallet address to query orders for.\n * @param dexs - The array of DEX identifiers to query (null for main DEX).\n * @returns A promise that resolves to an array of frontend open orders responses.\n */\nexport const queryStandaloneOpenOrders = async (\n infoClient: InfoClient,\n userAddress: string,\n dexs: (string | null)[],\n): Promise<FrontendOpenOrdersResponse[]> => {\n const results = await Promise.allSettled(\n dexs.map(async (dex) => {\n const queryParams: { user: string; dex?: string } = {\n user: userAddress,\n };\n if (dex) {\n queryParams.dex = dex;\n }\n return infoClient.frontendOpenOrders(queryParams);\n }),\n );\n\n return results\n .filter(\n (result): result is PromiseFulfilledResult<FrontendOpenOrdersResponse> =>\n result.status === 'fulfilled',\n )\n .map((result) => result.value);\n};\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCommaSeparatedString = exports.stripQuotes = void 0;
4
+ const stripQuotes = (str) => {
5
+ let result = str;
6
+ while ((result.startsWith('"') && result.endsWith('"')) ||
7
+ (result.startsWith("'") && result.endsWith("'"))) {
8
+ result = result.slice(1, -1);
9
+ }
10
+ return result;
11
+ };
12
+ exports.stripQuotes = stripQuotes;
13
+ const parseCommaSeparatedString = (value) => value
14
+ .split(',')
15
+ .map((item) => item.trim())
16
+ .filter((item) => item.length > 0);
17
+ exports.parseCommaSeparatedString = parseCommaSeparatedString;
18
+ //# sourceMappingURL=stringParseUtils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringParseUtils.cjs","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":";;;AAAO,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IACjD,IAAI,MAAM,GAAG,GAAG,CAAC;IACjB,OACE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAChD,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AATW,QAAA,WAAW,eAStB;AAEK,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAY,EAAE,CACnE,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAJ1B,QAAA,yBAAyB,6BAIC","sourcesContent":["export const stripQuotes = (str: string): string => {\n let result = str;\n while (\n (result.startsWith('\"') && result.endsWith('\"')) ||\n (result.startsWith(\"'\") && result.endsWith(\"'\"))\n ) {\n result = result.slice(1, -1);\n }\n return result;\n};\n\nexport const parseCommaSeparatedString = (value: string): string[] =>\n value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item.length > 0);\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const stripQuotes: (str: string) => string;
2
+ export declare const parseCommaSeparatedString: (value: string) => string[];
3
+ //# sourceMappingURL=stringParseUtils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringParseUtils.d.cts","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MASzC,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,MAAM,EAI1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const stripQuotes: (str: string) => string;
2
+ export declare const parseCommaSeparatedString: (value: string) => string[];
3
+ //# sourceMappingURL=stringParseUtils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringParseUtils.d.mts","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MASzC,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,MAAM,EAI1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ export const stripQuotes = (str) => {
2
+ let result = str;
3
+ while ((result.startsWith('"') && result.endsWith('"')) ||
4
+ (result.startsWith("'") && result.endsWith("'"))) {
5
+ result = result.slice(1, -1);
6
+ }
7
+ return result;
8
+ };
9
+ export const parseCommaSeparatedString = (value) => value
10
+ .split(',')
11
+ .map((item) => item.trim())
12
+ .filter((item) => item.length > 0);
13
+ //# sourceMappingURL=stringParseUtils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringParseUtils.mjs","sourceRoot":"","sources":["../../src/utils/stringParseUtils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IACjD,IAAI,MAAM,GAAG,GAAG,CAAC;IACjB,OACE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAChD,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAY,EAAE,CACnE,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC","sourcesContent":["export const stripQuotes = (str: string): string => {\n let result = str;\n while (\n (result.startsWith('\"') && result.endsWith('\"')) ||\n (result.startsWith(\"'\") && result.endsWith(\"'\"))\n ) {\n result = result.slice(1, -1);\n }\n return result;\n};\n\nexport const parseCommaSeparatedString = (value: string): string[] =>\n value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item.length > 0);\n"]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateERC20TransferData = void 0;
4
+ /**
5
+ * Portable ERC-20 transfer data generation.
6
+ * Only the 'transfer(address,uint256)' case is needed by PerpsController.
7
+ *
8
+ * Uses @metamask/abi-utils (core package with proper TypeScript types)
9
+ * and @metamask/utils for hex conversion.
10
+ */
11
+ const abi_utils_1 = require("@metamask/abi-utils");
12
+ const utils_1 = require("@metamask/utils");
13
+ /** ERC-20 transfer function selector: transfer(address,uint256) */
14
+ const TRANSFER_FUNCTION_SIGNATURE = '0xa9059cbb';
15
+ /**
16
+ * Generate ERC-20 transfer calldata.
17
+ *
18
+ * @param toAddress - Recipient address (0x-prefixed hex string)
19
+ * @param amount - Transfer amount (0x-prefixed hex string)
20
+ * @returns Hex-encoded calldata for ERC-20 transfer
21
+ */
22
+ function generateERC20TransferData(toAddress, amount) {
23
+ if (!toAddress || !amount) {
24
+ throw new Error("[transferData] 'toAddress' and 'amount' must be defined for ERC-20 transfer");
25
+ }
26
+ const encoded = (0, abi_utils_1.encode)(['address', 'uint256'], [toAddress, amount]);
27
+ // bytesToHex returns '0x...' prefixed string; strip the '0x' prefix
28
+ // since we prepend the function selector ourselves
29
+ const encodedHex = (0, utils_1.bytesToHex)(encoded).slice(2);
30
+ return TRANSFER_FUNCTION_SIGNATURE + encodedHex;
31
+ }
32
+ exports.generateERC20TransferData = generateERC20TransferData;
33
+ //# sourceMappingURL=transferData.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transferData.cjs","sourceRoot":"","sources":["../../src/utils/transferData.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,mDAA6C;AAC7C,2CAA6C;AAE7C,mEAAmE;AACnE,MAAM,2BAA2B,GAAG,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,SAAiB,EACjB,MAAc;IAEd,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,kBAAM,EAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACpE,oEAAoE;IACpE,mDAAmD;IACnD,MAAM,UAAU,GAAG,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEhD,OAAO,2BAA2B,GAAG,UAAU,CAAC;AAClD,CAAC;AAhBD,8DAgBC","sourcesContent":["/**\n * Portable ERC-20 transfer data generation.\n * Only the 'transfer(address,uint256)' case is needed by PerpsController.\n *\n * Uses @metamask/abi-utils (core package with proper TypeScript types)\n * and @metamask/utils for hex conversion.\n */\nimport { encode } from '@metamask/abi-utils';\nimport { bytesToHex } from '@metamask/utils';\n\n/** ERC-20 transfer function selector: transfer(address,uint256) */\nconst TRANSFER_FUNCTION_SIGNATURE = '0xa9059cbb';\n\n/**\n * Generate ERC-20 transfer calldata.\n *\n * @param toAddress - Recipient address (0x-prefixed hex string)\n * @param amount - Transfer amount (0x-prefixed hex string)\n * @returns Hex-encoded calldata for ERC-20 transfer\n */\nexport function generateERC20TransferData(\n toAddress: string,\n amount: string,\n): string {\n if (!toAddress || !amount) {\n throw new Error(\n \"[transferData] 'toAddress' and 'amount' must be defined for ERC-20 transfer\",\n );\n }\n\n const encoded = encode(['address', 'uint256'], [toAddress, amount]);\n // bytesToHex returns '0x...' prefixed string; strip the '0x' prefix\n // since we prepend the function selector ourselves\n const encodedHex = bytesToHex(encoded).slice(2);\n\n return TRANSFER_FUNCTION_SIGNATURE + encodedHex;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generate ERC-20 transfer calldata.
3
+ *
4
+ * @param toAddress - Recipient address (0x-prefixed hex string)
5
+ * @param amount - Transfer amount (0x-prefixed hex string)
6
+ * @returns Hex-encoded calldata for ERC-20 transfer
7
+ */
8
+ export declare function generateERC20TransferData(toAddress: string, amount: string): string;
9
+ //# sourceMappingURL=transferData.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transferData.d.cts","sourceRoot":"","sources":["../../src/utils/transferData.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAaR"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generate ERC-20 transfer calldata.
3
+ *
4
+ * @param toAddress - Recipient address (0x-prefixed hex string)
5
+ * @param amount - Transfer amount (0x-prefixed hex string)
6
+ * @returns Hex-encoded calldata for ERC-20 transfer
7
+ */
8
+ export declare function generateERC20TransferData(toAddress: string, amount: string): string;
9
+ //# sourceMappingURL=transferData.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transferData.d.mts","sourceRoot":"","sources":["../../src/utils/transferData.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAaR"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Portable ERC-20 transfer data generation.
3
+ * Only the 'transfer(address,uint256)' case is needed by PerpsController.
4
+ *
5
+ * Uses @metamask/abi-utils (core package with proper TypeScript types)
6
+ * and @metamask/utils for hex conversion.
7
+ */
8
+ import { encode } from "@metamask/abi-utils";
9
+ import { bytesToHex } from "@metamask/utils";
10
+ /** ERC-20 transfer function selector: transfer(address,uint256) */
11
+ const TRANSFER_FUNCTION_SIGNATURE = '0xa9059cbb';
12
+ /**
13
+ * Generate ERC-20 transfer calldata.
14
+ *
15
+ * @param toAddress - Recipient address (0x-prefixed hex string)
16
+ * @param amount - Transfer amount (0x-prefixed hex string)
17
+ * @returns Hex-encoded calldata for ERC-20 transfer
18
+ */
19
+ export function generateERC20TransferData(toAddress, amount) {
20
+ if (!toAddress || !amount) {
21
+ throw new Error("[transferData] 'toAddress' and 'amount' must be defined for ERC-20 transfer");
22
+ }
23
+ const encoded = encode(['address', 'uint256'], [toAddress, amount]);
24
+ // bytesToHex returns '0x...' prefixed string; strip the '0x' prefix
25
+ // since we prepend the function selector ourselves
26
+ const encodedHex = bytesToHex(encoded).slice(2);
27
+ return TRANSFER_FUNCTION_SIGNATURE + encodedHex;
28
+ }
29
+ //# sourceMappingURL=transferData.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transferData.mjs","sourceRoot":"","sources":["../../src/utils/transferData.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,4BAA4B;AAC7C,OAAO,EAAE,UAAU,EAAE,wBAAwB;AAE7C,mEAAmE;AACnE,MAAM,2BAA2B,GAAG,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAiB,EACjB,MAAc;IAEd,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACpE,oEAAoE;IACpE,mDAAmD;IACnD,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEhD,OAAO,2BAA2B,GAAG,UAAU,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Portable ERC-20 transfer data generation.\n * Only the 'transfer(address,uint256)' case is needed by PerpsController.\n *\n * Uses @metamask/abi-utils (core package with proper TypeScript types)\n * and @metamask/utils for hex conversion.\n */\nimport { encode } from '@metamask/abi-utils';\nimport { bytesToHex } from '@metamask/utils';\n\n/** ERC-20 transfer function selector: transfer(address,uint256) */\nconst TRANSFER_FUNCTION_SIGNATURE = '0xa9059cbb';\n\n/**\n * Generate ERC-20 transfer calldata.\n *\n * @param toAddress - Recipient address (0x-prefixed hex string)\n * @param amount - Transfer amount (0x-prefixed hex string)\n * @returns Hex-encoded calldata for ERC-20 transfer\n */\nexport function generateERC20TransferData(\n toAddress: string,\n amount: string,\n): string {\n if (!toAddress || !amount) {\n throw new Error(\n \"[transferData] 'toAddress' and 'amount' must be defined for ERC-20 transfer\",\n );\n }\n\n const encoded = encode(['address', 'uint256'], [toAddress, amount]);\n // bytesToHex returns '0x...' prefixed string; strip the '0x' prefix\n // since we prepend the function selector ourselves\n const encodedHex = bytesToHex(encoded).slice(2);\n\n return TRANSFER_FUNCTION_SIGNATURE + encodedHex;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wait = void 0;
4
+ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
5
+ exports.wait = wait;
6
+ //# sourceMappingURL=wait.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.cjs","sourceRoot":"","sources":["../../src/utils/wait.ts"],"names":[],"mappings":";;;AAAO,MAAM,IAAI,GAAG,CAAC,EAAU,EAAiB,EAAE,CAChD,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AADvC,QAAA,IAAI,QACmC","sourcesContent":["export const wait = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const wait: (ms: number) => Promise<void>;
2
+ //# sourceMappingURL=wait.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.d.cts","sourceRoot":"","sources":["../../src/utils/wait.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,OAAQ,MAAM,KAAG,QAAQ,IAAI,CACK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const wait: (ms: number) => Promise<void>;
2
+ //# sourceMappingURL=wait.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.d.mts","sourceRoot":"","sources":["../../src/utils/wait.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,OAAQ,MAAM,KAAG,QAAQ,IAAI,CACK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2
+ //# sourceMappingURL=wait.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait.mjs","sourceRoot":"","sources":["../../src/utils/wait.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAU,EAAiB,EAAE,CAChD,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC","sourcesContent":["export const wait = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/perps-controller",
3
- "version": "0.0.0-preview-685dbf46b",
3
+ "version": "1.0.0-preview-bc00f2c",
4
4
  "description": "Controller for perpetual trading functionality in MetaMask",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -47,15 +47,29 @@
47
47
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
48
48
  },
49
49
  "dependencies": {
50
+ "@metamask/abi-utils": "^2.0.3",
50
51
  "@metamask/base-controller": "^9.0.0",
51
52
  "@metamask/controller-utils": "^11.19.0",
52
53
  "@metamask/messenger": "^0.3.0",
53
- "@metamask/utils": "^11.9.0"
54
+ "@metamask/utils": "^11.9.0",
55
+ "@myx-trade/sdk": "^0.1.265",
56
+ "@nktkas/hyperliquid": "^0.30.2",
57
+ "bignumber.js": "^9.1.2",
58
+ "reselect": "^5.1.1",
59
+ "uuid": "^8.3.2"
54
60
  },
55
61
  "devDependencies": {
62
+ "@metamask/account-tree-controller": "^4.1.1",
56
63
  "@metamask/auto-changelog": "^3.4.4",
64
+ "@metamask/keyring-controller": "^25.1.0",
65
+ "@metamask/keyring-internal-api": "^10.0.0",
66
+ "@metamask/network-controller": "^30.0.0",
67
+ "@metamask/profile-sync-controller": "^27.1.0",
68
+ "@metamask/remote-feature-flag-controller": "^4.1.0",
69
+ "@metamask/transaction-controller": "^62.20.0",
57
70
  "@ts-bridge/cli": "^0.6.4",
58
71
  "@types/jest": "^29.5.14",
72
+ "@types/uuid": "^8.3.0",
59
73
  "deepmerge": "^4.2.2",
60
74
  "jest": "^29.7.0",
61
75
  "ts-jest": "^29.2.5",