@metamask-previews/perps-controller 13.1.0-preview-8c2a2eeb2 → 13.1.0-preview-4f4c98e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (716) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/{PerpsController-method-action-types.d.mts → PerpsController-method-action-types.d.ts} +2 -2
  3. package/dist/PerpsController-method-action-types.d.ts.map +1 -0
  4. package/dist/{PerpsController-method-action-types.mjs → PerpsController-method-action-types.js} +1 -1
  5. package/dist/PerpsController-method-action-types.js.map +1 -0
  6. package/dist/{PerpsController.d.mts → PerpsController.d.ts} +17 -17
  7. package/dist/PerpsController.d.ts.map +1 -0
  8. package/dist/{PerpsController.mjs → PerpsController.js} +33 -31
  9. package/dist/PerpsController.js.map +1 -0
  10. package/dist/aggregation/{SubscriptionMultiplexer.d.cts → SubscriptionMultiplexer.d.ts} +2 -2
  11. package/dist/aggregation/SubscriptionMultiplexer.d.ts.map +1 -0
  12. package/dist/aggregation/{SubscriptionMultiplexer.mjs → SubscriptionMultiplexer.js} +3 -3
  13. package/dist/aggregation/SubscriptionMultiplexer.js.map +1 -0
  14. package/dist/aggregation/index.d.ts +6 -0
  15. package/dist/aggregation/index.d.ts.map +1 -0
  16. package/dist/aggregation/index.js +5 -0
  17. package/dist/aggregation/index.js.map +1 -0
  18. package/dist/constants/{chartConfig.d.mts → chartConfig.d.ts} +34 -34
  19. package/dist/constants/chartConfig.d.ts.map +1 -0
  20. package/dist/constants/{chartConfig.mjs → chartConfig.js} +1 -1
  21. package/dist/constants/chartConfig.js.map +1 -0
  22. package/dist/constants/eventNames.d.ts +555 -0
  23. package/dist/constants/eventNames.d.ts.map +1 -0
  24. package/dist/constants/{eventNames.mjs → eventNames.js} +1 -1
  25. package/dist/constants/eventNames.js.map +1 -0
  26. package/dist/constants/{hyperLiquidConfig.d.cts → hyperLiquidConfig.d.ts} +12 -12
  27. package/dist/constants/hyperLiquidConfig.d.ts.map +1 -0
  28. package/dist/constants/{hyperLiquidConfig.mjs → hyperLiquidConfig.js} +4 -4
  29. package/dist/constants/hyperLiquidConfig.js.map +1 -0
  30. package/dist/constants/index.d.ts +12 -0
  31. package/dist/constants/index.d.ts.map +1 -0
  32. package/dist/constants/index.js +12 -0
  33. package/dist/constants/index.js.map +1 -0
  34. package/dist/constants/{myxConfig.d.mts → myxConfig.d.ts} +9 -8
  35. package/dist/constants/myxConfig.d.ts.map +1 -0
  36. package/dist/constants/{myxConfig.mjs → myxConfig.js} +2 -2
  37. package/dist/constants/myxConfig.js.map +1 -0
  38. package/dist/constants/{orderTypes.d.cts → orderTypes.d.ts} +7 -7
  39. package/dist/constants/orderTypes.d.ts.map +1 -0
  40. package/dist/constants/{orderTypes.mjs → orderTypes.js} +1 -1
  41. package/dist/constants/orderTypes.js.map +1 -0
  42. package/dist/constants/{performanceMetrics.d.cts → performanceMetrics.d.ts} +1 -1
  43. package/dist/constants/performanceMetrics.d.ts.map +1 -0
  44. package/dist/constants/{performanceMetrics.mjs → performanceMetrics.js} +1 -1
  45. package/dist/constants/performanceMetrics.js.map +1 -0
  46. package/dist/constants/{perpsConfig.d.mts → perpsConfig.d.ts} +56 -56
  47. package/dist/constants/perpsConfig.d.ts.map +1 -0
  48. package/dist/constants/{perpsConfig.mjs → perpsConfig.js} +1 -1
  49. package/dist/constants/perpsConfig.js.map +1 -0
  50. package/dist/constants/{transactionsHistoryConfig.d.cts → transactionsHistoryConfig.d.ts} +1 -1
  51. package/dist/constants/transactionsHistoryConfig.d.ts.map +1 -0
  52. package/dist/constants/{transactionsHistoryConfig.mjs → transactionsHistoryConfig.js} +1 -1
  53. package/dist/constants/transactionsHistoryConfig.js.map +1 -0
  54. package/dist/{index.d.mts → index.d.ts} +64 -64
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/{index.mjs → index.js} +41 -41
  57. package/dist/index.js.map +1 -0
  58. package/dist/perpsErrorCodes.d.ts +104 -0
  59. package/dist/perpsErrorCodes.d.ts.map +1 -0
  60. package/dist/{perpsErrorCodes.mjs → perpsErrorCodes.js} +1 -1
  61. package/dist/perpsErrorCodes.js.map +1 -0
  62. package/dist/providers/{AggregatedPerpsProvider.d.cts → AggregatedPerpsProvider.d.ts} +5 -5
  63. package/dist/providers/AggregatedPerpsProvider.d.ts.map +1 -0
  64. package/dist/providers/{AggregatedPerpsProvider.mjs → AggregatedPerpsProvider.js} +5 -5
  65. package/dist/providers/AggregatedPerpsProvider.js.map +1 -0
  66. package/dist/providers/{HyperLiquidProvider.d.mts → HyperLiquidProvider.d.ts} +7 -7
  67. package/dist/providers/HyperLiquidProvider.d.ts.map +1 -0
  68. package/dist/providers/{HyperLiquidProvider.mjs → HyperLiquidProvider.js} +48 -50
  69. package/dist/providers/HyperLiquidProvider.js.map +1 -0
  70. package/dist/routing/{ProviderRouter.d.mts → ProviderRouter.d.ts} +2 -2
  71. package/dist/routing/ProviderRouter.d.ts.map +1 -0
  72. package/dist/routing/{ProviderRouter.mjs → ProviderRouter.js} +1 -1
  73. package/dist/routing/ProviderRouter.js.map +1 -0
  74. package/dist/routing/index.d.ts +6 -0
  75. package/dist/routing/index.d.ts.map +1 -0
  76. package/dist/routing/index.js +5 -0
  77. package/dist/routing/index.js.map +1 -0
  78. package/dist/{selectors.d.mts → selectors.d.ts} +97 -97
  79. package/dist/selectors.d.ts.map +1 -0
  80. package/dist/{selectors.mjs → selectors.js} +4 -4
  81. package/dist/selectors.js.map +1 -0
  82. package/dist/services/{AccountService.d.cts → AccountService.d.ts} +4 -4
  83. package/dist/services/AccountService.d.ts.map +1 -0
  84. package/dist/services/{AccountService.mjs → AccountService.js} +9 -9
  85. package/dist/services/AccountService.js.map +1 -0
  86. package/dist/services/{AggregatedOrderBookConnection.d.cts → AggregatedOrderBookConnection.d.ts} +2 -2
  87. package/dist/services/AggregatedOrderBookConnection.d.ts.map +1 -0
  88. package/dist/services/{AggregatedOrderBookConnection.mjs → AggregatedOrderBookConnection.js} +3 -3
  89. package/dist/services/AggregatedOrderBookConnection.js.map +1 -0
  90. package/dist/services/{DataLakeService.d.cts → DataLakeService.d.ts} +4 -4
  91. package/dist/services/DataLakeService.d.ts.map +1 -0
  92. package/dist/services/{DataLakeService.mjs → DataLakeService.js} +7 -7
  93. package/dist/services/DataLakeService.js.map +1 -0
  94. package/dist/services/{DepositService.d.cts → DepositService.d.ts} +4 -4
  95. package/dist/services/DepositService.d.ts.map +1 -0
  96. package/dist/services/{DepositService.mjs → DepositService.js} +7 -7
  97. package/dist/services/DepositService.js.map +1 -0
  98. package/dist/services/{DexDiscoveryCacheManager.d.cts → DexDiscoveryCacheManager.d.ts} +2 -2
  99. package/dist/services/DexDiscoveryCacheManager.d.ts.map +1 -0
  100. package/dist/services/{DexDiscoveryCacheManager.mjs → DexDiscoveryCacheManager.js} +2 -2
  101. package/dist/services/DexDiscoveryCacheManager.js.map +1 -0
  102. package/dist/services/{EligibilityService.d.cts → EligibilityService.d.ts} +2 -2
  103. package/dist/services/EligibilityService.d.ts.map +1 -0
  104. package/dist/services/{EligibilityService.mjs → EligibilityService.js} +3 -3
  105. package/dist/services/EligibilityService.js.map +1 -0
  106. package/dist/services/{FeatureFlagConfigurationService.d.cts → FeatureFlagConfigurationService.d.ts} +3 -3
  107. package/dist/services/FeatureFlagConfigurationService.d.ts.map +1 -0
  108. package/dist/services/{FeatureFlagConfigurationService.mjs → FeatureFlagConfigurationService.js} +7 -7
  109. package/dist/services/FeatureFlagConfigurationService.js.map +1 -0
  110. package/dist/services/{HyperLiquidClientService.d.cts → HyperLiquidClientService.d.ts} +10 -10
  111. package/dist/services/HyperLiquidClientService.d.ts.map +1 -0
  112. package/dist/services/{HyperLiquidClientService.mjs → HyperLiquidClientService.js} +11 -11
  113. package/dist/services/HyperLiquidClientService.js.map +1 -0
  114. package/dist/services/{HyperLiquidSubscriptionService.d.cts → HyperLiquidSubscriptionService.d.ts} +6 -6
  115. package/dist/services/HyperLiquidSubscriptionService.d.ts.map +1 -0
  116. package/dist/services/{HyperLiquidSubscriptionService.mjs → HyperLiquidSubscriptionService.js} +12 -12
  117. package/dist/services/HyperLiquidSubscriptionService.js.map +1 -0
  118. package/dist/services/{HyperLiquidWalletService.d.cts → HyperLiquidWalletService.d.ts} +4 -4
  119. package/dist/services/HyperLiquidWalletService.d.ts.map +1 -0
  120. package/dist/services/{HyperLiquidWalletService.mjs → HyperLiquidWalletService.js} +5 -5
  121. package/dist/services/HyperLiquidWalletService.js.map +1 -0
  122. package/dist/services/{MarketDataService.d.cts → MarketDataService.d.ts} +5 -5
  123. package/dist/services/MarketDataService.d.ts.map +1 -0
  124. package/dist/services/{MarketDataService.mjs → MarketDataService.js} +9 -9
  125. package/dist/services/MarketDataService.js.map +1 -0
  126. package/dist/services/{RewardsIntegrationService.d.cts → RewardsIntegrationService.d.ts} +3 -3
  127. package/dist/services/RewardsIntegrationService.d.ts.map +1 -0
  128. package/dist/services/{RewardsIntegrationService.mjs → RewardsIntegrationService.js} +6 -6
  129. package/dist/services/RewardsIntegrationService.js.map +1 -0
  130. package/dist/services/{ServiceContext.d.cts → ServiceContext.d.ts} +3 -3
  131. package/dist/services/ServiceContext.d.ts.map +1 -0
  132. package/dist/services/ServiceContext.js +2 -0
  133. package/dist/services/ServiceContext.js.map +1 -0
  134. package/dist/services/{TerminalMarketService.d.cts → TerminalMarketService.d.ts} +2 -2
  135. package/dist/services/TerminalMarketService.d.ts.map +1 -0
  136. package/dist/services/{TerminalMarketService.mjs → TerminalMarketService.js} +9 -9
  137. package/dist/services/TerminalMarketService.js.map +1 -0
  138. package/dist/services/{TradingReadinessCache.d.mts → TradingReadinessCache.d.ts} +1 -1
  139. package/dist/services/TradingReadinessCache.d.ts.map +1 -0
  140. package/dist/services/{TradingReadinessCache.mjs → TradingReadinessCache.js} +1 -1
  141. package/dist/services/TradingReadinessCache.js.map +1 -0
  142. package/dist/services/{TradingService.d.cts → TradingService.d.ts} +4 -4
  143. package/dist/services/TradingService.d.ts.map +1 -0
  144. package/dist/services/{TradingService.mjs → TradingService.js} +10 -10
  145. package/dist/services/TradingService.js.map +1 -0
  146. package/dist/types/{config.d.cts → config.d.ts} +2 -2
  147. package/dist/types/config.d.ts.map +1 -0
  148. package/dist/types/config.js +2 -0
  149. package/dist/types/config.js.map +1 -0
  150. package/dist/types/{hyperliquid-types.d.cts → hyperliquid-types.d.ts} +6 -6
  151. package/dist/types/hyperliquid-types.d.ts.map +1 -0
  152. package/dist/types/{hyperliquid-types.mjs → hyperliquid-types.js} +1 -1
  153. package/dist/types/hyperliquid-types.js.map +1 -0
  154. package/dist/types/{index.d.cts → index.d.ts} +41 -41
  155. package/dist/types/index.d.ts.map +1 -0
  156. package/dist/types/{index.mjs → index.js} +3 -3
  157. package/dist/types/index.js.map +1 -0
  158. package/dist/types/{messenger.d.mts → messenger.d.ts} +11 -11
  159. package/dist/types/messenger.d.ts.map +1 -0
  160. package/dist/types/messenger.js +2 -0
  161. package/dist/types/messenger.js.map +1 -0
  162. package/dist/types/{myx-types.d.mts → myx-types.d.ts} +16 -16
  163. package/dist/types/myx-types.d.ts.map +1 -0
  164. package/dist/types/{myx-types.mjs → myx-types.js} +3 -3
  165. package/dist/types/myx-types.js.map +1 -0
  166. package/dist/types/{perps-types.d.cts → perps-types.d.ts} +4 -4
  167. package/dist/types/perps-types.d.ts.map +1 -0
  168. package/dist/types/perps-types.js +2 -0
  169. package/dist/types/perps-types.js.map +1 -0
  170. package/dist/types/{token.d.cts → token.d.ts} +2 -2
  171. package/dist/types/token.d.ts.map +1 -0
  172. package/dist/types/token.js +2 -0
  173. package/dist/types/token.js.map +1 -0
  174. package/dist/types/{transactionTypes.d.cts → transactionTypes.d.ts} +1 -1
  175. package/dist/types/transactionTypes.d.ts.map +1 -0
  176. package/dist/types/{transactionTypes.mjs → transactionTypes.js} +2 -2
  177. package/dist/types/transactionTypes.js.map +1 -0
  178. package/dist/utils/{accountUtils.d.cts → accountUtils.d.ts} +4 -4
  179. package/dist/utils/accountUtils.d.ts.map +1 -0
  180. package/dist/utils/{accountUtils.mjs → accountUtils.js} +2 -2
  181. package/dist/utils/accountUtils.js.map +1 -0
  182. package/dist/utils/{capabilitySymbols.d.mts → capabilitySymbols.d.ts} +1 -1
  183. package/dist/utils/capabilitySymbols.d.ts.map +1 -0
  184. package/dist/utils/{capabilitySymbols.mjs → capabilitySymbols.js} +1 -1
  185. package/dist/utils/capabilitySymbols.js.map +1 -0
  186. package/dist/utils/{coalescePerpsRestRequest.d.cts → coalescePerpsRestRequest.d.ts} +1 -1
  187. package/dist/utils/coalescePerpsRestRequest.d.ts.map +1 -0
  188. package/dist/utils/{coalescePerpsRestRequest.mjs → coalescePerpsRestRequest.js} +2 -2
  189. package/dist/utils/coalescePerpsRestRequest.js.map +1 -0
  190. package/dist/utils/{errorUtils.d.mts → errorUtils.d.ts} +1 -1
  191. package/dist/utils/errorUtils.d.ts.map +1 -0
  192. package/dist/utils/{errorUtils.mjs → errorUtils.js} +3 -3
  193. package/dist/utils/errorUtils.js.map +1 -0
  194. package/dist/utils/{hyperLiquidAbstraction.d.cts → hyperLiquidAbstraction.d.ts} +2 -2
  195. package/dist/utils/hyperLiquidAbstraction.d.ts.map +1 -0
  196. package/dist/utils/{hyperLiquidAbstraction.mjs → hyperLiquidAbstraction.js} +1 -1
  197. package/dist/utils/hyperLiquidAbstraction.js.map +1 -0
  198. package/dist/utils/{hyperLiquidAdapter.d.cts → hyperLiquidAdapter.d.ts} +4 -4
  199. package/dist/utils/hyperLiquidAdapter.d.ts.map +1 -0
  200. package/dist/utils/{hyperLiquidAdapter.mjs → hyperLiquidAdapter.js} +9 -9
  201. package/dist/utils/hyperLiquidAdapter.js.map +1 -0
  202. package/dist/utils/{hyperLiquidOrderBookProcessor.d.mts → hyperLiquidOrderBookProcessor.d.ts} +3 -3
  203. package/dist/utils/hyperLiquidOrderBookProcessor.d.ts.map +1 -0
  204. package/dist/utils/{hyperLiquidOrderBookProcessor.mjs → hyperLiquidOrderBookProcessor.js} +1 -1
  205. package/dist/utils/hyperLiquidOrderBookProcessor.js.map +1 -0
  206. package/dist/utils/{hyperLiquidValidation.d.cts → hyperLiquidValidation.d.ts} +4 -4
  207. package/dist/utils/hyperLiquidValidation.d.ts.map +1 -0
  208. package/dist/utils/{hyperLiquidValidation.mjs → hyperLiquidValidation.js} +6 -6
  209. package/dist/utils/hyperLiquidValidation.js.map +1 -0
  210. package/dist/utils/{idUtils.d.cts → idUtils.d.ts} +1 -1
  211. package/dist/utils/idUtils.d.ts.map +1 -0
  212. package/dist/utils/{idUtils.mjs → idUtils.js} +2 -2
  213. package/dist/utils/idUtils.js.map +1 -0
  214. package/dist/utils/index.d.ts +28 -0
  215. package/dist/utils/index.d.ts.map +1 -0
  216. package/dist/utils/{index.mjs → index.js} +21 -21
  217. package/dist/utils/index.js.map +1 -0
  218. package/dist/utils/{marketDataTransform.d.cts → marketDataTransform.d.ts} +3 -3
  219. package/dist/utils/marketDataTransform.d.ts.map +1 -0
  220. package/dist/utils/{marketDataTransform.mjs → marketDataTransform.js} +5 -5
  221. package/dist/utils/marketDataTransform.js.map +1 -0
  222. package/dist/utils/{marketSearch.d.cts → marketSearch.d.ts} +2 -2
  223. package/dist/utils/marketSearch.d.ts.map +1 -0
  224. package/dist/utils/{marketSearch.mjs → marketSearch.js} +1 -1
  225. package/dist/utils/marketSearch.js.map +1 -0
  226. package/dist/utils/{marketUtils.d.cts → marketUtils.d.ts} +3 -3
  227. package/dist/utils/marketUtils.d.ts.map +1 -0
  228. package/dist/utils/{marketUtils.mjs → marketUtils.js} +2 -2
  229. package/dist/utils/marketUtils.js.map +1 -0
  230. package/dist/utils/{myxAdapter.d.cts → myxAdapter.d.ts} +3 -3
  231. package/dist/utils/myxAdapter.d.ts.map +1 -0
  232. package/dist/utils/{myxAdapter.mjs → myxAdapter.js} +3 -3
  233. package/dist/utils/myxAdapter.js.map +1 -0
  234. package/dist/utils/{orderCalculations.d.cts → orderCalculations.d.ts} +4 -4
  235. package/dist/utils/orderCalculations.d.ts.map +1 -0
  236. package/dist/utils/{orderCalculations.mjs → orderCalculations.js} +6 -6
  237. package/dist/utils/orderCalculations.js.map +1 -0
  238. package/dist/utils/{orderTypes.d.mts → orderTypes.d.ts} +3 -3
  239. package/dist/utils/orderTypes.d.ts.map +1 -0
  240. package/dist/utils/{orderTypes.mjs → orderTypes.js} +1 -1
  241. package/dist/utils/orderTypes.js.map +1 -0
  242. package/dist/utils/{perpsConnectionAttemptContext.d.mts → perpsConnectionAttemptContext.d.ts} +1 -1
  243. package/dist/utils/perpsConnectionAttemptContext.d.ts.map +1 -0
  244. package/dist/utils/{perpsConnectionAttemptContext.mjs → perpsConnectionAttemptContext.js} +1 -1
  245. package/dist/utils/perpsConnectionAttemptContext.js.map +1 -0
  246. package/dist/utils/{perpsDiskPersistence.d.cts → perpsDiskPersistence.d.ts} +2 -2
  247. package/dist/utils/perpsDiskPersistence.d.ts.map +1 -0
  248. package/dist/utils/{perpsDiskPersistence.mjs → perpsDiskPersistence.js} +2 -2
  249. package/dist/utils/perpsDiskPersistence.js.map +1 -0
  250. package/dist/utils/{perpsFormatters.d.cts → perpsFormatters.d.ts} +1 -1
  251. package/dist/utils/perpsFormatters.d.ts.map +1 -0
  252. package/dist/utils/{perpsFormatters.mjs → perpsFormatters.js} +2 -2
  253. package/dist/utils/perpsFormatters.js.map +1 -0
  254. package/dist/utils/{rewardsUtils.d.cts → rewardsUtils.d.ts} +4 -4
  255. package/dist/utils/rewardsUtils.d.ts.map +1 -0
  256. package/dist/utils/{rewardsUtils.mjs → rewardsUtils.js} +4 -4
  257. package/dist/utils/rewardsUtils.js.map +1 -0
  258. package/dist/utils/{significantFigures.d.cts → significantFigures.d.ts} +1 -1
  259. package/dist/utils/significantFigures.d.ts.map +1 -0
  260. package/dist/utils/{significantFigures.mjs → significantFigures.js} +2 -2
  261. package/dist/utils/significantFigures.js.map +1 -0
  262. package/dist/utils/{sortMarkets.d.cts → sortMarkets.d.ts} +2 -2
  263. package/dist/utils/sortMarkets.d.ts.map +1 -0
  264. package/dist/utils/{sortMarkets.mjs → sortMarkets.js} +2 -2
  265. package/dist/utils/sortMarkets.js.map +1 -0
  266. package/dist/utils/{standaloneInfoClient.d.cts → standaloneInfoClient.d.ts} +3 -3
  267. package/dist/utils/standaloneInfoClient.d.ts.map +1 -0
  268. package/dist/utils/{standaloneInfoClient.mjs → standaloneInfoClient.js} +3 -3
  269. package/dist/utils/standaloneInfoClient.js.map +1 -0
  270. package/dist/utils/{stringParseUtils.d.cts → stringParseUtils.d.ts} +1 -1
  271. package/dist/utils/stringParseUtils.d.ts.map +1 -0
  272. package/dist/utils/{stringParseUtils.mjs → stringParseUtils.js} +1 -1
  273. package/dist/utils/stringParseUtils.js.map +1 -0
  274. package/dist/utils/{transferData.d.cts → transferData.d.ts} +1 -1
  275. package/dist/utils/transferData.d.ts.map +1 -0
  276. package/dist/utils/{transferData.mjs → transferData.js} +3 -3
  277. package/dist/utils/transferData.js.map +1 -0
  278. package/dist/utils/{wait.d.cts → wait.d.ts} +1 -1
  279. package/dist/utils/wait.d.ts.map +1 -0
  280. package/dist/utils/{wait.mjs → wait.js} +1 -1
  281. package/dist/utils/wait.js.map +1 -0
  282. package/package.json +20 -48
  283. package/dist/PerpsController-method-action-types.cjs +0 -7
  284. package/dist/PerpsController-method-action-types.cjs.map +0 -1
  285. package/dist/PerpsController-method-action-types.d.cts +0 -1163
  286. package/dist/PerpsController-method-action-types.d.cts.map +0 -1
  287. package/dist/PerpsController-method-action-types.d.mts.map +0 -1
  288. package/dist/PerpsController-method-action-types.mjs.map +0 -1
  289. package/dist/PerpsController.cjs +0 -5063
  290. package/dist/PerpsController.cjs.map +0 -1
  291. package/dist/PerpsController.d.cts +0 -1274
  292. package/dist/PerpsController.d.cts.map +0 -1
  293. package/dist/PerpsController.d.mts.map +0 -1
  294. package/dist/PerpsController.mjs.map +0 -1
  295. package/dist/aggregation/SubscriptionMultiplexer.cjs +0 -441
  296. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +0 -1
  297. package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +0 -1
  298. package/dist/aggregation/SubscriptionMultiplexer.d.mts +0 -171
  299. package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +0 -1
  300. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +0 -1
  301. package/dist/aggregation/index.cjs +0 -9
  302. package/dist/aggregation/index.cjs.map +0 -1
  303. package/dist/aggregation/index.d.cts +0 -6
  304. package/dist/aggregation/index.d.cts.map +0 -1
  305. package/dist/aggregation/index.d.mts +0 -6
  306. package/dist/aggregation/index.d.mts.map +0 -1
  307. package/dist/aggregation/index.mjs +0 -5
  308. package/dist/aggregation/index.mjs.map +0 -1
  309. package/dist/constants/chartConfig.cjs +0 -239
  310. package/dist/constants/chartConfig.cjs.map +0 -1
  311. package/dist/constants/chartConfig.d.cts +0 -228
  312. package/dist/constants/chartConfig.d.cts.map +0 -1
  313. package/dist/constants/chartConfig.d.mts.map +0 -1
  314. package/dist/constants/chartConfig.mjs.map +0 -1
  315. package/dist/constants/eventNames.cjs +0 -650
  316. package/dist/constants/eventNames.cjs.map +0 -1
  317. package/dist/constants/eventNames.d.cts +0 -555
  318. package/dist/constants/eventNames.d.cts.map +0 -1
  319. package/dist/constants/eventNames.d.mts +0 -555
  320. package/dist/constants/eventNames.d.mts.map +0 -1
  321. package/dist/constants/eventNames.mjs.map +0 -1
  322. package/dist/constants/hyperLiquidConfig.cjs +0 -607
  323. package/dist/constants/hyperLiquidConfig.cjs.map +0 -1
  324. package/dist/constants/hyperLiquidConfig.d.cts.map +0 -1
  325. package/dist/constants/hyperLiquidConfig.d.mts +0 -280
  326. package/dist/constants/hyperLiquidConfig.d.mts.map +0 -1
  327. package/dist/constants/hyperLiquidConfig.mjs.map +0 -1
  328. package/dist/constants/index.cjs +0 -28
  329. package/dist/constants/index.cjs.map +0 -1
  330. package/dist/constants/index.d.cts +0 -12
  331. package/dist/constants/index.d.cts.map +0 -1
  332. package/dist/constants/index.d.mts +0 -12
  333. package/dist/constants/index.d.mts.map +0 -1
  334. package/dist/constants/index.mjs +0 -12
  335. package/dist/constants/index.mjs.map +0 -1
  336. package/dist/constants/myxConfig.cjs +0 -253
  337. package/dist/constants/myxConfig.cjs.map +0 -1
  338. package/dist/constants/myxConfig.d.cts +0 -145
  339. package/dist/constants/myxConfig.d.cts.map +0 -1
  340. package/dist/constants/myxConfig.d.mts.map +0 -1
  341. package/dist/constants/myxConfig.mjs.map +0 -1
  342. package/dist/constants/orderTypes.cjs +0 -31
  343. package/dist/constants/orderTypes.cjs.map +0 -1
  344. package/dist/constants/orderTypes.d.cts.map +0 -1
  345. package/dist/constants/orderTypes.d.mts +0 -19
  346. package/dist/constants/orderTypes.d.mts.map +0 -1
  347. package/dist/constants/orderTypes.mjs.map +0 -1
  348. package/dist/constants/performanceMetrics.cjs +0 -63
  349. package/dist/constants/performanceMetrics.cjs.map +0 -1
  350. package/dist/constants/performanceMetrics.d.cts.map +0 -1
  351. package/dist/constants/performanceMetrics.d.mts +0 -46
  352. package/dist/constants/performanceMetrics.d.mts.map +0 -1
  353. package/dist/constants/performanceMetrics.mjs.map +0 -1
  354. package/dist/constants/perpsConfig.cjs +0 -553
  355. package/dist/constants/perpsConfig.cjs.map +0 -1
  356. package/dist/constants/perpsConfig.d.cts +0 -474
  357. package/dist/constants/perpsConfig.d.cts.map +0 -1
  358. package/dist/constants/perpsConfig.d.mts.map +0 -1
  359. package/dist/constants/perpsConfig.mjs.map +0 -1
  360. package/dist/constants/transactionsHistoryConfig.cjs +0 -38
  361. package/dist/constants/transactionsHistoryConfig.cjs.map +0 -1
  362. package/dist/constants/transactionsHistoryConfig.d.cts.map +0 -1
  363. package/dist/constants/transactionsHistoryConfig.d.mts +0 -35
  364. package/dist/constants/transactionsHistoryConfig.d.mts.map +0 -1
  365. package/dist/constants/transactionsHistoryConfig.mjs.map +0 -1
  366. package/dist/index.cjs +0 -344
  367. package/dist/index.cjs.map +0 -1
  368. package/dist/index.d.cts +0 -92
  369. package/dist/index.d.cts.map +0 -1
  370. package/dist/index.d.mts.map +0 -1
  371. package/dist/index.mjs.map +0 -1
  372. package/dist/perpsErrorCodes.cjs +0 -127
  373. package/dist/perpsErrorCodes.cjs.map +0 -1
  374. package/dist/perpsErrorCodes.d.cts +0 -104
  375. package/dist/perpsErrorCodes.d.cts.map +0 -1
  376. package/dist/perpsErrorCodes.d.mts +0 -104
  377. package/dist/perpsErrorCodes.d.mts.map +0 -1
  378. package/dist/perpsErrorCodes.mjs.map +0 -1
  379. package/dist/providers/AggregatedPerpsProvider.cjs +0 -689
  380. package/dist/providers/AggregatedPerpsProvider.cjs.map +0 -1
  381. package/dist/providers/AggregatedPerpsProvider.d.cts.map +0 -1
  382. package/dist/providers/AggregatedPerpsProvider.d.mts +0 -232
  383. package/dist/providers/AggregatedPerpsProvider.d.mts.map +0 -1
  384. package/dist/providers/AggregatedPerpsProvider.mjs.map +0 -1
  385. package/dist/providers/HyperLiquidProvider.cjs +0 -10416
  386. package/dist/providers/HyperLiquidProvider.cjs.map +0 -1
  387. package/dist/providers/HyperLiquidProvider.d.cts +0 -625
  388. package/dist/providers/HyperLiquidProvider.d.cts.map +0 -1
  389. package/dist/providers/HyperLiquidProvider.d.mts.map +0 -1
  390. package/dist/providers/HyperLiquidProvider.mjs.map +0 -1
  391. package/dist/routing/ProviderRouter.cjs +0 -154
  392. package/dist/routing/ProviderRouter.cjs.map +0 -1
  393. package/dist/routing/ProviderRouter.d.cts +0 -112
  394. package/dist/routing/ProviderRouter.d.cts.map +0 -1
  395. package/dist/routing/ProviderRouter.d.mts.map +0 -1
  396. package/dist/routing/ProviderRouter.mjs.map +0 -1
  397. package/dist/routing/index.cjs +0 -9
  398. package/dist/routing/index.cjs.map +0 -1
  399. package/dist/routing/index.d.cts +0 -6
  400. package/dist/routing/index.d.cts.map +0 -1
  401. package/dist/routing/index.d.mts +0 -6
  402. package/dist/routing/index.d.mts.map +0 -1
  403. package/dist/routing/index.mjs +0 -5
  404. package/dist/routing/index.mjs.map +0 -1
  405. package/dist/selectors.cjs +0 -264
  406. package/dist/selectors.cjs.map +0 -1
  407. package/dist/selectors.d.cts +0 -336
  408. package/dist/selectors.d.cts.map +0 -1
  409. package/dist/selectors.d.mts.map +0 -1
  410. package/dist/selectors.mjs.map +0 -1
  411. package/dist/services/AccountService.cjs +0 -324
  412. package/dist/services/AccountService.cjs.map +0 -1
  413. package/dist/services/AccountService.d.cts.map +0 -1
  414. package/dist/services/AccountService.d.mts +0 -56
  415. package/dist/services/AccountService.d.mts.map +0 -1
  416. package/dist/services/AccountService.mjs.map +0 -1
  417. package/dist/services/AggregatedOrderBookConnection.cjs +0 -405
  418. package/dist/services/AggregatedOrderBookConnection.cjs.map +0 -1
  419. package/dist/services/AggregatedOrderBookConnection.d.cts.map +0 -1
  420. package/dist/services/AggregatedOrderBookConnection.d.mts +0 -106
  421. package/dist/services/AggregatedOrderBookConnection.d.mts.map +0 -1
  422. package/dist/services/AggregatedOrderBookConnection.mjs.map +0 -1
  423. package/dist/services/DataLakeService.cjs +0 -233
  424. package/dist/services/DataLakeService.cjs.map +0 -1
  425. package/dist/services/DataLakeService.d.cts.map +0 -1
  426. package/dist/services/DataLakeService.d.mts +0 -51
  427. package/dist/services/DataLakeService.d.mts.map +0 -1
  428. package/dist/services/DataLakeService.mjs.map +0 -1
  429. package/dist/services/DepositService.cjs +0 -99
  430. package/dist/services/DepositService.cjs.map +0 -1
  431. package/dist/services/DepositService.d.cts.map +0 -1
  432. package/dist/services/DepositService.d.mts +0 -39
  433. package/dist/services/DepositService.d.mts.map +0 -1
  434. package/dist/services/DepositService.mjs.map +0 -1
  435. package/dist/services/DexDiscoveryCacheManager.cjs +0 -147
  436. package/dist/services/DexDiscoveryCacheManager.cjs.map +0 -1
  437. package/dist/services/DexDiscoveryCacheManager.d.cts.map +0 -1
  438. package/dist/services/DexDiscoveryCacheManager.d.mts +0 -52
  439. package/dist/services/DexDiscoveryCacheManager.d.mts.map +0 -1
  440. package/dist/services/DexDiscoveryCacheManager.mjs.map +0 -1
  441. package/dist/services/EligibilityService.cjs +0 -78
  442. package/dist/services/EligibilityService.cjs.map +0 -1
  443. package/dist/services/EligibilityService.d.cts.map +0 -1
  444. package/dist/services/EligibilityService.d.mts +0 -28
  445. package/dist/services/EligibilityService.d.mts.map +0 -1
  446. package/dist/services/EligibilityService.mjs.map +0 -1
  447. package/dist/services/FeatureFlagConfigurationService.cjs +0 -257
  448. package/dist/services/FeatureFlagConfigurationService.cjs.map +0 -1
  449. package/dist/services/FeatureFlagConfigurationService.d.cts.map +0 -1
  450. package/dist/services/FeatureFlagConfigurationService.d.mts +0 -73
  451. package/dist/services/FeatureFlagConfigurationService.d.mts.map +0 -1
  452. package/dist/services/FeatureFlagConfigurationService.mjs.map +0 -1
  453. package/dist/services/HyperLiquidClientService.cjs +0 -1045
  454. package/dist/services/HyperLiquidClientService.cjs.map +0 -1
  455. package/dist/services/HyperLiquidClientService.d.cts.map +0 -1
  456. package/dist/services/HyperLiquidClientService.d.mts +0 -239
  457. package/dist/services/HyperLiquidClientService.d.mts.map +0 -1
  458. package/dist/services/HyperLiquidClientService.mjs.map +0 -1
  459. package/dist/services/HyperLiquidSubscriptionService.cjs +0 -3196
  460. package/dist/services/HyperLiquidSubscriptionService.cjs.map +0 -1
  461. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +0 -1
  462. package/dist/services/HyperLiquidSubscriptionService.d.mts +0 -227
  463. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +0 -1
  464. package/dist/services/HyperLiquidSubscriptionService.mjs.map +0 -1
  465. package/dist/services/HyperLiquidWalletService.cjs +0 -186
  466. package/dist/services/HyperLiquidWalletService.cjs.map +0 -1
  467. package/dist/services/HyperLiquidWalletService.d.cts.map +0 -1
  468. package/dist/services/HyperLiquidWalletService.d.mts +0 -84
  469. package/dist/services/HyperLiquidWalletService.d.mts.map +0 -1
  470. package/dist/services/HyperLiquidWalletService.mjs.map +0 -1
  471. package/dist/services/MarketDataService.cjs +0 -1138
  472. package/dist/services/MarketDataService.cjs.map +0 -1
  473. package/dist/services/MarketDataService.d.cts.map +0 -1
  474. package/dist/services/MarketDataService.d.mts +0 -334
  475. package/dist/services/MarketDataService.d.mts.map +0 -1
  476. package/dist/services/MarketDataService.mjs.map +0 -1
  477. package/dist/services/RewardsIntegrationService.cjs +0 -391
  478. package/dist/services/RewardsIntegrationService.cjs.map +0 -1
  479. package/dist/services/RewardsIntegrationService.d.cts.map +0 -1
  480. package/dist/services/RewardsIntegrationService.d.mts +0 -84
  481. package/dist/services/RewardsIntegrationService.d.mts.map +0 -1
  482. package/dist/services/RewardsIntegrationService.mjs.map +0 -1
  483. package/dist/services/ServiceContext.cjs +0 -3
  484. package/dist/services/ServiceContext.cjs.map +0 -1
  485. package/dist/services/ServiceContext.d.cts.map +0 -1
  486. package/dist/services/ServiceContext.d.mts +0 -102
  487. package/dist/services/ServiceContext.d.mts.map +0 -1
  488. package/dist/services/ServiceContext.mjs +0 -2
  489. package/dist/services/ServiceContext.mjs.map +0 -1
  490. package/dist/services/TerminalMarketService.cjs +0 -623
  491. package/dist/services/TerminalMarketService.cjs.map +0 -1
  492. package/dist/services/TerminalMarketService.d.cts.map +0 -1
  493. package/dist/services/TerminalMarketService.d.mts +0 -45
  494. package/dist/services/TerminalMarketService.d.mts.map +0 -1
  495. package/dist/services/TerminalMarketService.mjs.map +0 -1
  496. package/dist/services/TradingReadinessCache.cjs +0 -329
  497. package/dist/services/TradingReadinessCache.cjs.map +0 -1
  498. package/dist/services/TradingReadinessCache.d.cts +0 -204
  499. package/dist/services/TradingReadinessCache.d.cts.map +0 -1
  500. package/dist/services/TradingReadinessCache.d.mts.map +0 -1
  501. package/dist/services/TradingReadinessCache.mjs.map +0 -1
  502. package/dist/services/TradingService.cjs +0 -1865
  503. package/dist/services/TradingService.cjs.map +0 -1
  504. package/dist/services/TradingService.d.cts.map +0 -1
  505. package/dist/services/TradingService.d.mts +0 -201
  506. package/dist/services/TradingService.d.mts.map +0 -1
  507. package/dist/services/TradingService.mjs.map +0 -1
  508. package/dist/types/config.cjs +0 -3
  509. package/dist/types/config.cjs.map +0 -1
  510. package/dist/types/config.d.cts.map +0 -1
  511. package/dist/types/config.d.mts +0 -49
  512. package/dist/types/config.d.mts.map +0 -1
  513. package/dist/types/config.mjs +0 -2
  514. package/dist/types/config.mjs.map +0 -1
  515. package/dist/types/hyperliquid-types.cjs +0 -45
  516. package/dist/types/hyperliquid-types.cjs.map +0 -1
  517. package/dist/types/hyperliquid-types.d.cts.map +0 -1
  518. package/dist/types/hyperliquid-types.d.mts +0 -67
  519. package/dist/types/hyperliquid-types.d.mts.map +0 -1
  520. package/dist/types/hyperliquid-types.mjs.map +0 -1
  521. package/dist/types/index.cjs +0 -151
  522. package/dist/types/index.cjs.map +0 -1
  523. package/dist/types/index.d.cts.map +0 -1
  524. package/dist/types/index.d.mts +0 -1951
  525. package/dist/types/index.d.mts.map +0 -1
  526. package/dist/types/index.mjs.map +0 -1
  527. package/dist/types/messenger.cjs +0 -3
  528. package/dist/types/messenger.cjs.map +0 -1
  529. package/dist/types/messenger.d.cts +0 -30
  530. package/dist/types/messenger.d.cts.map +0 -1
  531. package/dist/types/messenger.d.mts.map +0 -1
  532. package/dist/types/messenger.mjs +0 -2
  533. package/dist/types/messenger.mjs.map +0 -1
  534. package/dist/types/myx-types.cjs +0 -41
  535. package/dist/types/myx-types.cjs.map +0 -1
  536. package/dist/types/myx-types.d.cts +0 -94
  537. package/dist/types/myx-types.d.cts.map +0 -1
  538. package/dist/types/myx-types.d.mts.map +0 -1
  539. package/dist/types/myx-types.mjs.map +0 -1
  540. package/dist/types/perps-types.cjs +0 -7
  541. package/dist/types/perps-types.cjs.map +0 -1
  542. package/dist/types/perps-types.d.cts.map +0 -1
  543. package/dist/types/perps-types.d.mts +0 -184
  544. package/dist/types/perps-types.d.mts.map +0 -1
  545. package/dist/types/perps-types.mjs +0 -5
  546. package/dist/types/perps-types.mjs.map +0 -1
  547. package/dist/types/token.cjs +0 -3
  548. package/dist/types/token.cjs.map +0 -1
  549. package/dist/types/token.d.cts.map +0 -1
  550. package/dist/types/token.d.mts +0 -25
  551. package/dist/types/token.d.mts.map +0 -1
  552. package/dist/types/token.mjs +0 -2
  553. package/dist/types/token.mjs.map +0 -1
  554. package/dist/types/transactionTypes.cjs +0 -29
  555. package/dist/types/transactionTypes.cjs.map +0 -1
  556. package/dist/types/transactionTypes.d.cts.map +0 -1
  557. package/dist/types/transactionTypes.d.mts +0 -60
  558. package/dist/types/transactionTypes.d.mts.map +0 -1
  559. package/dist/types/transactionTypes.mjs.map +0 -1
  560. package/dist/utils/accountUtils.cjs +0 -236
  561. package/dist/utils/accountUtils.cjs.map +0 -1
  562. package/dist/utils/accountUtils.d.cts.map +0 -1
  563. package/dist/utils/accountUtils.d.mts +0 -72
  564. package/dist/utils/accountUtils.d.mts.map +0 -1
  565. package/dist/utils/accountUtils.mjs.map +0 -1
  566. package/dist/utils/capabilitySymbols.cjs +0 -25
  567. package/dist/utils/capabilitySymbols.cjs.map +0 -1
  568. package/dist/utils/capabilitySymbols.d.cts +0 -15
  569. package/dist/utils/capabilitySymbols.d.cts.map +0 -1
  570. package/dist/utils/capabilitySymbols.d.mts.map +0 -1
  571. package/dist/utils/capabilitySymbols.mjs.map +0 -1
  572. package/dist/utils/coalescePerpsRestRequest.cjs +0 -71
  573. package/dist/utils/coalescePerpsRestRequest.cjs.map +0 -1
  574. package/dist/utils/coalescePerpsRestRequest.d.cts.map +0 -1
  575. package/dist/utils/coalescePerpsRestRequest.d.mts +0 -32
  576. package/dist/utils/coalescePerpsRestRequest.d.mts.map +0 -1
  577. package/dist/utils/coalescePerpsRestRequest.mjs.map +0 -1
  578. package/dist/utils/errorUtils.cjs +0 -104
  579. package/dist/utils/errorUtils.cjs.map +0 -1
  580. package/dist/utils/errorUtils.d.cts +0 -50
  581. package/dist/utils/errorUtils.d.cts.map +0 -1
  582. package/dist/utils/errorUtils.d.mts.map +0 -1
  583. package/dist/utils/errorUtils.mjs.map +0 -1
  584. package/dist/utils/hyperLiquidAbstraction.cjs +0 -23
  585. package/dist/utils/hyperLiquidAbstraction.cjs.map +0 -1
  586. package/dist/utils/hyperLiquidAbstraction.d.cts.map +0 -1
  587. package/dist/utils/hyperLiquidAbstraction.d.mts +0 -11
  588. package/dist/utils/hyperLiquidAbstraction.d.mts.map +0 -1
  589. package/dist/utils/hyperLiquidAbstraction.mjs.map +0 -1
  590. package/dist/utils/hyperLiquidAdapter.cjs +0 -512
  591. package/dist/utils/hyperLiquidAdapter.cjs.map +0 -1
  592. package/dist/utils/hyperLiquidAdapter.d.cts.map +0 -1
  593. package/dist/utils/hyperLiquidAdapter.d.mts +0 -77
  594. package/dist/utils/hyperLiquidAdapter.d.mts.map +0 -1
  595. package/dist/utils/hyperLiquidAdapter.mjs.map +0 -1
  596. package/dist/utils/hyperLiquidOrderBookProcessor.cjs +0 -83
  597. package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +0 -1
  598. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +0 -55
  599. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +0 -1
  600. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +0 -1
  601. package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +0 -1
  602. package/dist/utils/hyperLiquidValidation.cjs +0 -799
  603. package/dist/utils/hyperLiquidValidation.cjs.map +0 -1
  604. package/dist/utils/hyperLiquidValidation.d.cts.map +0 -1
  605. package/dist/utils/hyperLiquidValidation.d.mts +0 -192
  606. package/dist/utils/hyperLiquidValidation.d.mts.map +0 -1
  607. package/dist/utils/hyperLiquidValidation.mjs.map +0 -1
  608. package/dist/utils/idUtils.cjs +0 -18
  609. package/dist/utils/idUtils.cjs.map +0 -1
  610. package/dist/utils/idUtils.d.cts.map +0 -1
  611. package/dist/utils/idUtils.d.mts +0 -6
  612. package/dist/utils/idUtils.d.mts.map +0 -1
  613. package/dist/utils/idUtils.mjs.map +0 -1
  614. package/dist/utils/index.cjs +0 -65
  615. package/dist/utils/index.cjs.map +0 -1
  616. package/dist/utils/index.d.cts +0 -28
  617. package/dist/utils/index.d.cts.map +0 -1
  618. package/dist/utils/index.d.mts +0 -28
  619. package/dist/utils/index.d.mts.map +0 -1
  620. package/dist/utils/index.mjs.map +0 -1
  621. package/dist/utils/marketDataTransform.cjs +0 -250
  622. package/dist/utils/marketDataTransform.cjs.map +0 -1
  623. package/dist/utils/marketDataTransform.d.cts.map +0 -1
  624. package/dist/utils/marketDataTransform.d.mts +0 -71
  625. package/dist/utils/marketDataTransform.d.mts.map +0 -1
  626. package/dist/utils/marketDataTransform.mjs.map +0 -1
  627. package/dist/utils/marketSearch.cjs +0 -111
  628. package/dist/utils/marketSearch.cjs.map +0 -1
  629. package/dist/utils/marketSearch.d.cts.map +0 -1
  630. package/dist/utils/marketSearch.d.mts +0 -48
  631. package/dist/utils/marketSearch.d.mts.map +0 -1
  632. package/dist/utils/marketSearch.mjs.map +0 -1
  633. package/dist/utils/marketUtils.cjs +0 -266
  634. package/dist/utils/marketUtils.cjs.map +0 -1
  635. package/dist/utils/marketUtils.d.cts.map +0 -1
  636. package/dist/utils/marketUtils.d.mts +0 -73
  637. package/dist/utils/marketUtils.d.mts.map +0 -1
  638. package/dist/utils/marketUtils.mjs.map +0 -1
  639. package/dist/utils/myxAdapter.cjs +0 -569
  640. package/dist/utils/myxAdapter.cjs.map +0 -1
  641. package/dist/utils/myxAdapter.d.cts.map +0 -1
  642. package/dist/utils/myxAdapter.d.mts +0 -168
  643. package/dist/utils/myxAdapter.d.mts.map +0 -1
  644. package/dist/utils/myxAdapter.mjs.map +0 -1
  645. package/dist/utils/orderCalculations.cjs +0 -823
  646. package/dist/utils/orderCalculations.cjs.map +0 -1
  647. package/dist/utils/orderCalculations.d.cts.map +0 -1
  648. package/dist/utils/orderCalculations.d.mts +0 -298
  649. package/dist/utils/orderCalculations.d.mts.map +0 -1
  650. package/dist/utils/orderCalculations.mjs.map +0 -1
  651. package/dist/utils/orderTypes.cjs +0 -301
  652. package/dist/utils/orderTypes.cjs.map +0 -1
  653. package/dist/utils/orderTypes.d.cts +0 -166
  654. package/dist/utils/orderTypes.d.cts.map +0 -1
  655. package/dist/utils/orderTypes.d.mts.map +0 -1
  656. package/dist/utils/orderTypes.mjs.map +0 -1
  657. package/dist/utils/perpsConnectionAttemptContext.cjs +0 -20
  658. package/dist/utils/perpsConnectionAttemptContext.cjs.map +0 -1
  659. package/dist/utils/perpsConnectionAttemptContext.d.cts +0 -7
  660. package/dist/utils/perpsConnectionAttemptContext.d.cts.map +0 -1
  661. package/dist/utils/perpsConnectionAttemptContext.d.mts.map +0 -1
  662. package/dist/utils/perpsConnectionAttemptContext.mjs.map +0 -1
  663. package/dist/utils/perpsDiskPersistence.cjs +0 -259
  664. package/dist/utils/perpsDiskPersistence.cjs.map +0 -1
  665. package/dist/utils/perpsDiskPersistence.d.cts.map +0 -1
  666. package/dist/utils/perpsDiskPersistence.d.mts +0 -112
  667. package/dist/utils/perpsDiskPersistence.d.mts.map +0 -1
  668. package/dist/utils/perpsDiskPersistence.mjs.map +0 -1
  669. package/dist/utils/perpsFormatters.cjs +0 -509
  670. package/dist/utils/perpsFormatters.cjs.map +0 -1
  671. package/dist/utils/perpsFormatters.d.cts.map +0 -1
  672. package/dist/utils/perpsFormatters.d.mts +0 -204
  673. package/dist/utils/perpsFormatters.d.mts.map +0 -1
  674. package/dist/utils/perpsFormatters.mjs.map +0 -1
  675. package/dist/utils/rewardsUtils.cjs +0 -98
  676. package/dist/utils/rewardsUtils.cjs.map +0 -1
  677. package/dist/utils/rewardsUtils.d.cts.map +0 -1
  678. package/dist/utils/rewardsUtils.d.mts +0 -33
  679. package/dist/utils/rewardsUtils.d.mts.map +0 -1
  680. package/dist/utils/rewardsUtils.mjs.map +0 -1
  681. package/dist/utils/significantFigures.cjs +0 -88
  682. package/dist/utils/significantFigures.cjs.map +0 -1
  683. package/dist/utils/significantFigures.d.cts.map +0 -1
  684. package/dist/utils/significantFigures.d.mts +0 -25
  685. package/dist/utils/significantFigures.d.mts.map +0 -1
  686. package/dist/utils/significantFigures.mjs.map +0 -1
  687. package/dist/utils/sortMarkets.cjs +0 -93
  688. package/dist/utils/sortMarkets.cjs.map +0 -1
  689. package/dist/utils/sortMarkets.d.cts.map +0 -1
  690. package/dist/utils/sortMarkets.d.mts +0 -25
  691. package/dist/utils/sortMarkets.d.mts.map +0 -1
  692. package/dist/utils/sortMarkets.mjs.map +0 -1
  693. package/dist/utils/standaloneInfoClient.cjs +0 -70
  694. package/dist/utils/standaloneInfoClient.cjs.map +0 -1
  695. package/dist/utils/standaloneInfoClient.d.cts.map +0 -1
  696. package/dist/utils/standaloneInfoClient.d.mts +0 -37
  697. package/dist/utils/standaloneInfoClient.d.mts.map +0 -1
  698. package/dist/utils/standaloneInfoClient.mjs.map +0 -1
  699. package/dist/utils/stringParseUtils.cjs +0 -34
  700. package/dist/utils/stringParseUtils.cjs.map +0 -1
  701. package/dist/utils/stringParseUtils.d.cts.map +0 -1
  702. package/dist/utils/stringParseUtils.d.mts +0 -11
  703. package/dist/utils/stringParseUtils.d.mts.map +0 -1
  704. package/dist/utils/stringParseUtils.mjs.map +0 -1
  705. package/dist/utils/transferData.cjs +0 -33
  706. package/dist/utils/transferData.cjs.map +0 -1
  707. package/dist/utils/transferData.d.cts.map +0 -1
  708. package/dist/utils/transferData.d.mts +0 -9
  709. package/dist/utils/transferData.d.mts.map +0 -1
  710. package/dist/utils/transferData.mjs.map +0 -1
  711. package/dist/utils/wait.cjs +0 -6
  712. package/dist/utils/wait.cjs.map +0 -1
  713. package/dist/utils/wait.d.cts.map +0 -1
  714. package/dist/utils/wait.d.mts +0 -2
  715. package/dist/utils/wait.d.mts.map +0 -1
  716. package/dist/utils/wait.mjs.map +0 -1
@@ -1,1951 +0,0 @@
1
- import type { CaipAccountId, CaipChainId, CaipAssetId, Hex } from "@metamask/utils";
2
- import type { CandlePeriod, TimeDuration } from "../constants/chartConfig.mjs";
3
- import type { CHASE_ORDER_STATUS } from "../constants/perpsConfig.mjs";
4
- import type { CandleData, OrderType, StrategyOrderType, TpslLinkage, TriggerDirection, TriggerOrderType } from "./perps-types.mjs";
5
- /**
6
- * Connection states for WebSocket management.
7
- * Defined inline to avoid importing from Mobile-only services.
8
- * Must stay in sync with HyperLiquidClientService.WebSocketConnectionState.
9
- */
10
- export declare enum WebSocketConnectionState {
11
- Disconnected = "disconnected",
12
- Connecting = "connecting",
13
- Connected = "connected",
14
- Disconnecting = "disconnecting"
15
- }
16
- /** Provider-agnostic raw ledger update. Fields match the common shape across providers. */
17
- export type RawLedgerUpdate = {
18
- hash: string;
19
- time: number;
20
- delta: {
21
- type: string;
22
- usdc?: string;
23
- coin?: string;
24
- };
25
- };
26
- export type UserHistoryItem = {
27
- id: string;
28
- timestamp: number;
29
- type: 'deposit' | 'withdrawal';
30
- amount: string;
31
- asset: string;
32
- txHash: string;
33
- status: 'completed' | 'failed' | 'pending';
34
- details: {
35
- source: string;
36
- bridgeContract?: string;
37
- recipient?: string;
38
- blockNumber?: string;
39
- chainId?: string;
40
- synthetic?: boolean;
41
- };
42
- };
43
- export type GetUserHistoryParams = {
44
- startTime?: number;
45
- endTime?: number;
46
- accountId?: CaipAccountId;
47
- };
48
- export type TradeConfiguration = {
49
- leverage?: number;
50
- pendingConfig?: {
51
- amount?: string;
52
- leverage?: number;
53
- takeProfitPrice?: string;
54
- stopLossPrice?: string;
55
- limitPrice?: string;
56
- orderType?: OrderType;
57
- reduceOnly?: boolean;
58
- timestamp: number;
59
- };
60
- };
61
- export declare enum MarketCategory {
62
- CryptoCurrency = "crypto",
63
- Stock = "stock",
64
- PreIpo = "pre-ipo",
65
- Index = "index",
66
- Etf = "etf",
67
- Commodity = "commodity",
68
- Forex = "forex"
69
- }
70
- export type MarketType = `${MarketCategory}`;
71
- /**
72
- * Metadata extracted from Terminal API for a single asset.
73
- * Used downstream to enrich PerpsMarketData with name, keywords, tags, etc.
74
- */
75
- export type TerminalAssetMetadata = {
76
- name?: string;
77
- description?: string;
78
- keywords?: string[];
79
- tags?: string[];
80
- categories?: string[];
81
- marketType?: MarketType;
82
- /**
83
- * Epoch ms when this market was listed on the Terminal backend.
84
- * Normalized from the raw API value (number or ISO string).
85
- */
86
- listedAt?: number;
87
- };
88
- export type MarketTypeFilter = 'all' | 'crypto' | 'stock' | 'pre-ipo' | 'index' | 'etf' | 'commodity' | 'forex' | 'new';
89
- /**
90
- * Ordered list of the 7 data-model market categories for UI pills.
91
- * Does not include the 'all' or 'new' sentinel values — those are applied
92
- * via dedicated UI controls, not the category pills.
93
- * Kept in sync with {@link MarketTypeFilter} via `satisfies`.
94
- */
95
- export declare const MARKET_CATEGORIES: ["crypto", "stock", "pre-ipo", "index", "etf", "commodity", "forex"];
96
- export type InputMethod = 'default' | 'slider' | 'keypad' | 'percentage' | 'max';
97
- export type TradeAction = 'create_position' | 'increase_exposure' | 'flip_long_to_short' | 'flip_short_to_long';
98
- export type TrackingData = {
99
- totalFee: number;
100
- marketPrice: number;
101
- metamaskFee?: number;
102
- metamaskFeeRate?: number;
103
- feeDiscountPercentage?: number;
104
- estimatedPoints?: number;
105
- marginUsed?: number;
106
- inputMethod?: InputMethod;
107
- tradeAction?: TradeAction;
108
- receivedAmount?: number;
109
- realizedPnl?: number;
110
- source?: string;
111
- chartLibrary?: string;
112
- entryPoint?: string;
113
- discoverySource?: string;
114
- perpDiscoverySource?: string;
115
- hlFeeRate?: number;
116
- tradeWithToken?: boolean;
117
- mmPayTokenSelected?: string;
118
- mmPayNetworkSelected?: string;
119
- vipTier?: number;
120
- vipDiscount?: number;
121
- abTests?: Record<string, string>;
122
- };
123
- export type TPSLTrackingData = {
124
- direction: 'long' | 'short';
125
- /**
126
- * @deprecated Source of the TP/SL update (e.g., 'tp_sl_view', 'position_card').
127
- * Prefer `entryPoint` / `discoverySource` / `perpDiscoverySource` for risk-event
128
- * attribution; `source` is retained for backward compatibility.
129
- */
130
- source: string;
131
- positionSize: number;
132
- takeProfitPercentage?: number;
133
- stopLossPercentage?: number;
134
- isEditingExistingPosition?: boolean;
135
- entryPrice?: number;
136
- entryPoint?: string;
137
- discoverySource?: string;
138
- perpDiscoverySource?: string;
139
- };
140
- export type OrderParams = {
141
- symbol: string;
142
- isBuy: boolean;
143
- size: string;
144
- orderType: OrderType;
145
- price?: string;
146
- reduceOnly?: boolean;
147
- isFullClose?: boolean;
148
- timeInForce?: 'GTC' | 'IOC' | 'ALO';
149
- usdAmount?: string;
150
- priceAtCalculation?: number;
151
- maxSlippageBps?: number;
152
- /**
153
- * @deprecated Use `maxSlippageBps` instead. Retained for one release so that
154
- * existing publisher consumers (extension, core) that still pass slippage as
155
- * a decimal (e.g. 0.03 for 3%) continue to work; the provider normalizes the
156
- * value to basis points when `maxSlippageBps` is absent.
157
- */
158
- slippage?: number;
159
- triggerPrice?: string;
160
- twapDuration?: number;
161
- twapRandomize?: boolean;
162
- scaleMinPrice?: string;
163
- scaleMaxPrice?: string;
164
- scaleNumOrders?: number;
165
- /**
166
- * How the ladder's size is weighted across its rungs. Rung weights ramp
167
- * linearly from 1 at `scaleMinPrice` to this value at `scaleMaxPrice`, in that
168
- * direction for both sides — a short does not flip it. Above 1 puts more size
169
- * at `scaleMaxPrice`, below 1 at `scaleMinPrice`. Omitted or exactly 1 spreads
170
- * the size evenly. Any finite value above 0 is accepted as given; see
171
- * `splitScaleSizes` for how the sizes are allocated.
172
- */
173
- scaleSkew?: number;
174
- chaseIntervalMs?: number;
175
- chaseMaxDurationMs?: number;
176
- chaseMaxRepricings?: number;
177
- chaseMaxDistanceBps?: number;
178
- takeProfitPrice?: string;
179
- stopLossPrice?: string;
180
- takeProfitSize?: string;
181
- stopLossSize?: string;
182
- clientOrderId?: string;
183
- /**
184
- * How an attached TP/SL is linked: to this order (`order`), to the resulting
185
- * position (`position`), or absent (`none`). Defaults to `none` without TP/SL
186
- * and `order` with TP/SL. Takes precedence over the deprecated `grouping`.
187
- */
188
- tpslLinkage?: TpslLinkage;
189
- /**
190
- * @deprecated Use `tpslLinkage`. This field carries HyperLiquid's own grouping
191
- * vocabulary; it is honoured for existing callers but a provider-agnostic
192
- * placement should not depend on protocol wording.
193
- */
194
- grouping?: 'na' | 'normalTpsl' | 'positionTpsl';
195
- currentPrice?: number;
196
- leverage?: number;
197
- existingPositionLeverage?: number;
198
- trackingData?: TrackingData;
199
- providerId?: PerpsProviderType;
200
- };
201
- export type OrderResult = {
202
- success?: boolean;
203
- /**
204
- * What names the placement afterwards.
205
- *
206
- * For an ordinary placement this is the exchange's order ID. For a *strategy*
207
- * placement it is a handle instead — a venue TWAP id, or a client-generated
208
- * scale-group or chase-session id — which is what `CancelOrderParams` takes
209
- * together with the matching `orderType` and `providerId`. Scale and chase
210
- * handles are held in the provider session that created them. Scale handles
211
- * are also encoded in each rung's venue client-order ID, so an open-order
212
- * read can recover the group after reconnect. Chase handles cannot be
213
- * recovered because every replacement receives a new exchange order ID.
214
- * The individual exchange IDs a strategy expanded into are in
215
- * `childOrderIds`.
216
- */
217
- orderId?: string;
218
- error?: string;
219
- filledSize?: string;
220
- submittedSize?: string;
221
- averagePrice?: string;
222
- childOrderIds?: string[];
223
- providerId?: PerpsProviderType;
224
- };
225
- export type ChaseOrderStatus = (typeof CHASE_ORDER_STATUS)[keyof typeof CHASE_ORDER_STATUS];
226
- export type TwapOrderStatus = 'active' | 'completed' | 'completed_underfilled' | 'canceled' | 'failed';
227
- export type TwapOrderFill = {
228
- fillId: string;
229
- orderId: string;
230
- side: 'buy' | 'sell';
231
- price: string;
232
- size: string;
233
- fee: string;
234
- feeToken: string;
235
- builderFee?: string;
236
- timestamp: number;
237
- transactionHash: string;
238
- };
239
- /** Current and terminal state of one venue-native TWAP schedule. */
240
- export type TwapOrder = {
241
- orderId: string;
242
- symbol: string;
243
- side: 'buy' | 'sell';
244
- size: string;
245
- executedSize: string;
246
- remainingSize: string;
247
- executedNotional: string;
248
- averagePrice?: string;
249
- fillProgressBps: number;
250
- timeProgressBps: number;
251
- elapsedTimeMilliseconds: number;
252
- durationMinutes: number;
253
- randomize: boolean;
254
- reduceOnly: boolean;
255
- status: TwapOrderStatus;
256
- startedAt: number;
257
- lastUpdated: number;
258
- error?: string;
259
- fills: TwapOrderFill[];
260
- providerId?: PerpsProviderType;
261
- };
262
- /**
263
- * Client-visible state of one emulated Chase placement.
264
- *
265
- * The handle remains stable while the exchange child ID and resting price can
266
- * change on every reprice. Terminal sessions are retained until provider
267
- * teardown so clients can observe why chasing stopped and then reconcile the
268
- * surviving child through the ordinary orders stream.
269
- */
270
- export type ChaseOrder = {
271
- handle: string;
272
- symbol: string;
273
- side: 'buy' | 'sell';
274
- originalSize: string;
275
- remainingSize: string;
276
- arrivalPrice: string;
277
- restingPrice: string;
278
- restingOrderId: string | null;
279
- /** Adverse distance of the resting child from arrival, rounded to whole bps. */
280
- distanceChasedBps: number;
281
- /**
282
- * Optional adverse-touch stop, strictly between 0 and 10,000 bps.
283
- * The resting child may sit just inside this boundary after price-grid rounding.
284
- */
285
- maxDistanceBps?: number;
286
- repricings: number;
287
- startedAt: number;
288
- status: ChaseOrderStatus;
289
- providerId?: PerpsProviderType;
290
- };
291
- /** Lifecycle signal emitted when a Chase reaches its configured distance. */
292
- export type ChaseOrderMaxDistanceReached = {
293
- handle: string;
294
- symbol: string;
295
- side: 'buy' | 'sell';
296
- restingOrderId: string | null;
297
- restingPrice: string;
298
- maxDistanceBps: number;
299
- timestamp: number;
300
- providerId: PerpsProviderType;
301
- };
302
- export type Position = {
303
- symbol: string;
304
- size: string;
305
- entryPrice: string;
306
- positionValue: string;
307
- unrealizedPnl: string;
308
- marginUsed: string;
309
- leverage: {
310
- type: 'isolated' | 'cross';
311
- value: number;
312
- rawUsd?: string;
313
- };
314
- liquidationPrice: string | null;
315
- maxLeverage: number;
316
- returnOnEquity: string;
317
- cumulativeFunding: {
318
- allTime: string;
319
- sinceOpen: string;
320
- sinceChange: string;
321
- };
322
- /**
323
- * Take profit price (if set).
324
- *
325
- * Summary field, resolved for the common case a client renders: when
326
- * `takeProfitOrders` holds exactly one order this is that order's trigger
327
- * price, whether or not it covers the whole position. With two or more orders
328
- * no single price describes them, so this falls back to the position-bound
329
- * trigger — clients render `takeProfitCount` there instead.
330
- *
331
- * It may also reflect a TP/SL child of a *pending* order on this market, which
332
- * `takeProfitOrders` and `takeProfitCount` deliberately exclude because such a
333
- * child protects that order rather than the position. A position can therefore
334
- * report a price here with an empty array and a count of `0`. Prefer
335
- * `takeProfitOrders` for anything that must be exact.
336
- */
337
- takeProfitPrice?: string;
338
- /**
339
- * Stop loss price (if set). Same caveat as `takeProfitPrice`.
340
- */
341
- stopLossPrice?: string;
342
- takeProfitCount: number;
343
- stopLossCount: number;
344
- takeProfitOrders?: PositionTriggerOrder[];
345
- stopLossOrders?: PositionTriggerOrder[];
346
- providerId?: PerpsProviderType;
347
- };
348
- /**
349
- * A trigger order attached to a position, as surfaced in position state.
350
- * Provider-agnostic: protocols map their own trigger representation onto this.
351
- */
352
- export type PositionTriggerOrder = {
353
- orderId: string;
354
- direction: TriggerDirection;
355
- orderType?: TriggerOrderType;
356
- triggerPrice: string;
357
- size: string;
358
- isPartial: boolean;
359
- reduceOnly: boolean;
360
- };
361
- export type AccountState = {
362
- /**
363
- * Total USD equity on this venue — collateral + unrealized PnL. Live MTM.
364
- * HL: crossMarginSummary.accountValue + spot(USDC) − spot.hold
365
- * MYX: walletBalance + marginUsed + unrealizedPnl
366
- */
367
- totalBalance: string;
368
- /**
369
- * Max USD that can immediately collateralize a new position on this venue,
370
- * with no internal transfer required.
371
- * HL Unified: withdrawable + freeSpotUSDC
372
- * HL Standard: withdrawable
373
- * MYX: walletBalance
374
- */
375
- spendableBalance: string;
376
- /**
377
- * Max USD that can leave this venue to the user's external wallet.
378
- * UI reads this value without branching on provider; the provider
379
- * contract guarantees HL's own abstraction (Unified) or the direct
380
- * perps-clearinghouse (Standard) is what actually settles the
381
- * withdraw — no client-side spot→perps sweep is performed.
382
- * HL Unified: withdrawable + freeSpotUSDC (USDC only; `freeSpotUSDC = spot.total - spot.hold`, and HL withdraw3 draws from the unified ledger server-side)
383
- * HL Standard: withdrawable (perps-clearinghouse only; spot is a separate ledger)
384
- * MYX: walletBalance
385
- */
386
- withdrawableBalance: string;
387
- marginUsed: string;
388
- unrealizedPnl: string;
389
- returnOnEquity: string;
390
- /**
391
- * Per-sub-account balance breakdown (protocol-specific, optional)
392
- * Maps sub-account identifier to its balance details.
393
- *
394
- * Protocol examples:
395
- * - HyperLiquid HIP-3: '' or 'main' (main DEX), 'xyz' (HIP-3 builder DEX)
396
- * - dYdX: Sub-account numbers (e.g., '0', '1', '2')
397
- * - Other protocols: Vault IDs, pool IDs, margin account IDs, etc.
398
- *
399
- * Key: Sub-account identifier (protocol-specific string)
400
- * Value: Balance details for that sub-account
401
- */
402
- subAccountBreakdown?: Record<string, {
403
- spendableBalance: string;
404
- withdrawableBalance: string;
405
- totalBalance: string;
406
- }>;
407
- providerId?: PerpsProviderType;
408
- };
409
- export type ClosePositionParams = {
410
- symbol: string;
411
- size?: string;
412
- /**
413
- * Close order type (default: market). Only `market` and `limit` are meaningful
414
- * here: `ClosePositionParams` carries no trigger price, so a trigger-based
415
- * close is not expressible and would be rejected during placement.
416
- *
417
- * Strategy placements are excluded at the type level rather than left to a
418
- * runtime rejection, because this type cannot carry any of the fields they
419
- * require and `closePosition` has no path that executes them. Derived with
420
- * `Exclude` on purpose: it shrinks as `StrategyOrderType` grows, so a strategy
421
- * added later is refused here automatically.
422
- */
423
- orderType?: Exclude<OrderType, StrategyOrderType>;
424
- price?: string;
425
- currentPrice?: number;
426
- usdAmount?: string;
427
- priceAtCalculation?: number;
428
- maxSlippageBps?: number;
429
- trackingData?: TrackingData;
430
- providerId?: PerpsProviderType;
431
- /**
432
- * Optional live position data from WebSocket.
433
- *
434
- * Pass a WebSocket-sourced snapshot only. The provider treats its own
435
- * WebSocket position cache as fresher than this value and overrides the
436
- * snapshot's size and side with it, so a REST-sourced (potentially older)
437
- * position gives no benefit here.
438
- *
439
- * Providing it avoids a position fetch in the common case, but does not
440
- * guarantee one is skipped: when the WebSocket cache does not cover the
441
- * symbol's DEX (for example a HIP-3 DEX whose subscription has not published
442
- * this session), the provider issues a single `clearinghouseState` request for
443
- * that DEX alone, because the cache's silence proves nothing about the symbol.
444
- * If that request succeeds, its answer is authoritative — the close fails with
445
- * `No position found for <symbol>` when the DEX reports the symbol gone, even
446
- * if it reports no positions at all. This snapshot is used only when that
447
- * request fails, since a failed lookup proves nothing either.
448
- *
449
- * If not provided, the position is read from the WebSocket cache, falling back
450
- * to a REST fetch when the cache is not initialized.
451
- */
452
- position?: Position;
453
- };
454
- export type ClosePositionsParams = {
455
- symbols?: string[];
456
- closeAll?: boolean;
457
- };
458
- export type ClosePositionsResult = {
459
- success: boolean;
460
- successCount: number;
461
- failureCount: number;
462
- results: {
463
- symbol: string;
464
- success: boolean;
465
- error?: string;
466
- }[];
467
- };
468
- export type UpdateMarginParams = {
469
- symbol: string;
470
- amount: string;
471
- providerId?: PerpsProviderType;
472
- };
473
- export type MarginResult = {
474
- success: boolean;
475
- error?: string;
476
- };
477
- export type FlipPositionParams = {
478
- symbol: string;
479
- position: Position;
480
- trackingData?: TrackingData;
481
- };
482
- export type InitializeResult = {
483
- success: boolean;
484
- error?: string;
485
- chainId?: string;
486
- };
487
- export type ReadyToTradeResult = {
488
- ready: boolean;
489
- error?: string;
490
- walletConnected?: boolean;
491
- networkSupported?: boolean;
492
- authenticatedAddress?: string;
493
- };
494
- export type DisconnectResult = {
495
- success: boolean;
496
- error?: string;
497
- };
498
- export type MarketInfo = {
499
- name: string;
500
- szDecimals: number;
501
- maxLeverage: number;
502
- marginTableId: number;
503
- onlyIsolated?: true;
504
- isDelisted?: true;
505
- minimumOrderSize?: number;
506
- providerId?: PerpsProviderType;
507
- };
508
- /**
509
- * Market data with prices for UI display
510
- * Protocol-agnostic interface for market information with formatted values
511
- */
512
- export type PerpsMarketData = {
513
- /**
514
- * Token symbol (e.g., 'BTC', 'ETH')
515
- */
516
- symbol: string;
517
- /**
518
- * Full token name (e.g., 'Bitcoin', 'Ethereum')
519
- */
520
- name: string;
521
- /**
522
- * Human-readable asset description from Terminal API metadata, when available
523
- * (e.g., 'The leading smart contract platform. Home to DeFi, NFTs...').
524
- * Only populated when using the Terminal API backend and the asset has one.
525
- */
526
- description?: string;
527
- /**
528
- * Maximum leverage available as formatted string (e.g., '40x', '25x')
529
- */
530
- maxLeverage: string;
531
- /**
532
- * Current price as formatted string (e.g., '$50,000.00')
533
- */
534
- price: string;
535
- /**
536
- * 24h price change as formatted string (e.g., '+$1,250.00', '-$850.50')
537
- */
538
- change24h: string;
539
- /**
540
- * 24h price change percentage as formatted string (e.g., '+2.5%', '-1.8%')
541
- */
542
- change24hPercent: string;
543
- /**
544
- * Trading volume as formatted string (e.g., '$1.2B', '$850M')
545
- */
546
- volume: string;
547
- /**
548
- * Open interest as formatted string (e.g., '$24.5M', '$1.2B')
549
- */
550
- openInterest?: string;
551
- /**
552
- * Next funding time in milliseconds since epoch (optional, market-specific)
553
- */
554
- nextFundingTime?: number;
555
- /**
556
- * Funding interval in hours (optional, market-specific)
557
- */
558
- fundingIntervalHours?: number;
559
- /**
560
- * Current funding rate as decimal (optional, from predictedFundings API)
561
- */
562
- fundingRate?: number;
563
- /**
564
- * Market source DEX identifier (HIP-3 support)
565
- * - null or undefined: Main validator DEX
566
- * - "xyz", "abc", etc: HIP-3 builder-deployed DEX
567
- */
568
- marketSource?: string | null;
569
- /**
570
- * Market asset type classification (optional)
571
- * - crypto: Cryptocurrency (default for most markets)
572
- * - stock: Individual stocks (HIP-3)
573
- * - pre-ipo: Pre-IPO assets (HIP-3)
574
- * - index: Market indices (HIP-3)
575
- * - etf: Exchange-traded funds (HIP-3)
576
- * - commodity: Commodity markets (HIP-3)
577
- * - forex: Foreign exchange pairs (HIP-3)
578
- */
579
- marketType?: MarketType;
580
- /**
581
- * Whether this is a HIP-3 market (has DEX prefix like xyz:, flx:)
582
- * Used to distinguish between crypto (isHip3=false) and non-crypto markets
583
- */
584
- isHip3?: boolean;
585
- /**
586
- * Whether this is a new/uncategorized market (HIP-3 markets not yet in explicit mapping)
587
- * Used for the "New" filter tab
588
- */
589
- isNewMarket?: boolean;
590
- /**
591
- * Multi-provider: which provider this market data comes from (injected by aggregator)
592
- */
593
- providerId?: PerpsProviderType;
594
- /**
595
- * Indicates this market snapshot came from the last known good cache after live fetch failure.
596
- */
597
- isStale?: boolean;
598
- /** Identifies an atomic Terminal summary whose price/change use mark semantics. */
599
- dataSource?: 'terminal-global-snapshot-mark';
600
- /** Source-bounded expiry for an atomic Terminal summary. */
601
- sourceExpiresAt?: number;
602
- /**
603
- * Searchable keywords from Terminal API metadata (e.g., ['defi', 'layer-1'])
604
- */
605
- keywords?: string[];
606
- /**
607
- * Taxonomy tags from Terminal API metadata (e.g., ['top-100', 'gaming'])
608
- */
609
- tags?: string[];
610
- /**
611
- * Market categories from Terminal API metadata (e.g., ['crypto', 'meme'])
612
- */
613
- categories?: string[];
614
- /** Timestamped hourly price points supplied by the atomic Terminal snapshot. */
615
- trend?: [timestampMs: number, price: string][];
616
- /**
617
- * Epoch ms when this market was listed on the Terminal backend.
618
- * Sourced from the Terminal API `listedAt` field.
619
- * Clients can use this to surface recently added markets (e.g. markets listed within the last 30 days).
620
- */
621
- listedAt?: number;
622
- };
623
- export type ToggleTestnetResult = {
624
- success: boolean;
625
- isTestnet: boolean;
626
- error?: string;
627
- };
628
- export type AssetRoute = {
629
- assetId: CaipAssetId;
630
- chainId: CaipChainId;
631
- contractAddress: Hex;
632
- constraints?: {
633
- minAmount?: string;
634
- maxAmount?: string;
635
- estimatedTime?: string;
636
- estimatedMinutes?: number;
637
- fees?: {
638
- fixed?: number;
639
- percentage?: number;
640
- token?: string;
641
- };
642
- };
643
- };
644
- export type SwitchProviderResult = {
645
- success: boolean;
646
- providerId: PerpsActiveProviderMode;
647
- error?: string;
648
- };
649
- export type CancelOrderParams = {
650
- orderId: string;
651
- symbol: string;
652
- /**
653
- * Placement type of what is being cancelled. Only the strategy types
654
- * (`twap`, `scale`, `chase`) change anything: each is cancelled through its
655
- * own path — the venue's TWAP cancel endpoint, a batch cancel of the ladder's
656
- * children, or stopping the chase session and cancelling its live order.
657
- * Omit it (or pass an ordinary order type) to cancel a single resting order,
658
- * which is what every existing caller does.
659
- */
660
- orderType?: OrderType;
661
- providerId?: PerpsProviderType;
662
- trackingData?: TrackingData;
663
- };
664
- export type CancelOrderResult = {
665
- success: boolean;
666
- /**
667
- * What was cancelled, named the same way it was placed: an exchange order ID
668
- * for an ordinary cancel, and the strategy handle — TWAP id, scale group, or
669
- * chase session — when `CancelOrderParams.orderType` named one. Scale and
670
- * chase handles can only be cancelled during the provider session that
671
- * created them; TWAP IDs are venue-owned.
672
- */
673
- orderId?: string;
674
- error?: string;
675
- providerId?: PerpsProviderType;
676
- };
677
- export type BatchCancelOrdersParams = {
678
- orderId: string;
679
- symbol: string;
680
- }[];
681
- export type CancelOrdersParams = {
682
- symbols?: string[];
683
- orderIds?: string[];
684
- cancelAll?: boolean;
685
- };
686
- export type CancelOrdersResult = {
687
- success: boolean;
688
- successCount: number;
689
- failureCount: number;
690
- results: {
691
- orderId: string;
692
- symbol: string;
693
- success: boolean;
694
- error?: string;
695
- }[];
696
- };
697
- export type EditOrderParams = {
698
- orderId: string | number;
699
- newOrder: OrderParams;
700
- };
701
- export type DepositParams = {
702
- amount: string;
703
- assetId: CaipAssetId;
704
- fromChainId?: CaipChainId;
705
- toChainId?: CaipChainId;
706
- recipient?: Hex;
707
- };
708
- /** Params for depositWithConfirmation: prepares transaction for confirmation screen */
709
- export type DepositWithConfirmationParams = {
710
- /** Optional deposit amount (display/tracking; actual amount comes from prepared transaction) */
711
- amount?: string;
712
- /** If true, uses addTransaction instead of submit to avoid navigation (e.g. deposit + place order flow) */
713
- placeOrder?: boolean;
714
- };
715
- export type DepositResult = {
716
- success: boolean;
717
- txHash?: string;
718
- error?: string;
719
- };
720
- export type DepositStatus = 'idle' | 'preparing' | 'swapping' | 'bridging' | 'depositing' | 'success' | 'error';
721
- export type DepositFlowType = 'direct' | 'swap' | 'bridge' | 'swap_bridge';
722
- export type DepositStepInfo = {
723
- totalSteps: number;
724
- currentStep: number;
725
- stepNames: string[];
726
- stepTxHashes?: string[];
727
- };
728
- export type WithdrawParams = {
729
- amount: string;
730
- destination?: Hex;
731
- assetId?: CaipAssetId;
732
- providerId?: PerpsProviderType;
733
- };
734
- export type WithdrawResult = {
735
- success: boolean;
736
- txHash?: string;
737
- error?: string;
738
- withdrawalId?: string;
739
- estimatedArrivalTime?: number;
740
- };
741
- export type TransferBetweenDexsParams = {
742
- sourceDex: string;
743
- destinationDex: string;
744
- amount: string;
745
- };
746
- export type TransferBetweenDexsResult = {
747
- success: boolean;
748
- txHash?: string;
749
- error?: string;
750
- };
751
- export type GetHistoricalPortfolioParams = {
752
- accountId?: CaipAccountId;
753
- };
754
- export type HistoricalPortfolioResult = {
755
- accountValue1dAgo: string;
756
- timestamp: number;
757
- };
758
- export type LiveDataConfig = {
759
- priceThrottleMs?: number;
760
- positionThrottleMs?: number;
761
- maxUpdatesPerSecond?: number;
762
- };
763
- export type PerpsControllerConfig = {
764
- /**
765
- * Fallback blocked regions to use when RemoteFeatureFlagController fails to fetch.
766
- * The fallback is set by default if defined and replaced with remote block list once available.
767
- */
768
- fallbackBlockedRegions?: string[];
769
- /**
770
- * Fallback HIP-3 equity perps master switch to use when RemoteFeatureFlagController fails to fetch.
771
- * Controls whether HIP-3 (builder-deployed) DEXs are enabled.
772
- * The fallback is set by default if defined and replaced with remote feature flag once available.
773
- */
774
- fallbackHip3Enabled?: boolean;
775
- /**
776
- * Fallback HIP-3 market allowlist to use when RemoteFeatureFlagController fails to fetch.
777
- * Empty array = enable all markets (discovery mode), non-empty = allowlist specific markets.
778
- * Supports wildcards: "xyz:*" (all xyz markets), "xyz" (shorthand for "xyz:*"), "BTC" (main DEX market).
779
- * Only applies when HIP-3 is enabled.
780
- * The fallback is set by default if defined and replaced with remote feature flag once available.
781
- */
782
- fallbackHip3AllowlistMarkets?: string[];
783
- /**
784
- * Fallback HIP-3 market blocklist to use when RemoteFeatureFlagController fails to fetch.
785
- * Empty array = no blocking, non-empty = block specific markets.
786
- * Supports wildcards: "xyz:*" (block all xyz markets), "xyz" (shorthand for "xyz:*"), "BTC" (block main DEX market).
787
- * Always applied regardless of HIP-3 enabled state.
788
- * The fallback is set by default if defined and replaced with remote feature flag once available.
789
- */
790
- fallbackHip3BlocklistMarkets?: string[];
791
- /**
792
- * Override for the maximum allowed deviation of a market's price from its oracle
793
- * (reference) price before it is reported as untradable (`PriceUpdate.isTradable`),
794
- * as a decimal fraction (e.g. `0.95` = 95%). Protocol-agnostic: each provider applies
795
- * its own default when omitted (HyperLiquid uses
796
- * `HYPERLIQUID_CONFIG.OraclePriceDeviationLimit`, `0.95`). Lets a client tune the
797
- * threshold without a package release.
798
- */
799
- fallbackPriceDeviationLimit?: number;
800
- /**
801
- * Per-provider credentials and configuration.
802
- * Nested by provider name so each provider's settings are self-contained
803
- * and new protocols can be added without polluting the top-level config.
804
- * Passed from the init file where `process.env.X` is babel-transformed at build time.
805
- */
806
- providerCredentials?: PerpsProviderCredentials;
807
- };
808
- export type HyperLiquidCredentials = {
809
- /** Builder fee wallet address for testnet. Empty/omitted = uses BUILDER_FEE_CONFIG default. */
810
- builderAddressTestnet?: string;
811
- /** Builder fee wallet address for mainnet. Empty/omitted = uses BUILDER_FEE_CONFIG default. */
812
- builderAddressMainnet?: string;
813
- /** Dedicated subscription waiver builder for testnet. */
814
- subscriptionBuilderAddressTestnet?: string;
815
- /** Dedicated subscription waiver builder for mainnet. */
816
- subscriptionBuilderAddressMainnet?: string;
817
- };
818
- export type MYXCredentials = {
819
- /** Whether MYX provider is enabled via local env var. */
820
- enabled?: boolean;
821
- appIdTestnet?: string;
822
- apiSecretTestnet?: string;
823
- brokerAddressTestnet?: string;
824
- appIdMainnet?: string;
825
- apiSecretMainnet?: string;
826
- brokerAddressMainnet?: string;
827
- };
828
- export type PerpsProviderCredentials = {
829
- hyperliquid?: HyperLiquidCredentials;
830
- myx?: MYXCredentials;
831
- };
832
- export type PriceUpdate = {
833
- symbol: string;
834
- price: string;
835
- timestamp: number;
836
- percentChange24h?: string;
837
- bestBid?: string;
838
- bestAsk?: string;
839
- spread?: string;
840
- markPrice?: string;
841
- funding?: number;
842
- openInterest?: number;
843
- volume24h?: number;
844
- /**
845
- * Whether the market is currently tradable. Defaults to `true`.
846
- *
847
- * Some markets — most often HIP-3 builder-deployed ones — become temporarily
848
- * untradable when their market price drifts too far from the oracle price, in which
849
- * case the protocol rejects orders (HyperLiquid: "Order price cannot be more than 95%
850
- * away from the reference price"). Clients use this to proactively show a "trading
851
- * unavailable" warning instead of letting the order fail on submission.
852
- *
853
- * Computed per provider/protocol from that protocol's own rules. It is `false` only
854
- * when a provider determines the market is currently untradable; a provider that has no
855
- * such rule, or cannot assess tradability yet (e.g. before the oracle price is cached),
856
- * reports `true`. The value is always a concrete boolean — never `undefined`.
857
- */
858
- isTradable: boolean;
859
- providerId?: PerpsProviderType;
860
- };
861
- export type OrderFill = {
862
- orderId: string;
863
- symbol: string;
864
- side: string;
865
- size: string;
866
- price: string;
867
- pnl: string;
868
- direction: string;
869
- fee: string;
870
- feeToken: string;
871
- timestamp: number;
872
- startPosition?: string;
873
- success?: boolean;
874
- liquidation?: {
875
- liquidatedUser: string;
876
- markPx: string;
877
- method: string;
878
- };
879
- orderType?: 'take_profit' | 'stop_loss' | 'liquidation' | 'regular';
880
- detailedOrderType?: string;
881
- providerId?: PerpsProviderType;
882
- };
883
- export type CheckEligibilityParams = {
884
- blockedRegions: string[];
885
- geoLocation: string;
886
- };
887
- export type GetPositionsParams = {
888
- accountId?: CaipAccountId;
889
- includeHistory?: boolean;
890
- skipCache?: boolean;
891
- standalone?: boolean;
892
- userAddress?: string;
893
- };
894
- export type GetAccountStateParams = {
895
- accountId?: CaipAccountId;
896
- source?: string;
897
- standalone?: boolean;
898
- userAddress?: string;
899
- };
900
- export type GetUserDataSnapshotParams = {
901
- userAddress: string;
902
- identity: {
903
- provider: 'hyperliquid';
904
- network: 'mainnet' | 'testnet';
905
- hip3ConfigVersion: number;
906
- dexes: string[];
907
- };
908
- };
909
- export type PerpsUserDataSnapshot = {
910
- positions: Position[];
911
- orders: Order[];
912
- accountState: AccountState;
913
- identity: GetUserDataSnapshotParams['identity'] & {
914
- address: string;
915
- };
916
- };
917
- export type GetOrderFillsParams = {
918
- accountId?: CaipAccountId;
919
- user?: Hex;
920
- startTime?: number;
921
- endTime?: number;
922
- limit?: number;
923
- aggregateByTime?: boolean;
924
- };
925
- /**
926
- * Parameters for getOrFetchFills - optimized cache-first fill retrieval.
927
- * Subset of GetOrderFillsParams for cache filtering.
928
- */
929
- export type GetOrFetchFillsParams = {
930
- startTime?: number;
931
- symbol?: string;
932
- };
933
- export type GetOrdersParams = {
934
- accountId?: CaipAccountId;
935
- startTime?: number;
936
- endTime?: number;
937
- limit?: number;
938
- offset?: number;
939
- skipCache?: boolean;
940
- standalone?: boolean;
941
- userAddress?: string;
942
- };
943
- /**
944
- * Options for cache-aware provider read calls (getOrders, getOrderFills, etc.).
945
- * Provider-agnostic: providers without inner caches can ignore; providers that
946
- * cache at the service layer (e.g. HyperLiquid) must honor forceRefresh.
947
- */
948
- export type PerpsReadOptions = {
949
- /** Bypass any provider-internal cache. Used for user-initiated refresh (pull-to-refresh). */
950
- forceRefresh?: boolean;
951
- };
952
- export type GetFundingParams = {
953
- accountId?: CaipAccountId;
954
- startTime?: number;
955
- endTime?: number;
956
- limit?: number;
957
- offset?: number;
958
- };
959
- export type GetSupportedPathsParams = {
960
- isTestnet?: boolean;
961
- assetId?: CaipAssetId;
962
- symbol?: string;
963
- chainId?: CaipChainId;
964
- };
965
- /** Placeholder for future filter/pagination params (e.g., validated, chain). Empty today so the API signature is stable. */
966
- export type GetAvailableDexsParams = Record<string, never>;
967
- /** Field to sort markets by. */
968
- export type SortField = 'volume' | 'priceChange' | 'fundingRate' | 'openInterest';
969
- /** Direction for market sorting. */
970
- export type SortDirection = 'asc' | 'desc';
971
- export type GetMarketsParams = {
972
- symbols?: string[];
973
- dex?: string;
974
- skipFilters?: boolean;
975
- standalone?: boolean;
976
- useTerminalApi?: boolean;
977
- };
978
- /**
979
- * Parameters for {@link PerpsController.getMarketDataWithPrices}.
980
- * Extends the base market-fetch params with optional category filtering,
981
- * sorting, and pagination that are applied as post-processing.
982
- */
983
- export type GetMarketDataWithPricesParams = {
984
- standalone?: boolean;
985
- categories?: MarketTypeFilter[];
986
- excludeSymbols?: string[];
987
- sortBy?: SortField;
988
- direction?: SortDirection;
989
- limit?: number;
990
- useTerminalApi?: boolean;
991
- };
992
- export type SubscribePricesParams = {
993
- symbols: string[];
994
- callback: (prices: PriceUpdate[]) => void;
995
- throttleMs?: number;
996
- includeOrderBook?: boolean;
997
- includeMarketData?: boolean;
998
- };
999
- export type SubscribePositionsParams = {
1000
- callback: (positions: Position[]) => void;
1001
- accountId?: CaipAccountId;
1002
- includeHistory?: boolean;
1003
- };
1004
- export type SubscribeOrderFillsParams = {
1005
- callback: (fills: OrderFill[], isSnapshot?: boolean) => void;
1006
- accountId?: CaipAccountId;
1007
- since?: number;
1008
- };
1009
- export type SubscribeOrdersParams = {
1010
- callback: (orders: Order[]) => void;
1011
- accountId?: CaipAccountId;
1012
- includeHistory?: boolean;
1013
- };
1014
- export type SubscribeAccountParams = {
1015
- callback: (account: AccountState | null) => void;
1016
- accountId?: CaipAccountId;
1017
- };
1018
- export type SubscribeOICapsParams = {
1019
- callback: (caps: string[]) => void;
1020
- accountId?: CaipAccountId;
1021
- };
1022
- export type SubscribeCandlesParams = {
1023
- symbol: string;
1024
- interval: CandlePeriod;
1025
- duration?: TimeDuration;
1026
- callback: (data: CandleData) => void;
1027
- onError?: (error: Error) => void;
1028
- };
1029
- /**
1030
- * Single price level in the order book
1031
- */
1032
- export type OrderBookLevel = {
1033
- /** Price at this level */
1034
- price: string;
1035
- /** Size at this level (in base asset) */
1036
- size: string;
1037
- /** Cumulative size up to and including this level */
1038
- total: string;
1039
- /** Notional value in USD */
1040
- notional: string;
1041
- /** Cumulative notional up to and including this level */
1042
- totalNotional: string;
1043
- };
1044
- /**
1045
- * Full order book data with multiple price levels
1046
- */
1047
- export type OrderBookData = {
1048
- /** Bid levels (buy orders) - highest price first */
1049
- bids: OrderBookLevel[];
1050
- /** Ask levels (sell orders) - lowest price first */
1051
- asks: OrderBookLevel[];
1052
- /** Spread between best bid and best ask */
1053
- spread: string;
1054
- /** Spread as a percentage of mid price */
1055
- spreadPercentage: string;
1056
- /** Mid price (average of best bid and best ask) */
1057
- midPrice: string;
1058
- /** Timestamp of last update */
1059
- lastUpdated: number;
1060
- /** Maximum total size across all levels (for scaling depth bars) */
1061
- maxTotal: string;
1062
- };
1063
- export type SubscribeOrderBookParams = {
1064
- /** Symbol to subscribe to (e.g., 'BTC', 'ETH') */
1065
- symbol: string;
1066
- /** Number of levels to return per side (default: 10) */
1067
- levels?: number;
1068
- /** Price aggregation significant figures (2-5, default: 5). Higher = finer granularity */
1069
- nSigFigs?: 2 | 3 | 4 | 5;
1070
- /** Mantissa for aggregation when nSigFigs is 5 (2 or 5). Controls finest price increments */
1071
- mantissa?: 2 | 5;
1072
- /**
1073
- * Enable fast order book updates (5 levels @ ~0.5 s cadence).
1074
- * When omitted, Hyperliquid uses the default cadence (20 levels @ ~2 s).
1075
- * Note: with `fast: true` the widget receives at most 5 levels per side
1076
- * regardless of the `levels` setting.
1077
- */
1078
- fast?: boolean;
1079
- /** Callback function receiving order book updates */
1080
- callback: (orderBook: OrderBookData) => void;
1081
- /** Callback for errors */
1082
- onError?: (error: Error) => void;
1083
- };
1084
- export type LiquidationPriceParams = {
1085
- entryPrice: number;
1086
- leverage: number;
1087
- direction: 'long' | 'short';
1088
- positionSize?: number;
1089
- marginType?: 'isolated' | 'cross';
1090
- asset?: string;
1091
- };
1092
- export type MaintenanceMarginParams = {
1093
- asset: string;
1094
- positionSize?: number;
1095
- };
1096
- /**
1097
- * Context used to resolve the provider that owns order capabilities.
1098
- * `symbol` allows providers to narrow capabilities per market, while
1099
- * `providerId` follows the same explicit-over-default routing as placement.
1100
- */
1101
- export type GetOrderCapabilitiesParams = {
1102
- /** Provider-specific market identifier, including any routing prefix. */
1103
- symbol: string;
1104
- providerId?: PerpsProviderType;
1105
- };
1106
- /** Provider-owned strategy capabilities for the selected market route. */
1107
- export type DirectProviderOrderCapabilitiesUnavailableReason = 'provider_unavailable' | 'invalid_symbol' | 'market_not_found' | 'strategy_market_unsupported';
1108
- export type RoutedOrderCapabilitiesUnavailableReason = 'provider_not_found' | 'provider_not_routable' | 'not_implemented';
1109
- export type OrderCapabilitiesUnavailableReason = DirectProviderOrderCapabilitiesUnavailableReason | RoutedOrderCapabilitiesUnavailableReason;
1110
- type ReadyPerpsOrderCapabilities = Readonly<{
1111
- status: 'ready';
1112
- providerId: PerpsProviderType;
1113
- supportedStrategies: readonly StrategyOrderType[];
1114
- }>;
1115
- export type DirectProviderOrderCapabilities = ReadyPerpsOrderCapabilities | Readonly<{
1116
- status: 'unavailable';
1117
- providerId?: PerpsProviderType;
1118
- reason: DirectProviderOrderCapabilitiesUnavailableReason;
1119
- }>;
1120
- export type PerpsOrderCapabilities = ReadyPerpsOrderCapabilities | Readonly<{
1121
- status: 'unavailable';
1122
- providerId?: PerpsProviderType;
1123
- reason: OrderCapabilitiesUnavailableReason;
1124
- }>;
1125
- export type FeeCalculationParams = {
1126
- orderType: OrderType;
1127
- isMaker?: boolean;
1128
- amount?: string;
1129
- symbol: string;
1130
- providerId?: PerpsProviderType;
1131
- };
1132
- export type FeeCalculationResult = {
1133
- feeRate?: number;
1134
- feeAmount?: number;
1135
- protocolFeeRate?: number;
1136
- protocolFeeAmount?: number;
1137
- metamaskFeeRate?: number;
1138
- metamaskFeeAmount?: number;
1139
- breakdown?: {
1140
- baseFeeRate: number;
1141
- volumeTier?: string;
1142
- volumeDiscount?: number;
1143
- stakingDiscount?: number;
1144
- };
1145
- /**
1146
- * Read-only subscription fee-waiver preview, sourced from the same cached
1147
- * benefits snapshot the fee resolver uses. Present only when the controller
1148
- * has a subscription source wired; the quoted rates above are not adjusted
1149
- * from it, so surfacing this never mutates the cap or the cache.
1150
- */
1151
- subscription?: PerpsSubscriptionFeeWaiverStatus;
1152
- };
1153
- /**
1154
- * Usage state of the perps fee waiver on a subscription benefits snapshot.
1155
- */
1156
- export type PerpsSubscriptionUsage = 'available' | 'exhausted';
1157
- /**
1158
- * Subscription benefits as returned by `GET /v1/profiles/{profileId}/benefits`.
1159
- *
1160
- * The perps controller never performs this request itself — the client owns the
1161
- * Profile JWT and injects the read through
1162
- * {@link PerpsPlatformDependencies.subscription}. Only the fields the perps fee
1163
- * waiver depends on are modelled here.
1164
- */
1165
- export type PerpsSubscriptionBenefits = {
1166
- /** Subscription status; only `active` can pass the eligibility gate. */
1167
- status: string;
1168
- /** Perps fee waiver entitlement and its remaining allowance. */
1169
- perpsFeeWaiver?: {
1170
- /** Whether the plan entitles this profile to the perps fee waiver. */
1171
- entitled: boolean;
1172
- /** Backend usage state; only `available` can pass the eligibility gate. */
1173
- usage?: PerpsSubscriptionUsage;
1174
- /**
1175
- * Set by the backend once the notional cap is crossed. Honored on the next
1176
- * cache refresh — there is no client-held reservation to release.
1177
- */
1178
- exhausted?: boolean;
1179
- /** Notional (USD) still covered by the waiver, for fee previews. */
1180
- remainingNotionalUsd?: number;
1181
- };
1182
- };
1183
- /**
1184
- * Why the subscription fee waiver did or did not apply, plus the remaining
1185
- * allowance for fee previews. Derived purely from the cached benefits snapshot.
1186
- */
1187
- export type PerpsSubscriptionFeeWaiverStatus = {
1188
- /** True only when every condition of the eligibility gate passed. */
1189
- eligible: boolean;
1190
- /**
1191
- * Gate outcome:
1192
- * - `eligible` — every condition passed
1193
- * - `no-source` — no subscription dependency is wired
1194
- * - `not-hydrated` — nothing cached yet; a refresh was kicked off
1195
- * - `stale` — the cached snapshot is past the hard-stale ceiling
1196
- * - `no-subscription` — the read succeeded but reported no subscription at
1197
- * all (signed out, or no profile)
1198
- * - `inactive` — subscription status is not `active`
1199
- * - `not-entitled` — the plan does not include the perps fee waiver
1200
- * - `exhausted` — the backend reported the notional cap as spent
1201
- */
1202
- reason: 'eligible' | 'no-source' | 'not-hydrated' | 'stale' | 'no-subscription' | 'inactive' | 'not-entitled' | 'exhausted';
1203
- /** Notional (USD) still covered by the waiver, when the backend reports it. */
1204
- remainingNotionalUsd?: number;
1205
- };
1206
- /**
1207
- * Fee source that won the unified resolver.
1208
- *
1209
- * `rewards` covers both VIP and season discounts: `RewardsController` already
1210
- * returns the better of the two as a single discount, so the perps controller
1211
- * treats them as one source rather than re-deriving the split.
1212
- */
1213
- export type PerpsFeeSource = 'default' | 'rewards' | 'subscription';
1214
- /**
1215
- * Outcome of the unified fee resolver.
1216
- */
1217
- export type PerpsFeeResolution = {
1218
- /** Winning MetaMask builder fee, in basis points (lowest across sources). */
1219
- feeBips: number;
1220
- /**
1221
- * Winning fee expressed as a discount off the default builder fee, in basis
1222
- * points — the unit providers consume. `undefined` when no source resolved
1223
- * (e.g. rewards state has not hydrated and no subscription waiver applies),
1224
- * so callers do not treat it as a definitive "no discount" answer.
1225
- */
1226
- discountBips: number | undefined;
1227
- /** Source that produced the winning fee. */
1228
- source: PerpsFeeSource;
1229
- /** Subscription gate outcome, always populated for observability. */
1230
- subscription: PerpsSubscriptionFeeWaiverStatus;
1231
- };
1232
- export type UpdatePositionTPSLParams = {
1233
- symbol: string;
1234
- takeProfitPrice?: string;
1235
- stopLossPrice?: string;
1236
- takeProfitSize?: string;
1237
- stopLossSize?: string;
1238
- trackingData?: TPSLTrackingData;
1239
- providerId?: PerpsProviderType;
1240
- /**
1241
- * Optional live position data from WebSocket.
1242
- * If provided, skips the REST API position fetch (avoids rate limiting issues).
1243
- * If not provided, falls back to fetching positions via REST API.
1244
- */
1245
- position?: Position;
1246
- };
1247
- export type Order = {
1248
- orderId: string;
1249
- symbol: string;
1250
- side: 'buy' | 'sell';
1251
- orderType: OrderType;
1252
- size: string;
1253
- originalSize: string;
1254
- price: string;
1255
- filledSize: string;
1256
- remainingSize: string;
1257
- status: 'open' | 'filled' | 'canceled' | 'rejected' | 'triggered' | 'queued';
1258
- timestamp: number;
1259
- lastUpdated?: number;
1260
- takeProfitPrice?: string;
1261
- stopLossPrice?: string;
1262
- stopLossOrderId?: string;
1263
- takeProfitOrderId?: string;
1264
- detailedOrderType?: string;
1265
- isTrigger?: boolean;
1266
- triggerOrderType?: TriggerOrderType;
1267
- reduceOnly?: boolean;
1268
- isPositionTpsl?: boolean;
1269
- parentOrderId?: string;
1270
- isSynthetic?: boolean;
1271
- triggerPrice?: string;
1272
- strategyGroupId?: string;
1273
- providerId?: PerpsProviderType;
1274
- };
1275
- export type Funding = {
1276
- symbol: string;
1277
- amountUsd: string;
1278
- rate?: string;
1279
- timestamp: number;
1280
- transactionHash?: string;
1281
- };
1282
- export type PerpsProvider = {
1283
- readonly protocolId: string;
1284
- /** Whether this provider routes individual requests by `providerId`. */
1285
- readonly routesOrdersByProviderId?: boolean;
1286
- /**
1287
- * Return strategy capabilities for the provider/market route. Providers may
1288
- * omit this hook; the controller then reports capabilities as unavailable.
1289
- */
1290
- getOrderCapabilities?(params: GetOrderCapabilitiesParams): Promise<PerpsOrderCapabilities>;
1291
- getDepositRoutes(params?: GetSupportedPathsParams): AssetRoute[];
1292
- getWithdrawalRoutes(params?: GetSupportedPathsParams): AssetRoute[];
1293
- placeOrder(params: OrderParams): Promise<OrderResult>;
1294
- editOrder(params: EditOrderParams): Promise<OrderResult>;
1295
- cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;
1296
- cancelOrders?(params: BatchCancelOrdersParams): Promise<CancelOrdersResult>;
1297
- getTwapOrders?(): Promise<TwapOrder[]>;
1298
- getChaseOrders?(): Promise<ChaseOrder[]>;
1299
- suspendChaseOrders?(): Promise<ChaseOrder[]>;
1300
- closePosition(params: ClosePositionParams): Promise<OrderResult>;
1301
- closePositions?(params: ClosePositionsParams): Promise<ClosePositionsResult>;
1302
- updatePositionTPSL(params: UpdatePositionTPSLParams): Promise<OrderResult>;
1303
- updateMargin(params: UpdateMarginParams): Promise<MarginResult>;
1304
- getPositions(params?: GetPositionsParams): Promise<Position[]>;
1305
- getAccountState(params?: GetAccountStateParams): Promise<AccountState>;
1306
- getUserDataSnapshot?(params: GetUserDataSnapshotParams): Promise<PerpsUserDataSnapshot>;
1307
- getMarkets(params?: GetMarketsParams): Promise<MarketInfo[]>;
1308
- getMarketDataWithPrices(): Promise<PerpsMarketData[]>;
1309
- withdraw(params: WithdrawParams): Promise<WithdrawResult>;
1310
- validateDeposit(params: DepositParams): Promise<{
1311
- isValid: boolean;
1312
- error?: string;
1313
- }>;
1314
- validateOrder(params: OrderParams): Promise<{
1315
- isValid: boolean;
1316
- error?: string;
1317
- }>;
1318
- validateClosePosition(params: ClosePositionParams): Promise<{
1319
- isValid: boolean;
1320
- error?: string;
1321
- }>;
1322
- validateWithdrawal(params: WithdrawParams): Promise<{
1323
- isValid: boolean;
1324
- error?: string;
1325
- }>;
1326
- /**
1327
- * Historical trade fills - actual executed trades with exact prices and fees.
1328
- * Purpose: Track what actually happened when orders were executed.
1329
- * Example: Market long 1 ETH @ $50,000 → OrderFill with exact execution price and fees
1330
- */
1331
- getOrderFills(params?: GetOrderFillsParams, options?: PerpsReadOptions): Promise<OrderFill[]>;
1332
- /**
1333
- * Get fills using WebSocket cache first, falling back to REST API.
1334
- * OPTIMIZATION: Uses cached fills when available (0 API weight), only calls REST on cache miss.
1335
- * Purpose: Prevent 429 errors during rapid market switching by reusing cached fills.
1336
- *
1337
- * @param params - Optional filter parameters (startTime, symbol)
1338
- */
1339
- getOrFetchFills(params?: GetOrFetchFillsParams): Promise<OrderFill[]>;
1340
- /**
1341
- * Get historical portfolio data
1342
- * Purpose: Retrieve account value from previous periods for PnL tracking
1343
- * Example: Get account value from yesterday to calculate 24h percentage change
1344
- *
1345
- * @param params - Optional parameters for historical portfolio retrieval
1346
- */
1347
- getHistoricalPortfolio(params?: GetHistoricalPortfolioParams): Promise<HistoricalPortfolioResult>;
1348
- /**
1349
- * Historical order lifecycle - order placement, modifications, and status changes.
1350
- * Purpose: Track the complete journey of orders from request to completion.
1351
- * Example: Limit buy 1 ETH @ $48,000 → Order with status 'open' → 'filled' when executed
1352
- */
1353
- getOrders(params?: GetOrdersParams, options?: PerpsReadOptions): Promise<Order[]>;
1354
- /**
1355
- * Currently active open orders (real-time status).
1356
- * Purpose: Show orders that are currently open/pending execution (not historical states).
1357
- * Different from getOrders() which returns complete historical order lifecycle.
1358
- * Example: Shows only orders that are actually open right now in the exchange.
1359
- */
1360
- getOpenOrders(params?: GetOrdersParams): Promise<Order[]>;
1361
- /**
1362
- * Historical funding payments - periodic costs/rewards for holding positions.
1363
- * Purpose: Track ongoing expenses and income from position maintenance.
1364
- * Example: Holding long ETH position → Funding payment of -$5.00 (you pay the funding)
1365
- */
1366
- getFunding(params?: GetFundingParams, options?: PerpsReadOptions): Promise<Funding[]>;
1367
- /**
1368
- * Get user non-funding ledger updates (deposits, transfers, withdrawals)
1369
- */
1370
- getUserNonFundingLedgerUpdates(params?: {
1371
- accountId?: string;
1372
- startTime?: number;
1373
- endTime?: number;
1374
- }): Promise<RawLedgerUpdate[]>;
1375
- /**
1376
- * Resolve the provider's currently active account identifier.
1377
- * Used by the REST coalesce layer so cached payloads are account-scoped
1378
- * even when callers omit params.accountId (the common hook path) — prevents
1379
- * one account's data from being served after an account switch within
1380
- * the coalesce TTL window.
1381
- */
1382
- getCurrentAccountId(): Promise<CaipAccountId>;
1383
- /**
1384
- * Get user history (deposits, withdrawals, transfers)
1385
- */
1386
- getUserHistory(params?: {
1387
- accountId?: CaipAccountId;
1388
- startTime?: number;
1389
- endTime?: number;
1390
- }): Promise<UserHistoryItem[]>;
1391
- calculateLiquidationPrice(params: LiquidationPriceParams): Promise<string>;
1392
- calculateMaintenanceMargin(params: MaintenanceMarginParams): Promise<number>;
1393
- getMaxLeverage(asset: string): Promise<number>;
1394
- calculateFees(params: FeeCalculationParams): Promise<FeeCalculationResult>;
1395
- subscribeToPrices(params: SubscribePricesParams): () => void;
1396
- subscribeToPositions(params: SubscribePositionsParams): () => void;
1397
- subscribeToOrderFills(params: SubscribeOrderFillsParams): () => void;
1398
- subscribeToOrders(params: SubscribeOrdersParams): () => void;
1399
- subscribeToAccount(params: SubscribeAccountParams): () => void;
1400
- subscribeToOICaps(params: SubscribeOICapsParams): () => void;
1401
- subscribeToCandles(params: SubscribeCandlesParams): () => void;
1402
- subscribeToOrderBook(params: SubscribeOrderBookParams): () => void;
1403
- setLiveDataConfig(config: Partial<LiveDataConfig>): void;
1404
- toggleTestnet(): Promise<ToggleTestnetResult>;
1405
- initialize(): Promise<InitializeResult>;
1406
- isReadyToTrade(): Promise<ReadyToTradeResult>;
1407
- disconnect(): Promise<DisconnectResult>;
1408
- ping(timeoutMs?: number): Promise<void>;
1409
- getWebSocketConnectionState?(): WebSocketConnectionState;
1410
- subscribeToConnectionState?(listener: (state: WebSocketConnectionState, reconnectionAttempt: number) => void): () => void;
1411
- reconnect?(): Promise<void>;
1412
- getBlockExplorerUrl(address?: string): string;
1413
- setUserFeeDiscount?(discountBips: number | undefined): void;
1414
- setUserFeeResolution?(resolution: PerpsFeeResolution | undefined): void;
1415
- /** Approve the dedicated subscription builder outside order submission. */
1416
- approveSubscriptionBuilderFee?(): Promise<boolean>;
1417
- /**
1418
- * Get list of available HIP-3 builder-deployed DEXs
1419
- *
1420
- * @param params - Optional parameters (reserved for future filters/pagination)
1421
- * @returns Array of DEX names (empty string '' represents main DEX)
1422
- */
1423
- getAvailableDexs?(params?: GetAvailableDexsParams): Promise<string[]>;
1424
- /**
1425
- * Fetch historical OHLCV candle data for a symbol.
1426
- * Optional: only providers that support historical candles need to implement this.
1427
- */
1428
- fetchHistoricalCandles?(options: {
1429
- symbol: string;
1430
- interval: CandlePeriod;
1431
- limit?: number;
1432
- endTime?: number;
1433
- }): Promise<CandleData>;
1434
- };
1435
- /**
1436
- * Provider identifier type for multi-provider support.
1437
- * Add new providers here as they are implemented.
1438
- */
1439
- export type PerpsProviderType = 'hyperliquid' | 'myx';
1440
- /**
1441
- * Active provider mode for PerpsController state.
1442
- * - Direct providers: 'hyperliquid', 'myx'
1443
- * - 'aggregated': Multi-provider aggregation mode
1444
- */
1445
- export type PerpsActiveProviderMode = PerpsProviderType | 'aggregated';
1446
- /**
1447
- * Aggregation mode for read operations.
1448
- * - 'all': Aggregate data from all registered providers
1449
- * - 'active': Only aggregate from providers with active connections
1450
- * - 'specific': Aggregate from a specific subset of providers
1451
- */
1452
- export type AggregationMode = 'all' | 'active' | 'specific';
1453
- /**
1454
- * Routing strategy for write operations.
1455
- * Phase 1 only supports 'default_provider' - advanced strategies deferred to Phase 3.
1456
- */
1457
- export type RoutingStrategy = 'default_provider';
1458
- /**
1459
- * Configuration for AggregatedPerpsProvider
1460
- */
1461
- export type AggregatedProviderConfig = {
1462
- /** Map of provider ID to provider instance */
1463
- providers: Map<PerpsProviderType, PerpsProvider>;
1464
- /** Default provider for write operations when providerId not specified */
1465
- defaultProvider: PerpsProviderType;
1466
- /** Aggregation mode for read operations (default: 'all') */
1467
- aggregationMode?: AggregationMode;
1468
- /** Platform dependencies for logging, metrics, etc. */
1469
- infrastructure: PerpsPlatformDependencies;
1470
- };
1471
- /**
1472
- * Provider-specific error with context for multi-provider error handling
1473
- */
1474
- export type ProviderError = {
1475
- /** Which provider the error originated from */
1476
- providerId: PerpsProviderType;
1477
- /** Human-readable error message */
1478
- message: string;
1479
- /** Original error object if available */
1480
- originalError?: Error;
1481
- /** Whether the operation can be retried */
1482
- isRetryable?: boolean;
1483
- };
1484
- /**
1485
- * Aggregated account state combining data from multiple providers
1486
- */
1487
- export type AggregatedAccountState = {
1488
- /** Combined totals across all providers */
1489
- total: AccountState;
1490
- /** Per-provider breakdown */
1491
- byProvider: Map<PerpsProviderType, AccountState>;
1492
- };
1493
- /**
1494
- * Injectable logger interface for error reporting.
1495
- * Allows core package to be platform-agnostic (mobile: Sentry, extension: different impl)
1496
- */
1497
- export type PerpsLogger = {
1498
- error(error: Error, options?: {
1499
- tags?: Record<string, string | number>;
1500
- context?: {
1501
- name: string;
1502
- data: Record<string, unknown>;
1503
- };
1504
- extras?: Record<string, unknown>;
1505
- }): void;
1506
- };
1507
- /**
1508
- * Analytics events specific to Perps feature.
1509
- * These are the actual event names sent to analytics backend.
1510
- * Values must match the corresponding MetaMetricsEvents values in mobile for compatibility.
1511
- *
1512
- * When migrating to core monorepo, this enum travels with PerpsController.
1513
- */
1514
- export declare enum PerpsAnalyticsEvent {
1515
- WithdrawalTransaction = "Perp Withdrawal Transaction",
1516
- TradeTransaction = "Perp Trade Transaction",
1517
- PositionCloseTransaction = "Perp Position Close Transaction",
1518
- OrderCancelTransaction = "Perp Order Cancel Transaction",
1519
- ScreenViewed = "Perp Screen Viewed",
1520
- UiInteraction = "Perp UI Interaction",
1521
- RiskManagement = "Perp Risk Management",
1522
- PerpsError = "Perp Error",
1523
- AccountSetup = "Perp Account Setup",
1524
- TransactionConsidered = "Perp Transaction Considered",
1525
- TradeQuoteReceived = "Perp Trade Quote Received",
1526
- SearchQuery = "Perp Search Query",
1527
- SearchResultTapped = "Perp Search Result Tapped",
1528
- SearchAbandoned = "Perp Search Abandoned"
1529
- }
1530
- /**
1531
- * UTM / discovery attribution context for Perps analytics.
1532
- *
1533
- * Held transiently in-memory by PerpsController (never persisted in state) and
1534
- * merged into analytics event properties so client-originated UTM attribution
1535
- * can be propagated onto core-emitted transaction events.
1536
- */
1537
- export type PerpsAttributionContext = {
1538
- utmSource?: string;
1539
- utmMedium?: string;
1540
- utmCampaign?: string;
1541
- utmContent?: string;
1542
- utmTerm?: string;
1543
- };
1544
- /**
1545
- * Perps-specific trace names. These must match TraceName enum values in mobile.
1546
- * When in core monorepo, this defines the valid trace names for Perps operations.
1547
- */
1548
- export type PerpsTraceName = 'Perps Open Position' | 'Perps Close Position' | 'Perps Deposit' | 'Perps Withdraw' | 'Perps Place Order' | 'Perps Edit Order' | 'Perps Cancel Order' | 'Perps Update TP/SL' | 'Perps Update Margin' | 'Perps Flip Position' | 'Perps Market Data Update' | 'Perps Order View' | 'Perps Tab View' | 'Perps Market List View' | 'Perps Position Details View' | 'Perps Adjust Margin View' | 'Perps Order Details View' | 'Perps Order Book View' | 'Perps Flip Position Sheet' | 'Perps Transactions View' | 'Perps Order Fills Fetch' | 'Perps Orders Fetch' | 'Perps Funding Fetch' | 'Perps Get Positions' | 'Perps Get Account State' | 'Perps Get Historical Portfolio' | 'Perps Get Markets' | 'Perps Get Market Data With Prices' | 'Perps Fetch Historical Candles' | 'Perps WebSocket Connected' | 'Perps WebSocket Disconnected' | 'Perps WebSocket First Positions' | 'Perps WebSocket First Orders' | 'Perps WebSocket First Account' | 'Perps Data Lake Report' | 'Perps Rewards API Call' | 'Perps Close Position View' | 'Perps Withdraw View' | 'Perps Connection Establishment' | 'Perps Account Switch Reconnection' | 'Perps Market Data Preload' | 'Perps User Data Preload';
1549
- /**
1550
- * Perps trace name constants. Values match TraceName enum in mobile.
1551
- * When in core, these ARE the source of truth - mobile will re-export from core.
1552
- */
1553
- export declare const PerpsTraceNames: {
1554
- readonly PlaceOrder: "Perps Place Order";
1555
- readonly EditOrder: "Perps Edit Order";
1556
- readonly CancelOrder: "Perps Cancel Order";
1557
- readonly ClosePosition: "Perps Close Position";
1558
- readonly UpdateTpsl: "Perps Update TP/SL";
1559
- readonly UpdateMargin: "Perps Update Margin";
1560
- readonly FlipPosition: "Perps Flip Position";
1561
- readonly Withdraw: "Perps Withdraw";
1562
- readonly Deposit: "Perps Deposit";
1563
- readonly GetPositions: "Perps Get Positions";
1564
- readonly GetAccountState: "Perps Get Account State";
1565
- readonly GetMarkets: "Perps Get Markets";
1566
- readonly GetMarketDataWithPrices: "Perps Get Market Data With Prices";
1567
- readonly OrderFillsFetch: "Perps Order Fills Fetch";
1568
- readonly OrdersFetch: "Perps Orders Fetch";
1569
- readonly FundingFetch: "Perps Funding Fetch";
1570
- readonly GetHistoricalPortfolio: "Perps Get Historical Portfolio";
1571
- readonly FetchHistoricalCandles: "Perps Fetch Historical Candles";
1572
- readonly DataLakeReport: "Perps Data Lake Report";
1573
- readonly WebsocketConnected: "Perps WebSocket Connected";
1574
- readonly WebsocketDisconnected: "Perps WebSocket Disconnected";
1575
- readonly WebsocketFirstPositions: "Perps WebSocket First Positions";
1576
- readonly WebsocketFirstOrders: "Perps WebSocket First Orders";
1577
- readonly WebsocketFirstAccount: "Perps WebSocket First Account";
1578
- readonly RewardsApiCall: "Perps Rewards API Call";
1579
- readonly ConnectionEstablishment: "Perps Connection Establishment";
1580
- readonly AccountSwitchReconnection: "Perps Account Switch Reconnection";
1581
- readonly MarketDataPreload: "Perps Market Data Preload";
1582
- readonly UserDataPreload: "Perps User Data Preload";
1583
- };
1584
- /**
1585
- * Perps trace operation constants. Values match TraceOperation enum in mobile.
1586
- * These categorize traces by type of operation for Sentry/observability filtering.
1587
- */
1588
- export declare const PerpsTraceOperations: {
1589
- readonly Operation: "perps.operation";
1590
- readonly OrderSubmission: "perps.order_submission";
1591
- readonly PositionManagement: "perps.position_management";
1592
- readonly MarketData: "perps.market_data";
1593
- };
1594
- /**
1595
- * Values allowed in trace data/tags. Matches Sentry's TraceValue type.
1596
- */
1597
- export type PerpsTraceValue = string | number | boolean;
1598
- /**
1599
- * Properties allowed in analytics events. More constrained than unknown.
1600
- * Named PerpsAnalyticsProperties to avoid conflict with PERPS_EVENT_PROPERTY
1601
- * constant object from eventNames.ts (which contains property key names).
1602
- */
1603
- export type PerpsAnalyticsProperties = Record<string, string | number | boolean | Record<string, string> | null | undefined>;
1604
- /**
1605
- * Injectable metrics interface for analytics.
1606
- * Allows core package to work with different analytics backends.
1607
- */
1608
- export type PerpsMetrics = {
1609
- isEnabled(): boolean;
1610
- /**
1611
- * Track a Perps-specific analytics event with properties.
1612
- * This abstracts away the MetricsEventBuilder pattern used in mobile.
1613
- *
1614
- * @param event - The Perps analytics event type (enum with actual event name values)
1615
- * @param properties - Type-safe key-value properties to attach to the event
1616
- */
1617
- trackPerpsEvent(event: PerpsAnalyticsEvent, properties: PerpsAnalyticsProperties): void;
1618
- };
1619
- /**
1620
- * Injectable debug logger for development logging.
1621
- * Only logs in development mode.
1622
- * Accepts `unknown` to allow logging error objects from catch blocks.
1623
- */
1624
- export type PerpsDebugLogger = {
1625
- log(...args: unknown[]): void;
1626
- };
1627
- /**
1628
- * Injectable stream manager interface for pause/resume during critical operations.
1629
- *
1630
- * WHY THIS IS NEEDED:
1631
- * PerpsStreamManager is a React-based mobile-specific singleton that:
1632
- * - Uses React Context for subscription management
1633
- * - Uses react-native-performance for tracing
1634
- * - Directly accesses Engine.context (mobile singleton pattern)
1635
- * - Manages WebSocket connections with throttling/caching
1636
- *
1637
- * PerpsController only needs pause/resume during critical operations (withStreamPause method)
1638
- * to prevent stale UI updates during batch operations. The minimal interface allows:
1639
- * - Mobile: Wrap existing singleton (streamManager[channel].pause())
1640
- * - Extension: Implement with whatever streaming solution they use
1641
- */
1642
- /**
1643
- * Injectable stream manager interface for pause/resume during critical operations.
1644
- *
1645
- * WHY THIS IS NEEDED:
1646
- * PerpsStreamManager is a React-based mobile-specific singleton that:
1647
- * - Uses React Context for subscription management
1648
- * - Uses react-native-performance for tracing
1649
- * - Directly accesses Engine.context (mobile singleton pattern)
1650
- * - Manages WebSocket connections with throttling/caching
1651
- *
1652
- * PerpsController only needs pause/resume during critical operations (withStreamPause method)
1653
- * to prevent stale UI updates during batch operations. The minimal interface allows:
1654
- * - Mobile: Wrap existing singleton (streamManager[channel].pause())
1655
- * - Extension: Implement with whatever streaming solution they use
1656
- */
1657
- export type PerpsStreamManager = {
1658
- pauseChannel(channel: string): void;
1659
- resumeChannel(channel: string): void;
1660
- clearAllChannels(): void;
1661
- };
1662
- /**
1663
- * Injectable performance monitor interface.
1664
- * Wraps react-native-performance or browser Performance API.
1665
- */
1666
- export type PerpsPerformance = {
1667
- now(): number;
1668
- /**
1669
- * Optional platform hook invoked once after constructor disk hydration.
1670
- * Receives `performance.now()` — not a Sentry write.
1671
- */
1672
- onControllerConstructed?: (monotonicMs: number) => void;
1673
- };
1674
- type PerpsSetMeasurement = ((name: string, value: number, unit: string) => void) & ((name: string, value: number, unit: string, id: string) => void);
1675
- /**
1676
- * Injectable tracer interface for Sentry/observability tracing.
1677
- * Services use this to create spans and measure operation durations.
1678
- *
1679
- * Note: trace() returns void because services use name/id pairs to identify traces.
1680
- * The actual span management is handled internally by the platform adapter.
1681
- */
1682
- export type PerpsTracer = {
1683
- trace(params: {
1684
- name: PerpsTraceName;
1685
- id: string;
1686
- op: string;
1687
- tags?: Record<string, PerpsTraceValue>;
1688
- data?: Record<string, PerpsTraceValue>;
1689
- }): void;
1690
- endTrace(params: {
1691
- name: PerpsTraceName;
1692
- id: string;
1693
- data?: Record<string, PerpsTraceValue>;
1694
- }): void;
1695
- setMeasurement: PerpsSetMeasurement;
1696
- addBreadcrumb(breadcrumb: {
1697
- category: string;
1698
- message: string;
1699
- level: 'fatal' | 'error' | 'warning' | 'log' | 'info' | 'debug';
1700
- data?: Record<string, unknown>;
1701
- }): void;
1702
- };
1703
- /**
1704
- * Minimal typed-message params passed to keyring for EIP-712 signing.
1705
- * Structurally matches KeyringController's TypedMessageParams.
1706
- */
1707
- export type PerpsTypedMessageParams = {
1708
- from: string;
1709
- data: unknown;
1710
- };
1711
- /**
1712
- * Minimal transaction params passed to TransactionController.addTransaction.
1713
- * Only the fields PerpsController actually sets.
1714
- */
1715
- export type PerpsTransactionParams = {
1716
- from: string;
1717
- to?: string;
1718
- value?: string;
1719
- data?: string;
1720
- gas?: string;
1721
- };
1722
- /**
1723
- * Options passed to TransactionController.addTransaction.
1724
- */
1725
- export type PerpsAddTransactionOptions = {
1726
- networkClientId: string;
1727
- origin?: string;
1728
- type?: string;
1729
- skipInitialGasEstimate?: boolean;
1730
- };
1731
- /**
1732
- * Minimal account shape read from AccountTreeController.
1733
- * Only the fields PerpsController and its services actually use.
1734
- */
1735
- export type PerpsInternalAccount = {
1736
- address: string;
1737
- type: string;
1738
- id: string;
1739
- };
1740
- /**
1741
- * Minimal remote feature flag state shape.
1742
- * Only the remoteFeatureFlags record is needed by PerpsController.
1743
- */
1744
- export type PerpsRemoteFeatureFlagState = {
1745
- remoteFeatureFlags: Record<string, unknown>;
1746
- };
1747
- /**
1748
- * Injectable interface for the Terminal-market service.
1749
- *
1750
- * `MarketDataService` programs against this contract so the concrete
1751
- * `TerminalMarketService` class (which lives in `services/`) never leaks
1752
- * into the types barrel — callers can supply any implementation that
1753
- * satisfies the shape (production, stub, mock, etc.).
1754
- */
1755
- export type PerpsTerminalMarketService = {
1756
- fetchMarkets(): Promise<{
1757
- markets: MarketInfo[];
1758
- metadata: Map<string, TerminalAssetMetadata>;
1759
- }>;
1760
- clearCache(): void;
1761
- logError(error: unknown, method: string): void;
1762
- fetchGlobalSnapshot?(request: PerpsGlobalSnapshotRequest): Promise<PerpsGlobalSnapshotResult>;
1763
- };
1764
- /** Exact identity a client expects from an atomic global Perps snapshot. */
1765
- export type PerpsGlobalSnapshotRequest = {
1766
- provider: 'hyperliquid';
1767
- network: 'mainnet' | 'testnet';
1768
- enabledDexes: string[];
1769
- };
1770
- /** Validated snapshot data and its source-bounded expiry. */
1771
- export type PerpsGlobalSnapshotResult = {
1772
- markets: PerpsMarketData[];
1773
- expiresAt: number;
1774
- };
1775
- /**
1776
- * Platform dependencies for PerpsController and services.
1777
- *
1778
- * Architecture:
1779
- * - Observability: logger, debugLogger, metrics, performance, tracer
1780
- * - Platform: streamManager (mobile/extension specific)
1781
- * - Cache: cache invalidation for standalone queries
1782
- * - Rewards: delegated rewards interaction (DI — no RewardsController in Core yet)
1783
- *
1784
- * Cross-controller communication uses the messenger pattern (messenger.call).
1785
- * Only rewards remains as DI because RewardsController is not yet in Core.
1786
- */
1787
- export type PerpsPlatformDependencies = {
1788
- logger: PerpsLogger;
1789
- debugLogger: PerpsDebugLogger;
1790
- metrics: PerpsMetrics;
1791
- performance: PerpsPerformance;
1792
- tracer: PerpsTracer;
1793
- streamManager: PerpsStreamManager;
1794
- featureFlags: {
1795
- /**
1796
- * Validate a version-gated feature flag against current app version.
1797
- * Returns true if flag is enabled AND app meets minimum version,
1798
- * false if flag is disabled, or undefined if flag is misconfigured/overridden.
1799
- *
1800
- * Platform-specific because it uses react-native-device-info (mobile)
1801
- * or browser APIs (extension) to get the app version.
1802
- */
1803
- validateVersionGated(flag: VersionGatedFeatureFlag): boolean | undefined;
1804
- };
1805
- marketDataFormatters: MarketDataFormatters;
1806
- cacheInvalidator: PerpsCacheInvalidator;
1807
- diskCache: {
1808
- getItem(key: string): Promise<string | null>;
1809
- getItemSync?(key: string): string | null;
1810
- setItem(key: string, value: string): Promise<void>;
1811
- removeItem(key: string): Promise<void>;
1812
- };
1813
- terminalApi?: {
1814
- /** Full endpoint URL for the legacy perpetuals market-data endpoint. */
1815
- marketDataUrl?: string;
1816
- /** Full endpoint URL for the schema-v2 atomic global Perps snapshot. */
1817
- globalSnapshotUrl?: string;
1818
- };
1819
- /** @deprecated Use `terminalApi.marketDataUrl`. */
1820
- terminalApiUrl?: string;
1821
- /**
1822
- * Optional Terminal-market service instance for fetching structured market
1823
- * metadata from the MetaMask Terminal API.
1824
- *
1825
- * When provided, `MarketDataService` uses this service to attempt the
1826
- * Terminal API path before falling back to the provider.
1827
- * Clients that do not use the Terminal API can omit this field.
1828
- */
1829
- terminalMarketService?: PerpsTerminalMarketService;
1830
- rewards: {
1831
- /**
1832
- * Get fee discount for an account from the RewardsController.
1833
- * Returns discount in basis points (e.g., 6500 = 65% discount), or null
1834
- * when subscription state hasn't hydrated yet — callers should skip
1835
- * caching null results and retry on the next fee calculation.
1836
- *
1837
- * Pass the perps MetaMask builder base fee in bips so the rewards
1838
- * controller can convert an absolute VIP fee into a discount fraction.
1839
- */
1840
- getPerpsDiscountForAccount(caipAccountId: `${string}:${string}:${string}`, baseFeeBips: number): Promise<number | null>;
1841
- };
1842
- /**
1843
- * Optional subscription source for the unified fee resolver.
1844
- *
1845
- * The client owns the Profile JWT, so it performs
1846
- * `GET /v1/profiles/{profileId}/benefits` and hands the perps controller the
1847
- * parsed body. The controller caches the result stale-while-revalidate and
1848
- * never awaits this call on the order-signing path.
1849
- *
1850
- * Omit it entirely on clients that do not ship the subscription waiver; the
1851
- * resolver then falls back to the rewards and default sources.
1852
- */
1853
- subscription?: {
1854
- /**
1855
- * Read the current profile's subscription benefits.
1856
- * Resolve `null` when there is no subscription to report (signed out, no
1857
- * profile). Rejections are tolerated: the resolver keeps the previous
1858
- * snapshot and never grants the waiver from a failed read.
1859
- */
1860
- getPerpsBenefits(): Promise<PerpsSubscriptionBenefits | null>;
1861
- };
1862
- };
1863
- /**
1864
- * Cache types that can be invalidated.
1865
- * Used by standalone query caches (e.g., usePerpsPositionForAsset).
1866
- */
1867
- export type PerpsCacheType = 'positions' | 'accountState' | 'markets';
1868
- /**
1869
- * Parameters for invalidating a specific cache type.
1870
- */
1871
- export type InvalidateCacheParams = {
1872
- /** The type of cache to invalidate */
1873
- cacheType: PerpsCacheType;
1874
- };
1875
- /**
1876
- * Cache invalidation interface for standalone query caches.
1877
- * Allows services to signal when data has changed without depending on
1878
- * mobile-specific implementations.
1879
- */
1880
- export type PerpsCacheInvalidator = {
1881
- /**
1882
- * Invalidate a specific cache type.
1883
- * Notifies all subscribers that cached data is stale.
1884
- */
1885
- invalidate(params: InvalidateCacheParams): void;
1886
- /**
1887
- * Invalidate all cache types.
1888
- */
1889
- invalidateAll(): void;
1890
- };
1891
- /**
1892
- * Injectable formatters for market data transformation.
1893
- * Decouples marketDataTransform from mobile-specific intl/formatUtils imports.
1894
- *
1895
- * Range configs are opaque (unknown[]) because the concrete type
1896
- * (FiatRangeConfig on mobile) is platform-specific. The formatter
1897
- * implementation casts internally.
1898
- */
1899
- export type MarketDataFormatters = {
1900
- /** Format a number as a USD volume string (e.g., '$1.2B', '$850M') */
1901
- formatVolume(value: number): string;
1902
- /** Format a number as a USD fiat string with adaptive precision */
1903
- formatPerpsFiat(value: number, options?: {
1904
- ranges?: unknown[];
1905
- }): string;
1906
- /** Format a number as a percentage string (e.g., '2.50%', '-1.80%') */
1907
- formatPercentage(percent: number): string;
1908
- /** Universal price ranges for formatting (opaque to portable code) */
1909
- priceRangesUniversal: unknown[];
1910
- };
1911
- /**
1912
- * Minimal payment token for deposit flow.
1913
- * Only the fields actually used by PerpsController are included.
1914
- * Replaces the mobile-only AssetType (which extends TokenI and uses ImageSourcePropType).
1915
- */
1916
- export type PaymentToken = {
1917
- description?: string;
1918
- address: string;
1919
- chainId?: string;
1920
- symbol?: string;
1921
- };
1922
- /**
1923
- * Selected pay-with token shape used in PerpsController state, pending trade config,
1924
- * selectors, and UI hooks. Use this type everywhere this shape is needed.
1925
- */
1926
- export type PerpsSelectedPaymentToken = {
1927
- description?: string;
1928
- address: string;
1929
- chainId: string;
1930
- symbol?: string;
1931
- };
1932
- /**
1933
- * Structure for a version-gated feature flag from LaunchDarkly.
1934
- * Portable: no platform-specific imports.
1935
- */
1936
- export type VersionGatedFeatureFlag = {
1937
- enabled: boolean;
1938
- minimumVersion: string;
1939
- };
1940
- /**
1941
- * Type guard for VersionGatedFeatureFlag.
1942
- * Pure logic, no platform dependencies.
1943
- *
1944
- * @param value - The value to check.
1945
- * @returns True if the value is a VersionGatedFeatureFlag.
1946
- */
1947
- export declare function isVersionGatedFeatureFlag(value: unknown): value is VersionGatedFeatureFlag;
1948
- export type * from "./perps-types.mjs";
1949
- export * from "./transactionTypes.mjs";
1950
- export type { AssetPosition, SpotBalance, PerpsUniverse, PerpsAssetCtx, PredictedFunding, FrontendOrder, SDKOrderParams, ClearinghouseStateResponse, SpotClearinghouseStateResponse, MetaResponse, FrontendOpenOrdersResponse, AllMidsResponse, MetaAndAssetCtxsResponse, PredictedFundingsResponse, SpotMetaResponse, } from "./hyperliquid-types.mjs";
1951
- //# sourceMappingURL=index.d.mts.map