@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 @@
1
+ {"version":3,"file":"myx-types.mjs","sourceRoot":"","sources":["../../src/types/myx-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwDH,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;CACE,CAAC","sourcesContent":["/**\n * MYX Protocol Type Definitions\n *\n * Minimal types needed for Stage 1 (market display and price fetching).\n * Only defines what's needed - SDK types are re-exported with MYX prefix.\n */\n\nimport type { CaipChainId } from '@metamask/utils';\n\n// ============================================================================\n// Re-export SDK Types with MYX prefix for consistency\n// ============================================================================\n\nexport type { PoolSymbolAllResponse as MYXPoolSymbol } from '@myx-trade/sdk';\nexport type { TickerDataItem as MYXTicker } from '@myx-trade/sdk';\n\n// ============================================================================\n// Network Configuration Types\n// ============================================================================\n\n/**\n * MYX Network type - mainnet or testnet\n */\nexport type MYXNetwork = 'mainnet' | 'testnet';\n\n/**\n * MYX Endpoint configuration for a single network\n */\nexport type MYXEndpointConfig = {\n http: string;\n ws: string;\n};\n\n/**\n * MYX Endpoints for all networks\n */\nexport type MYXEndpoints = {\n mainnet: MYXEndpointConfig;\n testnet: MYXEndpointConfig;\n};\n\n/**\n * MYX Asset network configuration (token addresses per network)\n */\nexport type MYXAssetNetworkConfig = {\n chainId: CaipChainId;\n tokenAddress: string;\n};\n\n/**\n * MYX Asset configurations by network\n */\nexport type MYXAssetConfigs = {\n // USDT is the token symbol used as API key - not a variable name\n // eslint-disable-next-line @typescript-eslint/naming-convention\n USDT: {\n mainnet: MYXAssetNetworkConfig;\n testnet: MYXAssetNetworkConfig;\n };\n};\n\n// ============================================================================\n// Market Overlap Configuration\n// ============================================================================\n\n/**\n * Markets that overlap with HyperLiquid\n * These are excluded from MYX display in v1.0 to avoid confusion\n * In Stage 7, we'll implement market collision handling\n */\nexport const MYX_HL_OVERLAPPING_MARKETS = [\n 'BTC',\n 'ETH',\n 'BNB',\n 'PUMP',\n 'WLFI',\n] as const;\n\nexport type MYXOverlappingMarket = (typeof MYX_HL_OVERLAPPING_MARKETS)[number];\n\n// ============================================================================\n// Client Service Types\n// ============================================================================\n\n/**\n * Price callback for REST polling\n */\nexport type MYXPriceCallback = (\n tickers: { symbol: string; price: string; change24h: number }[],\n) => void;\n\n/**\n * Error callback for client operations\n */\nexport type MYXErrorCallback = (error: Error) => void;\n"]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const chartConfig_1 = require("../constants/chartConfig.cjs");
4
+ //# sourceMappingURL=perps-types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perps-types.cjs","sourceRoot":"","sources":["../../src/types/perps-types.ts"],"names":[],"mappings":";;AAIA,8DAAwD","sourcesContent":["/**\n * Test result states for SDK validation\n */\nimport { OrderType } from '.';\nimport { CandlePeriod } from '../constants/chartConfig';\n\nexport type TestResultStatus =\n | 'idle'\n | 'loading'\n | 'success'\n | 'warning'\n | 'error';\n\n/**\n * Test result data structure\n */\nexport type TestResult = {\n status: TestResultStatus;\n message: string;\n data?: Record<string, unknown>;\n};\n\n/**\n * SDK test types\n */\nexport type SDKTestType = 'connection' | 'asset-listing' | 'websocket';\n\n/**\n * Hyperliquid asset interface (basic structure)\n */\nexport type HyperliquidAsset = {\n name: string;\n [key: string]: unknown;\n};\n\n/**\n * Represents a single candlestick data point\n */\nexport type CandleStick = {\n time: number;\n open: string;\n high: string;\n low: string;\n close: string;\n volume: string;\n};\n\n/**\n * Represents historical candlestick data for a specific symbol and interval\n */\nexport type CandleData = {\n /** Asset identifier (e.g., 'BTC', 'ETH'). Protocol-agnostic terminology for multi-provider support. */\n symbol: string;\n interval: CandlePeriod;\n candles: CandleStick[];\n};\n\n// Export all configuration types directly\nexport type * from './config';\nexport type * from './token';\n\n/**\n * Order form state for the Perps order view\n */\nexport type OrderFormState = {\n asset: string;\n direction: 'long' | 'short';\n amount: string;\n leverage: number;\n balancePercent: number;\n takeProfitPrice?: string;\n stopLossPrice?: string;\n limitPrice?: string;\n type: OrderType;\n};\n\nexport type OrderDirection = 'long' | 'short';\n\n/**\n * Options for reconnecting the Perps connection\n */\nexport type ReconnectOptions = {\n /**\n * If true, forces immediate disconnect and cancels all pending operations.\n * Use for user-initiated retry actions.\n * If false (default), waits for pending operations to complete.\n * Use for automatic reconnections like account switches.\n */\n force?: boolean;\n};\n\n/**\n * Extended asset metadata including Growth Mode fields not in SDK types.\n * The HyperLiquid API returns these fields but the SDK doesn't type them.\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers\n */\nexport type ExtendedAssetMeta = {\n name: string;\n szDecimals: number;\n maxLeverage: number;\n /** Per-asset Growth Mode status - \"enabled\" means 90% fee reduction */\n growthMode?: 'enabled' | null;\n /** ISO timestamp of last Growth Mode change */\n lastGrowthModeChangeTime?: string;\n};\n\n/**\n * Extended perp DEX info including fee scale fields not in SDK types.\n * The HyperLiquid API returns these fields but the SDK doesn't type them.\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers\n */\nexport type ExtendedPerpDex = {\n name: string;\n fullName?: string;\n deployer?: string;\n /** DEX-level fee scale (e.g., \"1.0\" for xyz DEX) - determines HIP-3 multiplier */\n deployerFeeScale?: string;\n /** ISO timestamp of last fee scale change */\n lastDeployerFeeScaleChangeTime?: string;\n};\n"]}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Test result states for SDK validation
3
+ */
4
+ import { OrderType } from "./index.cjs";
5
+ import { CandlePeriod } from "../constants/chartConfig.cjs";
6
+ export type TestResultStatus = 'idle' | 'loading' | 'success' | 'warning' | 'error';
7
+ /**
8
+ * Test result data structure
9
+ */
10
+ export type TestResult = {
11
+ status: TestResultStatus;
12
+ message: string;
13
+ data?: Record<string, unknown>;
14
+ };
15
+ /**
16
+ * SDK test types
17
+ */
18
+ export type SDKTestType = 'connection' | 'asset-listing' | 'websocket';
19
+ /**
20
+ * Hyperliquid asset interface (basic structure)
21
+ */
22
+ export type HyperliquidAsset = {
23
+ name: string;
24
+ [key: string]: unknown;
25
+ };
26
+ /**
27
+ * Represents a single candlestick data point
28
+ */
29
+ export type CandleStick = {
30
+ time: number;
31
+ open: string;
32
+ high: string;
33
+ low: string;
34
+ close: string;
35
+ volume: string;
36
+ };
37
+ /**
38
+ * Represents historical candlestick data for a specific symbol and interval
39
+ */
40
+ export type CandleData = {
41
+ /** Asset identifier (e.g., 'BTC', 'ETH'). Protocol-agnostic terminology for multi-provider support. */
42
+ symbol: string;
43
+ interval: CandlePeriod;
44
+ candles: CandleStick[];
45
+ };
46
+ export type * from "./config.cjs";
47
+ export type * from "./token.cjs";
48
+ /**
49
+ * Order form state for the Perps order view
50
+ */
51
+ export type OrderFormState = {
52
+ asset: string;
53
+ direction: 'long' | 'short';
54
+ amount: string;
55
+ leverage: number;
56
+ balancePercent: number;
57
+ takeProfitPrice?: string;
58
+ stopLossPrice?: string;
59
+ limitPrice?: string;
60
+ type: OrderType;
61
+ };
62
+ export type OrderDirection = 'long' | 'short';
63
+ /**
64
+ * Options for reconnecting the Perps connection
65
+ */
66
+ export type ReconnectOptions = {
67
+ /**
68
+ * If true, forces immediate disconnect and cancels all pending operations.
69
+ * Use for user-initiated retry actions.
70
+ * If false (default), waits for pending operations to complete.
71
+ * Use for automatic reconnections like account switches.
72
+ */
73
+ force?: boolean;
74
+ };
75
+ /**
76
+ * Extended asset metadata including Growth Mode fields not in SDK types.
77
+ * The HyperLiquid API returns these fields but the SDK doesn't type them.
78
+ *
79
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
80
+ */
81
+ export type ExtendedAssetMeta = {
82
+ name: string;
83
+ szDecimals: number;
84
+ maxLeverage: number;
85
+ /** Per-asset Growth Mode status - "enabled" means 90% fee reduction */
86
+ growthMode?: 'enabled' | null;
87
+ /** ISO timestamp of last Growth Mode change */
88
+ lastGrowthModeChangeTime?: string;
89
+ };
90
+ /**
91
+ * Extended perp DEX info including fee scale fields not in SDK types.
92
+ * The HyperLiquid API returns these fields but the SDK doesn't type them.
93
+ *
94
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
95
+ */
96
+ export type ExtendedPerpDex = {
97
+ name: string;
98
+ fullName?: string;
99
+ deployer?: string;
100
+ /** DEX-level fee scale (e.g., "1.0" for xyz DEX) - determines HIP-3 multiplier */
101
+ deployerFeeScale?: string;
102
+ /** ISO timestamp of last fee scale change */
103
+ lastDeployerFeeScaleChangeTime?: string;
104
+ };
105
+ //# sourceMappingURL=perps-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perps-types.d.cts","sourceRoot":"","sources":["../../src/types/perps-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,oBAAU;AAC9B,OAAO,EAAE,YAAY,EAAE,qCAAiC;AAExD,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,WAAW,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,uGAAuG;IACvG,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAGF,kCAA8B;AAC9B,iCAA6B;AAE7B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,UAAU,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,+CAA+C;IAC/C,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Test result states for SDK validation
3
+ */
4
+ import { OrderType } from "./index.mjs";
5
+ import { CandlePeriod } from "../constants/chartConfig.mjs";
6
+ export type TestResultStatus = 'idle' | 'loading' | 'success' | 'warning' | 'error';
7
+ /**
8
+ * Test result data structure
9
+ */
10
+ export type TestResult = {
11
+ status: TestResultStatus;
12
+ message: string;
13
+ data?: Record<string, unknown>;
14
+ };
15
+ /**
16
+ * SDK test types
17
+ */
18
+ export type SDKTestType = 'connection' | 'asset-listing' | 'websocket';
19
+ /**
20
+ * Hyperliquid asset interface (basic structure)
21
+ */
22
+ export type HyperliquidAsset = {
23
+ name: string;
24
+ [key: string]: unknown;
25
+ };
26
+ /**
27
+ * Represents a single candlestick data point
28
+ */
29
+ export type CandleStick = {
30
+ time: number;
31
+ open: string;
32
+ high: string;
33
+ low: string;
34
+ close: string;
35
+ volume: string;
36
+ };
37
+ /**
38
+ * Represents historical candlestick data for a specific symbol and interval
39
+ */
40
+ export type CandleData = {
41
+ /** Asset identifier (e.g., 'BTC', 'ETH'). Protocol-agnostic terminology for multi-provider support. */
42
+ symbol: string;
43
+ interval: CandlePeriod;
44
+ candles: CandleStick[];
45
+ };
46
+ export type * from "./config.mjs";
47
+ export type * from "./token.mjs";
48
+ /**
49
+ * Order form state for the Perps order view
50
+ */
51
+ export type OrderFormState = {
52
+ asset: string;
53
+ direction: 'long' | 'short';
54
+ amount: string;
55
+ leverage: number;
56
+ balancePercent: number;
57
+ takeProfitPrice?: string;
58
+ stopLossPrice?: string;
59
+ limitPrice?: string;
60
+ type: OrderType;
61
+ };
62
+ export type OrderDirection = 'long' | 'short';
63
+ /**
64
+ * Options for reconnecting the Perps connection
65
+ */
66
+ export type ReconnectOptions = {
67
+ /**
68
+ * If true, forces immediate disconnect and cancels all pending operations.
69
+ * Use for user-initiated retry actions.
70
+ * If false (default), waits for pending operations to complete.
71
+ * Use for automatic reconnections like account switches.
72
+ */
73
+ force?: boolean;
74
+ };
75
+ /**
76
+ * Extended asset metadata including Growth Mode fields not in SDK types.
77
+ * The HyperLiquid API returns these fields but the SDK doesn't type them.
78
+ *
79
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
80
+ */
81
+ export type ExtendedAssetMeta = {
82
+ name: string;
83
+ szDecimals: number;
84
+ maxLeverage: number;
85
+ /** Per-asset Growth Mode status - "enabled" means 90% fee reduction */
86
+ growthMode?: 'enabled' | null;
87
+ /** ISO timestamp of last Growth Mode change */
88
+ lastGrowthModeChangeTime?: string;
89
+ };
90
+ /**
91
+ * Extended perp DEX info including fee scale fields not in SDK types.
92
+ * The HyperLiquid API returns these fields but the SDK doesn't type them.
93
+ *
94
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers
95
+ */
96
+ export type ExtendedPerpDex = {
97
+ name: string;
98
+ fullName?: string;
99
+ deployer?: string;
100
+ /** DEX-level fee scale (e.g., "1.0" for xyz DEX) - determines HIP-3 multiplier */
101
+ deployerFeeScale?: string;
102
+ /** ISO timestamp of last fee scale change */
103
+ lastDeployerFeeScaleChangeTime?: string;
104
+ };
105
+ //# sourceMappingURL=perps-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perps-types.d.mts","sourceRoot":"","sources":["../../src/types/perps-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,oBAAU;AAC9B,OAAO,EAAE,YAAY,EAAE,qCAAiC;AAExD,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,WAAW,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,uGAAuG;IACvG,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAGF,kCAA8B;AAC9B,iCAA6B;AAE7B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,UAAU,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,+CAA+C;IAC/C,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CandlePeriod } from "../constants/chartConfig.mjs";
2
+ //# sourceMappingURL=perps-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perps-types.mjs","sourceRoot":"","sources":["../../src/types/perps-types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,qCAAiC","sourcesContent":["/**\n * Test result states for SDK validation\n */\nimport { OrderType } from '.';\nimport { CandlePeriod } from '../constants/chartConfig';\n\nexport type TestResultStatus =\n | 'idle'\n | 'loading'\n | 'success'\n | 'warning'\n | 'error';\n\n/**\n * Test result data structure\n */\nexport type TestResult = {\n status: TestResultStatus;\n message: string;\n data?: Record<string, unknown>;\n};\n\n/**\n * SDK test types\n */\nexport type SDKTestType = 'connection' | 'asset-listing' | 'websocket';\n\n/**\n * Hyperliquid asset interface (basic structure)\n */\nexport type HyperliquidAsset = {\n name: string;\n [key: string]: unknown;\n};\n\n/**\n * Represents a single candlestick data point\n */\nexport type CandleStick = {\n time: number;\n open: string;\n high: string;\n low: string;\n close: string;\n volume: string;\n};\n\n/**\n * Represents historical candlestick data for a specific symbol and interval\n */\nexport type CandleData = {\n /** Asset identifier (e.g., 'BTC', 'ETH'). Protocol-agnostic terminology for multi-provider support. */\n symbol: string;\n interval: CandlePeriod;\n candles: CandleStick[];\n};\n\n// Export all configuration types directly\nexport type * from './config';\nexport type * from './token';\n\n/**\n * Order form state for the Perps order view\n */\nexport type OrderFormState = {\n asset: string;\n direction: 'long' | 'short';\n amount: string;\n leverage: number;\n balancePercent: number;\n takeProfitPrice?: string;\n stopLossPrice?: string;\n limitPrice?: string;\n type: OrderType;\n};\n\nexport type OrderDirection = 'long' | 'short';\n\n/**\n * Options for reconnecting the Perps connection\n */\nexport type ReconnectOptions = {\n /**\n * If true, forces immediate disconnect and cancels all pending operations.\n * Use for user-initiated retry actions.\n * If false (default), waits for pending operations to complete.\n * Use for automatic reconnections like account switches.\n */\n force?: boolean;\n};\n\n/**\n * Extended asset metadata including Growth Mode fields not in SDK types.\n * The HyperLiquid API returns these fields but the SDK doesn't type them.\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers\n */\nexport type ExtendedAssetMeta = {\n name: string;\n szDecimals: number;\n maxLeverage: number;\n /** Per-asset Growth Mode status - \"enabled\" means 90% fee reduction */\n growthMode?: 'enabled' | null;\n /** ISO timestamp of last Growth Mode change */\n lastGrowthModeChangeTime?: string;\n};\n\n/**\n * Extended perp DEX info including fee scale fields not in SDK types.\n * The HyperLiquid API returns these fields but the SDK doesn't type them.\n *\n * @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees#fee-formula-for-developers\n */\nexport type ExtendedPerpDex = {\n name: string;\n fullName?: string;\n deployer?: string;\n /** DEX-level fee scale (e.g., \"1.0\" for xyz DEX) - determines HIP-3 multiplier */\n deployerFeeScale?: string;\n /** ISO timestamp of last fee scale change */\n lastDeployerFeeScaleChangeTime?: string;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=token.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.cjs","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex, CaipChainId } from '@metamask/utils';\n\n/**\n * Token interface for Perps trading.\n * Independent from BridgeToken to avoid Mobile-only dependencies.\n * Shape matches BridgeToken for backward compatibility.\n */\nexport type PerpsToken = {\n address: string;\n name?: string;\n symbol: string;\n image?: string;\n decimals: number;\n chainId: Hex | CaipChainId;\n balance?: string;\n balanceFiat?: string;\n tokenFiatAmount?: number;\n currencyExchangeRate?: number;\n noFee?: { isSource: boolean; isDestination: boolean };\n aggregators?: string[];\n metadata?: Record<string, unknown>;\n};\n"]}
@@ -0,0 +1,25 @@
1
+ import type { Hex, CaipChainId } from "@metamask/utils";
2
+ /**
3
+ * Token interface for Perps trading.
4
+ * Independent from BridgeToken to avoid Mobile-only dependencies.
5
+ * Shape matches BridgeToken for backward compatibility.
6
+ */
7
+ export type PerpsToken = {
8
+ address: string;
9
+ name?: string;
10
+ symbol: string;
11
+ image?: string;
12
+ decimals: number;
13
+ chainId: Hex | CaipChainId;
14
+ balance?: string;
15
+ balanceFiat?: string;
16
+ tokenFiatAmount?: number;
17
+ currencyExchangeRate?: number;
18
+ noFee?: {
19
+ isSource: boolean;
20
+ isDestination: boolean;
21
+ };
22
+ aggregators?: string[];
23
+ metadata?: Record<string, unknown>;
24
+ };
25
+ //# sourceMappingURL=token.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.cts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,wBAAwB;AAExD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,GAAG,GAAG,WAAW,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { Hex, CaipChainId } from "@metamask/utils";
2
+ /**
3
+ * Token interface for Perps trading.
4
+ * Independent from BridgeToken to avoid Mobile-only dependencies.
5
+ * Shape matches BridgeToken for backward compatibility.
6
+ */
7
+ export type PerpsToken = {
8
+ address: string;
9
+ name?: string;
10
+ symbol: string;
11
+ image?: string;
12
+ decimals: number;
13
+ chainId: Hex | CaipChainId;
14
+ balance?: string;
15
+ balanceFiat?: string;
16
+ tokenFiatAmount?: number;
17
+ currencyExchangeRate?: number;
18
+ noFee?: {
19
+ isSource: boolean;
20
+ isDestination: boolean;
21
+ };
22
+ aggregators?: string[];
23
+ metadata?: Record<string, unknown>;
24
+ };
25
+ //# sourceMappingURL=token.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.mts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,wBAAwB;AAExD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,GAAG,GAAG,WAAW,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=token.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.mjs","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex, CaipChainId } from '@metamask/utils';\n\n/**\n * Token interface for Perps trading.\n * Independent from BridgeToken to avoid Mobile-only dependencies.\n * Shape matches BridgeToken for backward compatibility.\n */\nexport type PerpsToken = {\n address: string;\n name?: string;\n symbol: string;\n image?: string;\n decimals: number;\n chainId: Hex | CaipChainId;\n balance?: string;\n balanceFiat?: string;\n tokenFiatAmount?: number;\n currencyExchangeRate?: number;\n noFee?: { isSource: boolean; isDestination: boolean };\n aggregators?: string[];\n metadata?: Record<string, unknown>;\n};\n"]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Shared transaction types for Perps deposits and withdrawals
4
+ * Provides a unified structure while maintaining separate use cases
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isLastTransactionResult = exports.isTransactionRecord = void 0;
8
+ /**
9
+ * Type guard to check if a transaction result is a TransactionRecord
10
+ *
11
+ * @param result - The transaction result to check.
12
+ * @returns True if the result is a TransactionRecord with id and status fields.
13
+ */
14
+ function isTransactionRecord(result) {
15
+ return 'id' in result && 'status' in result;
16
+ }
17
+ exports.isTransactionRecord = isTransactionRecord;
18
+ /**
19
+ * Type guard to check if a transaction result is a LastTransactionResult
20
+ *
21
+ * @param result - The transaction result to check.
22
+ * @returns True if the result is a LastTransactionResult without id or status fields.
23
+ */
24
+ function isLastTransactionResult(result) {
25
+ return !('id' in result) || !('status' in result);
26
+ }
27
+ exports.isLastTransactionResult = isLastTransactionResult;
28
+ //# sourceMappingURL=transactionTypes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionTypes.cjs","sourceRoot":"","sources":["../../src/types/transactionTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoDH;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,MAAiD;IAEjD,OAAO,IAAI,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;AAC9C,CAAC;AAJD,kDAIC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,MAAiD;IAEjD,OAAO,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC;AACpD,CAAC;AAJD,0DAIC","sourcesContent":["/**\n * Shared transaction types for Perps deposits and withdrawals\n * Provides a unified structure while maintaining separate use cases\n */\n\n/**\n * Base type with core properties shared between all transaction results\n * All properties are JSON serializable for controller state compatibility\n */\nexport type BaseTransactionResult = {\n amount: string;\n asset: string;\n txHash?: string;\n timestamp: number;\n success: boolean; // explicit to avoid regressions\n};\n\n/**\n * For transient UI feedback (toasts, progress indicators)\n * Used for immediate success/failure notifications\n * JSON serializable for controller state\n */\nexport type LastTransactionResult = {\n amount: string;\n asset: string;\n txHash: string;\n timestamp: number;\n success: boolean;\n error: string;\n [key: string]: string | number | boolean;\n};\n\n/**\n * For persistent transaction history tracking\n * Used for transaction history display and detailed status tracking\n * JSON serializable for controller state\n */\nexport type TransactionStatus = 'pending' | 'bridging' | 'completed' | 'failed';\n\nexport type TransactionRecord = {\n id: string;\n amount: string;\n asset: string;\n txHash?: string;\n timestamp: number;\n success: boolean;\n status: TransactionStatus;\n destination?: string; // mainly for withdrawals\n source?: string; // mainly for deposits\n transactionId?: string; // generic - could be withdrawalId or depositId\n // Legacy fields for backward compatibility\n withdrawalId?: string; // for withdrawals\n depositId?: string; // for deposits\n};\n\n/**\n * Type guard to check if a transaction result is a TransactionRecord\n *\n * @param result - The transaction result to check.\n * @returns True if the result is a TransactionRecord with id and status fields.\n */\nexport function isTransactionRecord(\n result: LastTransactionResult | TransactionRecord,\n): result is TransactionRecord {\n return 'id' in result && 'status' in result;\n}\n\n/**\n * Type guard to check if a transaction result is a LastTransactionResult\n *\n * @param result - The transaction result to check.\n * @returns True if the result is a LastTransactionResult without id or status fields.\n */\nexport function isLastTransactionResult(\n result: LastTransactionResult | TransactionRecord,\n): result is LastTransactionResult {\n return !('id' in result) || !('status' in result);\n}\n"]}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Shared transaction types for Perps deposits and withdrawals
3
+ * Provides a unified structure while maintaining separate use cases
4
+ */
5
+ /**
6
+ * Base type with core properties shared between all transaction results
7
+ * All properties are JSON serializable for controller state compatibility
8
+ */
9
+ export type BaseTransactionResult = {
10
+ amount: string;
11
+ asset: string;
12
+ txHash?: string;
13
+ timestamp: number;
14
+ success: boolean;
15
+ };
16
+ /**
17
+ * For transient UI feedback (toasts, progress indicators)
18
+ * Used for immediate success/failure notifications
19
+ * JSON serializable for controller state
20
+ */
21
+ export type LastTransactionResult = {
22
+ amount: string;
23
+ asset: string;
24
+ txHash: string;
25
+ timestamp: number;
26
+ success: boolean;
27
+ error: string;
28
+ [key: string]: string | number | boolean;
29
+ };
30
+ /**
31
+ * For persistent transaction history tracking
32
+ * Used for transaction history display and detailed status tracking
33
+ * JSON serializable for controller state
34
+ */
35
+ export type TransactionStatus = 'pending' | 'bridging' | 'completed' | 'failed';
36
+ export type TransactionRecord = {
37
+ id: string;
38
+ amount: string;
39
+ asset: string;
40
+ txHash?: string;
41
+ timestamp: number;
42
+ success: boolean;
43
+ status: TransactionStatus;
44
+ destination?: string;
45
+ source?: string;
46
+ transactionId?: string;
47
+ withdrawalId?: string;
48
+ depositId?: string;
49
+ };
50
+ /**
51
+ * Type guard to check if a transaction result is a TransactionRecord
52
+ *
53
+ * @param result - The transaction result to check.
54
+ * @returns True if the result is a TransactionRecord with id and status fields.
55
+ */
56
+ export declare function isTransactionRecord(result: LastTransactionResult | TransactionRecord): result is TransactionRecord;
57
+ /**
58
+ * Type guard to check if a transaction result is a LastTransactionResult
59
+ *
60
+ * @param result - The transaction result to check.
61
+ * @returns True if the result is a LastTransactionResult without id or status fields.
62
+ */
63
+ export declare function isLastTransactionResult(result: LastTransactionResult | TransactionRecord): result is LastTransactionResult;
64
+ //# sourceMappingURL=transactionTypes.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionTypes.d.cts","sourceRoot":"","sources":["../../src/types/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEhF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,GAChD,MAAM,IAAI,iBAAiB,CAE7B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,GAChD,MAAM,IAAI,qBAAqB,CAEjC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Shared transaction types for Perps deposits and withdrawals
3
+ * Provides a unified structure while maintaining separate use cases
4
+ */
5
+ /**
6
+ * Base type with core properties shared between all transaction results
7
+ * All properties are JSON serializable for controller state compatibility
8
+ */
9
+ export type BaseTransactionResult = {
10
+ amount: string;
11
+ asset: string;
12
+ txHash?: string;
13
+ timestamp: number;
14
+ success: boolean;
15
+ };
16
+ /**
17
+ * For transient UI feedback (toasts, progress indicators)
18
+ * Used for immediate success/failure notifications
19
+ * JSON serializable for controller state
20
+ */
21
+ export type LastTransactionResult = {
22
+ amount: string;
23
+ asset: string;
24
+ txHash: string;
25
+ timestamp: number;
26
+ success: boolean;
27
+ error: string;
28
+ [key: string]: string | number | boolean;
29
+ };
30
+ /**
31
+ * For persistent transaction history tracking
32
+ * Used for transaction history display and detailed status tracking
33
+ * JSON serializable for controller state
34
+ */
35
+ export type TransactionStatus = 'pending' | 'bridging' | 'completed' | 'failed';
36
+ export type TransactionRecord = {
37
+ id: string;
38
+ amount: string;
39
+ asset: string;
40
+ txHash?: string;
41
+ timestamp: number;
42
+ success: boolean;
43
+ status: TransactionStatus;
44
+ destination?: string;
45
+ source?: string;
46
+ transactionId?: string;
47
+ withdrawalId?: string;
48
+ depositId?: string;
49
+ };
50
+ /**
51
+ * Type guard to check if a transaction result is a TransactionRecord
52
+ *
53
+ * @param result - The transaction result to check.
54
+ * @returns True if the result is a TransactionRecord with id and status fields.
55
+ */
56
+ export declare function isTransactionRecord(result: LastTransactionResult | TransactionRecord): result is TransactionRecord;
57
+ /**
58
+ * Type guard to check if a transaction result is a LastTransactionResult
59
+ *
60
+ * @param result - The transaction result to check.
61
+ * @returns True if the result is a LastTransactionResult without id or status fields.
62
+ */
63
+ export declare function isLastTransactionResult(result: LastTransactionResult | TransactionRecord): result is LastTransactionResult;
64
+ //# sourceMappingURL=transactionTypes.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionTypes.d.mts","sourceRoot":"","sources":["../../src/types/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEhF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,GAChD,MAAM,IAAI,iBAAiB,CAE7B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,qBAAqB,GAAG,iBAAiB,GAChD,MAAM,IAAI,qBAAqB,CAEjC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Shared transaction types for Perps deposits and withdrawals
3
+ * Provides a unified structure while maintaining separate use cases
4
+ */
5
+ /**
6
+ * Type guard to check if a transaction result is a TransactionRecord
7
+ *
8
+ * @param result - The transaction result to check.
9
+ * @returns True if the result is a TransactionRecord with id and status fields.
10
+ */
11
+ export function isTransactionRecord(result) {
12
+ return 'id' in result && 'status' in result;
13
+ }
14
+ /**
15
+ * Type guard to check if a transaction result is a LastTransactionResult
16
+ *
17
+ * @param result - The transaction result to check.
18
+ * @returns True if the result is a LastTransactionResult without id or status fields.
19
+ */
20
+ export function isLastTransactionResult(result) {
21
+ return !('id' in result) || !('status' in result);
22
+ }
23
+ //# sourceMappingURL=transactionTypes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactionTypes.mjs","sourceRoot":"","sources":["../../src/types/transactionTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoDH;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAiD;IAEjD,OAAO,IAAI,IAAI,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAiD;IAEjD,OAAO,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Shared transaction types for Perps deposits and withdrawals\n * Provides a unified structure while maintaining separate use cases\n */\n\n/**\n * Base type with core properties shared between all transaction results\n * All properties are JSON serializable for controller state compatibility\n */\nexport type BaseTransactionResult = {\n amount: string;\n asset: string;\n txHash?: string;\n timestamp: number;\n success: boolean; // explicit to avoid regressions\n};\n\n/**\n * For transient UI feedback (toasts, progress indicators)\n * Used for immediate success/failure notifications\n * JSON serializable for controller state\n */\nexport type LastTransactionResult = {\n amount: string;\n asset: string;\n txHash: string;\n timestamp: number;\n success: boolean;\n error: string;\n [key: string]: string | number | boolean;\n};\n\n/**\n * For persistent transaction history tracking\n * Used for transaction history display and detailed status tracking\n * JSON serializable for controller state\n */\nexport type TransactionStatus = 'pending' | 'bridging' | 'completed' | 'failed';\n\nexport type TransactionRecord = {\n id: string;\n amount: string;\n asset: string;\n txHash?: string;\n timestamp: number;\n success: boolean;\n status: TransactionStatus;\n destination?: string; // mainly for withdrawals\n source?: string; // mainly for deposits\n transactionId?: string; // generic - could be withdrawalId or depositId\n // Legacy fields for backward compatibility\n withdrawalId?: string; // for withdrawals\n depositId?: string; // for deposits\n};\n\n/**\n * Type guard to check if a transaction result is a TransactionRecord\n *\n * @param result - The transaction result to check.\n * @returns True if the result is a TransactionRecord with id and status fields.\n */\nexport function isTransactionRecord(\n result: LastTransactionResult | TransactionRecord,\n): result is TransactionRecord {\n return 'id' in result && 'status' in result;\n}\n\n/**\n * Type guard to check if a transaction result is a LastTransactionResult\n *\n * @param result - The transaction result to check.\n * @returns True if the result is a LastTransactionResult without id or status fields.\n */\nexport function isLastTransactionResult(\n result: LastTransactionResult | TransactionRecord,\n): result is LastTransactionResult {\n return !('id' in result) || !('status' in result);\n}\n"]}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aggregateAccountStates = exports.calculateWeightedReturnOnEquity = exports.getSelectedEvmAccount = exports.getEvmAccountFromAccountGroup = exports.findEvmAccount = void 0;
4
+ const perpsConfig_1 = require("../constants/perpsConfig.cjs");
5
+ const EVM_ACCOUNT_TYPES = new Set(['eip155:eoa', 'eip155:erc4337']);
6
+ function isEvmAccountType(type) {
7
+ return EVM_ACCOUNT_TYPES.has(type);
8
+ }
9
+ function findEvmAccount(accounts) {
10
+ const evmAccount = accounts.find((account) => account && isEvmAccountType(account.type));
11
+ return evmAccount ?? null;
12
+ }
13
+ exports.findEvmAccount = findEvmAccount;
14
+ function getEvmAccountFromAccountGroup(accounts) {
15
+ const evmAccount = findEvmAccount(accounts);
16
+ return evmAccount ? { address: evmAccount.address } : undefined;
17
+ }
18
+ exports.getEvmAccountFromAccountGroup = getEvmAccountFromAccountGroup;
19
+ function getSelectedEvmAccount(accounts) {
20
+ return getEvmAccountFromAccountGroup(accounts);
21
+ }
22
+ exports.getSelectedEvmAccount = getSelectedEvmAccount;
23
+ function calculateWeightedReturnOnEquity(accounts) {
24
+ if (accounts.length === 0) {
25
+ return '0';
26
+ }
27
+ let totalWeightedROE = 0;
28
+ let totalMarginUsed = 0;
29
+ for (const account of accounts) {
30
+ const unrealizedPnl = typeof account.unrealizedPnl === 'string'
31
+ ? Number.parseFloat(account.unrealizedPnl)
32
+ : account.unrealizedPnl;
33
+ const returnOnEquity = typeof account.returnOnEquity === 'string'
34
+ ? Number.parseFloat(account.returnOnEquity)
35
+ : account.returnOnEquity;
36
+ if (Number.isNaN(unrealizedPnl) || Number.isNaN(returnOnEquity)) {
37
+ continue;
38
+ }
39
+ if (returnOnEquity === 0) {
40
+ continue;
41
+ }
42
+ const marginUsed = (unrealizedPnl / returnOnEquity) * 100;
43
+ if (Number.isNaN(marginUsed) || marginUsed <= 0) {
44
+ continue;
45
+ }
46
+ const roeDecimal = returnOnEquity / 100;
47
+ totalWeightedROE += roeDecimal * marginUsed;
48
+ totalMarginUsed += marginUsed;
49
+ }
50
+ if (totalMarginUsed <= 0) {
51
+ return '0';
52
+ }
53
+ const weightedROE = (totalWeightedROE / totalMarginUsed) * 100;
54
+ return weightedROE.toString();
55
+ }
56
+ exports.calculateWeightedReturnOnEquity = calculateWeightedReturnOnEquity;
57
+ /**
58
+ * Aggregate multiple per-DEX AccountState objects into one by summing numeric fields.
59
+ * ROE is recalculated as (totalUnrealizedPnl / totalMarginUsed) * 100.
60
+ *
61
+ * @param states - The array of per-DEX account states to aggregate.
62
+ * @returns The combined account state with summed balances and recalculated ROE.
63
+ */
64
+ function aggregateAccountStates(states) {
65
+ const fallback = {
66
+ availableBalance: perpsConfig_1.PERPS_CONSTANTS.FallbackDataDisplay,
67
+ totalBalance: perpsConfig_1.PERPS_CONSTANTS.FallbackDataDisplay,
68
+ marginUsed: perpsConfig_1.PERPS_CONSTANTS.FallbackDataDisplay,
69
+ unrealizedPnl: perpsConfig_1.PERPS_CONSTANTS.FallbackDataDisplay,
70
+ returnOnEquity: perpsConfig_1.PERPS_CONSTANTS.FallbackDataDisplay,
71
+ };
72
+ if (states.length === 0) {
73
+ return fallback;
74
+ }
75
+ const aggregated = states.reduce((acc, state, index) => {
76
+ if (index === 0) {
77
+ return { ...state };
78
+ }
79
+ return {
80
+ availableBalance: (parseFloat(acc.availableBalance) + parseFloat(state.availableBalance)).toString(),
81
+ totalBalance: (parseFloat(acc.totalBalance) + parseFloat(state.totalBalance)).toString(),
82
+ marginUsed: (parseFloat(acc.marginUsed) + parseFloat(state.marginUsed)).toString(),
83
+ unrealizedPnl: (parseFloat(acc.unrealizedPnl) + parseFloat(state.unrealizedPnl)).toString(),
84
+ returnOnEquity: '0',
85
+ };
86
+ }, fallback);
87
+ // Recalculate ROE across all DEXs
88
+ const totalMarginUsed = parseFloat(aggregated.marginUsed);
89
+ const totalUnrealizedPnl = parseFloat(aggregated.unrealizedPnl);
90
+ if (totalMarginUsed > 0) {
91
+ aggregated.returnOnEquity = ((totalUnrealizedPnl / totalMarginUsed) *
92
+ 100).toString();
93
+ }
94
+ else {
95
+ aggregated.returnOnEquity = '0';
96
+ }
97
+ return aggregated;
98
+ }
99
+ exports.aggregateAccountStates = aggregateAccountStates;
100
+ //# sourceMappingURL=accountUtils.cjs.map