@metamask-previews/perps-controller 0.0.0-preview-b0148922a → 0.0.0-preview-ee1fa5d01

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (482) hide show
  1. package/CHANGELOG.md +0 -25
  2. package/dist/PerpsController.cjs +65 -3077
  3. package/dist/PerpsController.cjs.map +1 -1
  4. package/dist/PerpsController.d.cts +82 -969
  5. package/dist/PerpsController.d.cts.map +1 -1
  6. package/dist/PerpsController.d.mts +82 -969
  7. package/dist/PerpsController.d.mts.map +1 -1
  8. package/dist/PerpsController.mjs +62 -3073
  9. package/dist/PerpsController.mjs.map +1 -1
  10. package/dist/index.cjs +1 -63
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +2 -38
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.mts +2 -38
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +1 -46
  17. package/dist/index.mjs.map +1 -1
  18. package/package.json +2 -16
  19. package/dist/aggregation/SubscriptionMultiplexer.cjs +0 -441
  20. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +0 -1
  21. package/dist/aggregation/SubscriptionMultiplexer.d.cts +0 -171
  22. package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +0 -1
  23. package/dist/aggregation/SubscriptionMultiplexer.d.mts +0 -171
  24. package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +0 -1
  25. package/dist/aggregation/SubscriptionMultiplexer.mjs +0 -437
  26. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +0 -1
  27. package/dist/aggregation/index.cjs +0 -9
  28. package/dist/aggregation/index.cjs.map +0 -1
  29. package/dist/aggregation/index.d.cts +0 -6
  30. package/dist/aggregation/index.d.cts.map +0 -1
  31. package/dist/aggregation/index.d.mts +0 -6
  32. package/dist/aggregation/index.d.mts.map +0 -1
  33. package/dist/aggregation/index.mjs +0 -5
  34. package/dist/aggregation/index.mjs.map +0 -1
  35. package/dist/constants/chartConfig.cjs +0 -227
  36. package/dist/constants/chartConfig.cjs.map +0 -1
  37. package/dist/constants/chartConfig.d.cts +0 -216
  38. package/dist/constants/chartConfig.d.cts.map +0 -1
  39. package/dist/constants/chartConfig.d.mts +0 -216
  40. package/dist/constants/chartConfig.d.mts.map +0 -1
  41. package/dist/constants/chartConfig.mjs +0 -221
  42. package/dist/constants/chartConfig.mjs.map +0 -1
  43. package/dist/constants/eventNames.cjs +0 -436
  44. package/dist/constants/eventNames.cjs.map +0 -1
  45. package/dist/constants/eventNames.d.cts +0 -387
  46. package/dist/constants/eventNames.d.cts.map +0 -1
  47. package/dist/constants/eventNames.d.mts +0 -387
  48. package/dist/constants/eventNames.d.mts.map +0 -1
  49. package/dist/constants/eventNames.mjs +0 -433
  50. package/dist/constants/eventNames.mjs.map +0 -1
  51. package/dist/constants/hyperLiquidConfig.cjs +0 -380
  52. package/dist/constants/hyperLiquidConfig.cjs.map +0 -1
  53. package/dist/constants/hyperLiquidConfig.d.cts +0 -236
  54. package/dist/constants/hyperLiquidConfig.d.cts.map +0 -1
  55. package/dist/constants/hyperLiquidConfig.d.mts +0 -236
  56. package/dist/constants/hyperLiquidConfig.d.mts.map +0 -1
  57. package/dist/constants/hyperLiquidConfig.mjs +0 -371
  58. package/dist/constants/hyperLiquidConfig.mjs.map +0 -1
  59. package/dist/constants/index.cjs +0 -28
  60. package/dist/constants/index.cjs.map +0 -1
  61. package/dist/constants/index.d.cts +0 -12
  62. package/dist/constants/index.d.cts.map +0 -1
  63. package/dist/constants/index.d.mts +0 -12
  64. package/dist/constants/index.d.mts.map +0 -1
  65. package/dist/constants/index.mjs +0 -12
  66. package/dist/constants/index.mjs.map +0 -1
  67. package/dist/constants/myxConfig.cjs +0 -229
  68. package/dist/constants/myxConfig.cjs.map +0 -1
  69. package/dist/constants/myxConfig.d.cts +0 -106
  70. package/dist/constants/myxConfig.d.cts.map +0 -1
  71. package/dist/constants/myxConfig.d.mts +0 -106
  72. package/dist/constants/myxConfig.d.mts.map +0 -1
  73. package/dist/constants/myxConfig.mjs +0 -219
  74. package/dist/constants/myxConfig.mjs.map +0 -1
  75. package/dist/constants/orderTypes.cjs +0 -31
  76. package/dist/constants/orderTypes.cjs.map +0 -1
  77. package/dist/constants/orderTypes.d.cts +0 -19
  78. package/dist/constants/orderTypes.d.cts.map +0 -1
  79. package/dist/constants/orderTypes.d.mts +0 -19
  80. package/dist/constants/orderTypes.d.mts.map +0 -1
  81. package/dist/constants/orderTypes.mjs +0 -27
  82. package/dist/constants/orderTypes.mjs.map +0 -1
  83. package/dist/constants/performanceMetrics.cjs +0 -63
  84. package/dist/constants/performanceMetrics.cjs.map +0 -1
  85. package/dist/constants/performanceMetrics.d.cts +0 -46
  86. package/dist/constants/performanceMetrics.d.cts.map +0 -1
  87. package/dist/constants/performanceMetrics.d.mts +0 -46
  88. package/dist/constants/performanceMetrics.d.mts.map +0 -1
  89. package/dist/constants/performanceMetrics.mjs +0 -60
  90. package/dist/constants/performanceMetrics.mjs.map +0 -1
  91. package/dist/constants/perpsConfig.cjs +0 -295
  92. package/dist/constants/perpsConfig.cjs.map +0 -1
  93. package/dist/constants/perpsConfig.d.cts +0 -221
  94. package/dist/constants/perpsConfig.d.cts.map +0 -1
  95. package/dist/constants/perpsConfig.d.mts +0 -221
  96. package/dist/constants/perpsConfig.d.mts.map +0 -1
  97. package/dist/constants/perpsConfig.mjs +0 -292
  98. package/dist/constants/perpsConfig.mjs.map +0 -1
  99. package/dist/constants/transactionsHistoryConfig.cjs +0 -19
  100. package/dist/constants/transactionsHistoryConfig.cjs.map +0 -1
  101. package/dist/constants/transactionsHistoryConfig.d.cts +0 -16
  102. package/dist/constants/transactionsHistoryConfig.d.cts.map +0 -1
  103. package/dist/constants/transactionsHistoryConfig.d.mts +0 -16
  104. package/dist/constants/transactionsHistoryConfig.d.mts.map +0 -1
  105. package/dist/constants/transactionsHistoryConfig.mjs +0 -16
  106. package/dist/constants/transactionsHistoryConfig.mjs.map +0 -1
  107. package/dist/perpsErrorCodes.cjs +0 -80
  108. package/dist/perpsErrorCodes.cjs.map +0 -1
  109. package/dist/perpsErrorCodes.d.cts +0 -65
  110. package/dist/perpsErrorCodes.d.cts.map +0 -1
  111. package/dist/perpsErrorCodes.d.mts +0 -65
  112. package/dist/perpsErrorCodes.d.mts.map +0 -1
  113. package/dist/perpsErrorCodes.mjs +0 -77
  114. package/dist/perpsErrorCodes.mjs.map +0 -1
  115. package/dist/providers/AggregatedPerpsProvider.cjs +0 -508
  116. package/dist/providers/AggregatedPerpsProvider.cjs.map +0 -1
  117. package/dist/providers/AggregatedPerpsProvider.d.cts +0 -171
  118. package/dist/providers/AggregatedPerpsProvider.d.cts.map +0 -1
  119. package/dist/providers/AggregatedPerpsProvider.d.mts +0 -171
  120. package/dist/providers/AggregatedPerpsProvider.d.mts.map +0 -1
  121. package/dist/providers/AggregatedPerpsProvider.mjs +0 -504
  122. package/dist/providers/AggregatedPerpsProvider.mjs.map +0 -1
  123. package/dist/providers/HyperLiquidProvider.cjs +0 -5679
  124. package/dist/providers/HyperLiquidProvider.cjs.map +0 -1
  125. package/dist/providers/HyperLiquidProvider.d.cts +0 -516
  126. package/dist/providers/HyperLiquidProvider.d.cts.map +0 -1
  127. package/dist/providers/HyperLiquidProvider.d.mts +0 -516
  128. package/dist/providers/HyperLiquidProvider.d.mts.map +0 -1
  129. package/dist/providers/HyperLiquidProvider.mjs +0 -5675
  130. package/dist/providers/HyperLiquidProvider.mjs.map +0 -1
  131. package/dist/providers/MYXProvider.cjs +0 -514
  132. package/dist/providers/MYXProvider.cjs.map +0 -1
  133. package/dist/providers/MYXProvider.d.cts +0 -105
  134. package/dist/providers/MYXProvider.d.cts.map +0 -1
  135. package/dist/providers/MYXProvider.d.mts +0 -105
  136. package/dist/providers/MYXProvider.d.mts.map +0 -1
  137. package/dist/providers/MYXProvider.mjs +0 -510
  138. package/dist/providers/MYXProvider.mjs.map +0 -1
  139. package/dist/routing/ProviderRouter.cjs +0 -154
  140. package/dist/routing/ProviderRouter.cjs.map +0 -1
  141. package/dist/routing/ProviderRouter.d.cts +0 -112
  142. package/dist/routing/ProviderRouter.d.cts.map +0 -1
  143. package/dist/routing/ProviderRouter.d.mts +0 -112
  144. package/dist/routing/ProviderRouter.d.mts.map +0 -1
  145. package/dist/routing/ProviderRouter.mjs +0 -150
  146. package/dist/routing/ProviderRouter.mjs.map +0 -1
  147. package/dist/routing/index.cjs +0 -9
  148. package/dist/routing/index.cjs.map +0 -1
  149. package/dist/routing/index.d.cts +0 -6
  150. package/dist/routing/index.d.cts.map +0 -1
  151. package/dist/routing/index.d.mts +0 -6
  152. package/dist/routing/index.d.mts.map +0 -1
  153. package/dist/routing/index.mjs +0 -5
  154. package/dist/routing/index.mjs.map +0 -1
  155. package/dist/selectors.cjs +0 -166
  156. package/dist/selectors.cjs.map +0 -1
  157. package/dist/selectors.d.cts +0 -362
  158. package/dist/selectors.d.cts.map +0 -1
  159. package/dist/selectors.d.mts +0 -362
  160. package/dist/selectors.d.mts.map +0 -1
  161. package/dist/selectors.mjs +0 -158
  162. package/dist/selectors.mjs.map +0 -1
  163. package/dist/services/AccountService.cjs +0 -324
  164. package/dist/services/AccountService.cjs.map +0 -1
  165. package/dist/services/AccountService.d.cts +0 -56
  166. package/dist/services/AccountService.d.cts.map +0 -1
  167. package/dist/services/AccountService.d.mts +0 -56
  168. package/dist/services/AccountService.d.mts.map +0 -1
  169. package/dist/services/AccountService.mjs +0 -320
  170. package/dist/services/AccountService.mjs.map +0 -1
  171. package/dist/services/DataLakeService.cjs +0 -233
  172. package/dist/services/DataLakeService.cjs.map +0 -1
  173. package/dist/services/DataLakeService.d.cts +0 -51
  174. package/dist/services/DataLakeService.d.cts.map +0 -1
  175. package/dist/services/DataLakeService.d.mts +0 -51
  176. package/dist/services/DataLakeService.d.mts.map +0 -1
  177. package/dist/services/DataLakeService.mjs +0 -229
  178. package/dist/services/DataLakeService.mjs.map +0 -1
  179. package/dist/services/DepositService.cjs +0 -98
  180. package/dist/services/DepositService.cjs.map +0 -1
  181. package/dist/services/DepositService.d.cts +0 -39
  182. package/dist/services/DepositService.d.cts.map +0 -1
  183. package/dist/services/DepositService.d.mts +0 -39
  184. package/dist/services/DepositService.d.mts.map +0 -1
  185. package/dist/services/DepositService.mjs +0 -94
  186. package/dist/services/DepositService.mjs.map +0 -1
  187. package/dist/services/EligibilityService.cjs +0 -173
  188. package/dist/services/EligibilityService.cjs.map +0 -1
  189. package/dist/services/EligibilityService.d.cts +0 -39
  190. package/dist/services/EligibilityService.d.cts.map +0 -1
  191. package/dist/services/EligibilityService.d.mts +0 -39
  192. package/dist/services/EligibilityService.d.mts.map +0 -1
  193. package/dist/services/EligibilityService.mjs +0 -169
  194. package/dist/services/EligibilityService.mjs.map +0 -1
  195. package/dist/services/FeatureFlagConfigurationService.cjs +0 -257
  196. package/dist/services/FeatureFlagConfigurationService.cjs.map +0 -1
  197. package/dist/services/FeatureFlagConfigurationService.d.cts +0 -73
  198. package/dist/services/FeatureFlagConfigurationService.d.cts.map +0 -1
  199. package/dist/services/FeatureFlagConfigurationService.d.mts +0 -73
  200. package/dist/services/FeatureFlagConfigurationService.d.mts.map +0 -1
  201. package/dist/services/FeatureFlagConfigurationService.mjs +0 -253
  202. package/dist/services/FeatureFlagConfigurationService.mjs.map +0 -1
  203. package/dist/services/HyperLiquidClientService.cjs +0 -867
  204. package/dist/services/HyperLiquidClientService.cjs.map +0 -1
  205. package/dist/services/HyperLiquidClientService.d.cts +0 -214
  206. package/dist/services/HyperLiquidClientService.d.cts.map +0 -1
  207. package/dist/services/HyperLiquidClientService.d.mts +0 -214
  208. package/dist/services/HyperLiquidClientService.d.mts.map +0 -1
  209. package/dist/services/HyperLiquidClientService.mjs +0 -862
  210. package/dist/services/HyperLiquidClientService.mjs.map +0 -1
  211. package/dist/services/HyperLiquidSubscriptionService.cjs +0 -2199
  212. package/dist/services/HyperLiquidSubscriptionService.cjs.map +0 -1
  213. package/dist/services/HyperLiquidSubscriptionService.d.cts +0 -187
  214. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +0 -1
  215. package/dist/services/HyperLiquidSubscriptionService.d.mts +0 -187
  216. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +0 -1
  217. package/dist/services/HyperLiquidSubscriptionService.mjs +0 -2195
  218. package/dist/services/HyperLiquidSubscriptionService.mjs.map +0 -1
  219. package/dist/services/HyperLiquidWalletService.cjs +0 -163
  220. package/dist/services/HyperLiquidWalletService.cjs.map +0 -1
  221. package/dist/services/HyperLiquidWalletService.d.cts +0 -78
  222. package/dist/services/HyperLiquidWalletService.d.cts.map +0 -1
  223. package/dist/services/HyperLiquidWalletService.d.mts +0 -78
  224. package/dist/services/HyperLiquidWalletService.d.mts.map +0 -1
  225. package/dist/services/HyperLiquidWalletService.mjs +0 -159
  226. package/dist/services/HyperLiquidWalletService.mjs.map +0 -1
  227. package/dist/services/MYXClientService.cjs +0 -304
  228. package/dist/services/MYXClientService.cjs.map +0 -1
  229. package/dist/services/MYXClientService.d.cts +0 -81
  230. package/dist/services/MYXClientService.d.cts.map +0 -1
  231. package/dist/services/MYXClientService.d.mts +0 -81
  232. package/dist/services/MYXClientService.d.mts.map +0 -1
  233. package/dist/services/MYXClientService.mjs +0 -300
  234. package/dist/services/MYXClientService.mjs.map +0 -1
  235. package/dist/services/MarketDataService.cjs +0 -848
  236. package/dist/services/MarketDataService.cjs.map +0 -1
  237. package/dist/services/MarketDataService.d.cts +0 -291
  238. package/dist/services/MarketDataService.d.cts.map +0 -1
  239. package/dist/services/MarketDataService.d.mts +0 -291
  240. package/dist/services/MarketDataService.d.mts.map +0 -1
  241. package/dist/services/MarketDataService.mjs +0 -844
  242. package/dist/services/MarketDataService.mjs.map +0 -1
  243. package/dist/services/RewardsIntegrationService.cjs +0 -120
  244. package/dist/services/RewardsIntegrationService.cjs.map +0 -1
  245. package/dist/services/RewardsIntegrationService.d.cts +0 -28
  246. package/dist/services/RewardsIntegrationService.d.cts.map +0 -1
  247. package/dist/services/RewardsIntegrationService.d.mts +0 -28
  248. package/dist/services/RewardsIntegrationService.d.mts.map +0 -1
  249. package/dist/services/RewardsIntegrationService.mjs +0 -116
  250. package/dist/services/RewardsIntegrationService.mjs.map +0 -1
  251. package/dist/services/ServiceContext.cjs +0 -3
  252. package/dist/services/ServiceContext.cjs.map +0 -1
  253. package/dist/services/ServiceContext.d.cts +0 -86
  254. package/dist/services/ServiceContext.d.cts.map +0 -1
  255. package/dist/services/ServiceContext.d.mts +0 -86
  256. package/dist/services/ServiceContext.d.mts.map +0 -1
  257. package/dist/services/ServiceContext.mjs +0 -2
  258. package/dist/services/ServiceContext.mjs.map +0 -1
  259. package/dist/services/TradingReadinessCache.cjs +0 -288
  260. package/dist/services/TradingReadinessCache.cjs.map +0 -1
  261. package/dist/services/TradingReadinessCache.d.cts +0 -174
  262. package/dist/services/TradingReadinessCache.d.cts.map +0 -1
  263. package/dist/services/TradingReadinessCache.d.mts +0 -174
  264. package/dist/services/TradingReadinessCache.d.mts.map +0 -1
  265. package/dist/services/TradingReadinessCache.mjs +0 -285
  266. package/dist/services/TradingReadinessCache.mjs.map +0 -1
  267. package/dist/services/TradingService.cjs +0 -1457
  268. package/dist/services/TradingService.cjs.map +0 -1
  269. package/dist/services/TradingService.d.cts +0 -195
  270. package/dist/services/TradingService.d.cts.map +0 -1
  271. package/dist/services/TradingService.d.mts +0 -195
  272. package/dist/services/TradingService.d.mts.map +0 -1
  273. package/dist/services/TradingService.mjs +0 -1453
  274. package/dist/services/TradingService.mjs.map +0 -1
  275. package/dist/types/config.cjs +0 -3
  276. package/dist/types/config.cjs.map +0 -1
  277. package/dist/types/config.d.cts +0 -49
  278. package/dist/types/config.d.cts.map +0 -1
  279. package/dist/types/config.d.mts +0 -49
  280. package/dist/types/config.d.mts.map +0 -1
  281. package/dist/types/config.mjs +0 -2
  282. package/dist/types/config.mjs.map +0 -1
  283. package/dist/types/hyperliquid-types.cjs +0 -3
  284. package/dist/types/hyperliquid-types.cjs.map +0 -1
  285. package/dist/types/hyperliquid-types.d.cts +0 -20
  286. package/dist/types/hyperliquid-types.d.cts.map +0 -1
  287. package/dist/types/hyperliquid-types.d.mts +0 -20
  288. package/dist/types/hyperliquid-types.d.mts.map +0 -1
  289. package/dist/types/hyperliquid-types.mjs +0 -2
  290. package/dist/types/hyperliquid-types.mjs.map +0 -1
  291. package/dist/types/index.cjs +0 -115
  292. package/dist/types/index.cjs.map +0 -1
  293. package/dist/types/index.d.cts +0 -1262
  294. package/dist/types/index.d.cts.map +0 -1
  295. package/dist/types/index.d.mts +0 -1262
  296. package/dist/types/index.d.mts.map +0 -1
  297. package/dist/types/index.mjs +0 -97
  298. package/dist/types/index.mjs.map +0 -1
  299. package/dist/types/messenger.cjs +0 -3
  300. package/dist/types/messenger.cjs.map +0 -1
  301. package/dist/types/messenger.d.cts +0 -27
  302. package/dist/types/messenger.d.cts.map +0 -1
  303. package/dist/types/messenger.d.mts +0 -27
  304. package/dist/types/messenger.d.mts.map +0 -1
  305. package/dist/types/messenger.mjs +0 -2
  306. package/dist/types/messenger.mjs.map +0 -1
  307. package/dist/types/myx-types.cjs +0 -25
  308. package/dist/types/myx-types.cjs.map +0 -1
  309. package/dist/types/myx-types.d.cts +0 -63
  310. package/dist/types/myx-types.d.cts.map +0 -1
  311. package/dist/types/myx-types.d.mts +0 -63
  312. package/dist/types/myx-types.d.mts.map +0 -1
  313. package/dist/types/myx-types.mjs +0 -22
  314. package/dist/types/myx-types.mjs.map +0 -1
  315. package/dist/types/perps-types.cjs +0 -4
  316. package/dist/types/perps-types.cjs.map +0 -1
  317. package/dist/types/perps-types.d.cts +0 -105
  318. package/dist/types/perps-types.d.cts.map +0 -1
  319. package/dist/types/perps-types.d.mts +0 -105
  320. package/dist/types/perps-types.d.mts.map +0 -1
  321. package/dist/types/perps-types.mjs +0 -2
  322. package/dist/types/perps-types.mjs.map +0 -1
  323. package/dist/types/token.cjs +0 -3
  324. package/dist/types/token.cjs.map +0 -1
  325. package/dist/types/token.d.cts +0 -25
  326. package/dist/types/token.d.cts.map +0 -1
  327. package/dist/types/token.d.mts +0 -25
  328. package/dist/types/token.d.mts.map +0 -1
  329. package/dist/types/token.mjs +0 -2
  330. package/dist/types/token.mjs.map +0 -1
  331. package/dist/types/transactionTypes.cjs +0 -28
  332. package/dist/types/transactionTypes.cjs.map +0 -1
  333. package/dist/types/transactionTypes.d.cts +0 -64
  334. package/dist/types/transactionTypes.d.cts.map +0 -1
  335. package/dist/types/transactionTypes.d.mts +0 -64
  336. package/dist/types/transactionTypes.d.mts.map +0 -1
  337. package/dist/types/transactionTypes.mjs +0 -23
  338. package/dist/types/transactionTypes.mjs.map +0 -1
  339. package/dist/utils/accountUtils.cjs +0 -100
  340. package/dist/utils/accountUtils.cjs.map +0 -1
  341. package/dist/utils/accountUtils.d.cts +0 -30
  342. package/dist/utils/accountUtils.d.cts.map +0 -1
  343. package/dist/utils/accountUtils.d.mts +0 -30
  344. package/dist/utils/accountUtils.d.mts.map +0 -1
  345. package/dist/utils/accountUtils.mjs +0 -92
  346. package/dist/utils/accountUtils.mjs.map +0 -1
  347. package/dist/utils/errorUtils.cjs +0 -35
  348. package/dist/utils/errorUtils.cjs.map +0 -1
  349. package/dist/utils/errorUtils.d.cts +0 -15
  350. package/dist/utils/errorUtils.d.cts.map +0 -1
  351. package/dist/utils/errorUtils.d.mts +0 -15
  352. package/dist/utils/errorUtils.d.mts.map +0 -1
  353. package/dist/utils/errorUtils.mjs +0 -31
  354. package/dist/utils/errorUtils.mjs.map +0 -1
  355. package/dist/utils/hyperLiquidAdapter.cjs +0 -331
  356. package/dist/utils/hyperLiquidAdapter.cjs.map +0 -1
  357. package/dist/utils/hyperLiquidAdapter.d.cts +0 -42
  358. package/dist/utils/hyperLiquidAdapter.d.cts.map +0 -1
  359. package/dist/utils/hyperLiquidAdapter.d.mts +0 -42
  360. package/dist/utils/hyperLiquidAdapter.d.mts.map +0 -1
  361. package/dist/utils/hyperLiquidAdapter.mjs +0 -316
  362. package/dist/utils/hyperLiquidAdapter.mjs.map +0 -1
  363. package/dist/utils/hyperLiquidOrderBookProcessor.cjs +0 -83
  364. package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +0 -1
  365. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +0 -55
  366. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +0 -1
  367. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +0 -55
  368. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +0 -1
  369. package/dist/utils/hyperLiquidOrderBookProcessor.mjs +0 -78
  370. package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +0 -1
  371. package/dist/utils/hyperLiquidValidation.cjs +0 -426
  372. package/dist/utils/hyperLiquidValidation.cjs.map +0 -1
  373. package/dist/utils/hyperLiquidValidation.d.cts +0 -143
  374. package/dist/utils/hyperLiquidValidation.d.cts.map +0 -1
  375. package/dist/utils/hyperLiquidValidation.d.mts +0 -143
  376. package/dist/utils/hyperLiquidValidation.d.mts.map +0 -1
  377. package/dist/utils/hyperLiquidValidation.mjs +0 -413
  378. package/dist/utils/hyperLiquidValidation.mjs.map +0 -1
  379. package/dist/utils/idUtils.cjs +0 -18
  380. package/dist/utils/idUtils.cjs.map +0 -1
  381. package/dist/utils/idUtils.d.cts +0 -6
  382. package/dist/utils/idUtils.d.cts.map +0 -1
  383. package/dist/utils/idUtils.d.mts +0 -6
  384. package/dist/utils/idUtils.d.mts.map +0 -1
  385. package/dist/utils/idUtils.mjs +0 -10
  386. package/dist/utils/idUtils.mjs.map +0 -1
  387. package/dist/utils/index.cjs +0 -59
  388. package/dist/utils/index.cjs.map +0 -1
  389. package/dist/utils/index.d.cts +0 -25
  390. package/dist/utils/index.d.cts.map +0 -1
  391. package/dist/utils/index.d.mts +0 -25
  392. package/dist/utils/index.d.mts.map +0 -1
  393. package/dist/utils/index.mjs +0 -30
  394. package/dist/utils/index.mjs.map +0 -1
  395. package/dist/utils/marketDataTransform.cjs +0 -211
  396. package/dist/utils/marketDataTransform.cjs.map +0 -1
  397. package/dist/utils/marketDataTransform.d.cts +0 -40
  398. package/dist/utils/marketDataTransform.d.cts.map +0 -1
  399. package/dist/utils/marketDataTransform.d.mts +0 -40
  400. package/dist/utils/marketDataTransform.d.mts.map +0 -1
  401. package/dist/utils/marketDataTransform.mjs +0 -205
  402. package/dist/utils/marketDataTransform.mjs.map +0 -1
  403. package/dist/utils/marketUtils.cjs +0 -151
  404. package/dist/utils/marketUtils.cjs.map +0 -1
  405. package/dist/utils/marketUtils.d.cts +0 -30
  406. package/dist/utils/marketUtils.d.cts.map +0 -1
  407. package/dist/utils/marketUtils.d.mts +0 -30
  408. package/dist/utils/marketUtils.d.mts.map +0 -1
  409. package/dist/utils/marketUtils.mjs +0 -138
  410. package/dist/utils/marketUtils.mjs.map +0 -1
  411. package/dist/utils/myxAdapter.cjs +0 -224
  412. package/dist/utils/myxAdapter.cjs.map +0 -1
  413. package/dist/utils/myxAdapter.d.cts +0 -81
  414. package/dist/utils/myxAdapter.d.cts.map +0 -1
  415. package/dist/utils/myxAdapter.d.mts +0 -81
  416. package/dist/utils/myxAdapter.d.mts.map +0 -1
  417. package/dist/utils/myxAdapter.mjs +0 -213
  418. package/dist/utils/myxAdapter.mjs.map +0 -1
  419. package/dist/utils/orderCalculations.cjs +0 -283
  420. package/dist/utils/orderCalculations.cjs.map +0 -1
  421. package/dist/utils/orderCalculations.d.cts +0 -107
  422. package/dist/utils/orderCalculations.d.cts.map +0 -1
  423. package/dist/utils/orderCalculations.d.mts +0 -107
  424. package/dist/utils/orderCalculations.d.mts.map +0 -1
  425. package/dist/utils/orderCalculations.mjs +0 -274
  426. package/dist/utils/orderCalculations.mjs.map +0 -1
  427. package/dist/utils/rewardsUtils.cjs +0 -98
  428. package/dist/utils/rewardsUtils.cjs.map +0 -1
  429. package/dist/utils/rewardsUtils.d.cts +0 -33
  430. package/dist/utils/rewardsUtils.d.cts.map +0 -1
  431. package/dist/utils/rewardsUtils.d.mts +0 -33
  432. package/dist/utils/rewardsUtils.d.mts.map +0 -1
  433. package/dist/utils/rewardsUtils.mjs +0 -92
  434. package/dist/utils/rewardsUtils.mjs.map +0 -1
  435. package/dist/utils/significantFigures.cjs +0 -88
  436. package/dist/utils/significantFigures.cjs.map +0 -1
  437. package/dist/utils/significantFigures.d.cts +0 -25
  438. package/dist/utils/significantFigures.d.cts.map +0 -1
  439. package/dist/utils/significantFigures.d.mts +0 -25
  440. package/dist/utils/significantFigures.d.mts.map +0 -1
  441. package/dist/utils/significantFigures.mjs +0 -82
  442. package/dist/utils/significantFigures.mjs.map +0 -1
  443. package/dist/utils/sortMarkets.cjs +0 -93
  444. package/dist/utils/sortMarkets.cjs.map +0 -1
  445. package/dist/utils/sortMarkets.d.cts +0 -27
  446. package/dist/utils/sortMarkets.d.cts.map +0 -1
  447. package/dist/utils/sortMarkets.d.mts +0 -27
  448. package/dist/utils/sortMarkets.d.mts.map +0 -1
  449. package/dist/utils/sortMarkets.mjs +0 -88
  450. package/dist/utils/sortMarkets.mjs.map +0 -1
  451. package/dist/utils/standaloneInfoClient.cjs +0 -70
  452. package/dist/utils/standaloneInfoClient.cjs.map +0 -1
  453. package/dist/utils/standaloneInfoClient.d.cts +0 -37
  454. package/dist/utils/standaloneInfoClient.d.cts.map +0 -1
  455. package/dist/utils/standaloneInfoClient.d.mts +0 -37
  456. package/dist/utils/standaloneInfoClient.d.mts.map +0 -1
  457. package/dist/utils/standaloneInfoClient.mjs +0 -64
  458. package/dist/utils/standaloneInfoClient.mjs.map +0 -1
  459. package/dist/utils/stringParseUtils.cjs +0 -18
  460. package/dist/utils/stringParseUtils.cjs.map +0 -1
  461. package/dist/utils/stringParseUtils.d.cts +0 -3
  462. package/dist/utils/stringParseUtils.d.cts.map +0 -1
  463. package/dist/utils/stringParseUtils.d.mts +0 -3
  464. package/dist/utils/stringParseUtils.d.mts.map +0 -1
  465. package/dist/utils/stringParseUtils.mjs +0 -13
  466. package/dist/utils/stringParseUtils.mjs.map +0 -1
  467. package/dist/utils/transferData.cjs +0 -33
  468. package/dist/utils/transferData.cjs.map +0 -1
  469. package/dist/utils/transferData.d.cts +0 -9
  470. package/dist/utils/transferData.d.cts.map +0 -1
  471. package/dist/utils/transferData.d.mts +0 -9
  472. package/dist/utils/transferData.d.mts.map +0 -1
  473. package/dist/utils/transferData.mjs +0 -29
  474. package/dist/utils/transferData.mjs.map +0 -1
  475. package/dist/utils/wait.cjs +0 -6
  476. package/dist/utils/wait.cjs.map +0 -1
  477. package/dist/utils/wait.d.cts +0 -2
  478. package/dist/utils/wait.d.cts.map +0 -1
  479. package/dist/utils/wait.d.mts +0 -2
  480. package/dist/utils/wait.d.mts.map +0 -1
  481. package/dist/utils/wait.mjs +0 -2
  482. package/dist/utils/wait.mjs.map +0 -1
@@ -1,994 +1,107 @@
1
- import { BaseController, ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
1
+ import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
+ import { BaseController } from "@metamask/base-controller";
2
3
  import type { Messenger } from "@metamask/messenger";
3
- import type { Json } from "@metamask/utils";
4
- import { CandlePeriod } from "./constants/chartConfig.cjs";
5
- import type { SortOptionId } from "./constants/perpsConfig.cjs";
6
- import { WebSocketConnectionState } from "./types/index.cjs";
7
- import type { AccountState, AssetRoute, CancelOrderParams, CancelOrderResult, CancelOrdersParams, CancelOrdersResult, ClosePositionParams, ClosePositionsParams, ClosePositionsResult, DepositWithConfirmationParams, EditOrderParams, FeeCalculationParams, FeeCalculationResult, FlipPositionParams, Funding, GetAccountStateParams, GetAvailableDexsParams, GetFundingParams, GetMarketsParams, GetOrderFillsParams, GetOrdersParams, GetPositionsParams, PerpsProvider, LiquidationPriceParams, LiveDataConfig, MaintenanceMarginParams, MarginResult, MarketInfo, Order, OrderFill, OrderParams, OrderResult, PerpsControllerConfig, PerpsMarketData, Position, SubscribeAccountParams, SubscribeCandlesParams, SubscribeOICapsParams, SubscribeOrderBookParams, SubscribeOrderFillsParams, SubscribeOrdersParams, SubscribePositionsParams, SubscribePricesParams, SwitchProviderResult, ToggleTestnetResult, UpdateMarginParams, UpdatePositionTPSLParams, WithdrawParams, WithdrawResult, GetHistoricalPortfolioParams, HistoricalPortfolioResult, OrderType, PerpsPlatformDependencies, PerpsActiveProviderMode, PerpsProviderType, PerpsSelectedPaymentToken, PerpsRemoteFeatureFlagState } from "./types/index.cjs";
8
- import type { PerpsControllerAllowedActions, PerpsControllerAllowedEvents } from "./types/messenger.cjs";
9
- import type { CandleData } from "./types/perps-types.cjs";
10
- import { LastTransactionResult, TransactionStatus } from "./types/transactionTypes.cjs";
11
- import type { SortDirection } from "./utils/sortMarkets.cjs";
12
4
  /**
13
- * Minimal payment token stored in PerpsController state.
14
- * Only required fields for identification, Perps balance detection, and analytics.
5
+ * The name of the {@link PerpsController}, used to namespace the
6
+ * controller's actions and events and to namespace the controller's state data
7
+ * when composed with other controllers.
15
8
  */
16
- export type SelectedPaymentTokenSnapshot = {
17
- description?: string;
18
- address: string;
19
- chainId: string;
20
- symbol?: string;
21
- };
22
- export { PERPS_ERROR_CODES, type PerpsErrorCode } from "./perpsErrorCodes.cjs";
9
+ export declare const controllerName = "PerpsController";
23
10
  /**
24
- * Initialization state enum for state machine tracking
11
+ * Describes the shape of the state object for {@link PerpsController}.
25
12
  */
26
- export declare enum InitializationState {
27
- Uninitialized = "uninitialized",
28
- Initializing = "initializing",
29
- Initialized = "initialized",
30
- Failed = "failed"
31
- }
13
+ export type PerpsControllerState = {};
32
14
  /**
33
- * State shape for PerpsController
15
+ * Constructs the default {@link PerpsController} state. This allows
16
+ * consumers to provide a partial state object when initializing the controller
17
+ * and also helps in constructing complete state objects for this controller in
18
+ * tests.
19
+ *
20
+ * @returns The default {@link PerpsController} state.
34
21
  */
35
- export type PerpsControllerState = {
36
- activeProvider: PerpsActiveProviderMode;
37
- isTestnet: boolean;
38
- initializationState: InitializationState;
39
- initializationError: string | null;
40
- initializationAttempts: number;
41
- accountState: AccountState | null;
42
- perpsBalances: {
43
- [provider: string]: {
44
- totalBalance: string;
45
- unrealizedPnl: string;
46
- accountValue1dAgo: string;
47
- lastUpdated: number;
48
- };
49
- };
50
- depositInProgress: boolean;
51
- lastDepositTransactionId: string | null;
52
- lastDepositResult: LastTransactionResult | null;
53
- withdrawInProgress: boolean;
54
- lastWithdrawResult: LastTransactionResult | null;
55
- withdrawalRequests: {
56
- id: string;
57
- amount: string;
58
- asset: string;
59
- accountAddress: string;
60
- txHash?: string;
61
- timestamp: number;
62
- success: boolean;
63
- status: TransactionStatus;
64
- destination?: string;
65
- source?: string;
66
- transactionId?: string;
67
- withdrawalId?: string;
68
- depositId?: string;
69
- }[];
70
- withdrawalProgress: {
71
- progress: number;
72
- lastUpdated: number;
73
- activeWithdrawalId: string | null;
74
- };
75
- depositRequests: {
76
- id: string;
77
- amount: string;
78
- asset: string;
79
- accountAddress: string;
80
- txHash?: string;
81
- timestamp: number;
82
- success: boolean;
83
- status: TransactionStatus;
84
- destination?: string;
85
- source?: string;
86
- transactionId?: string;
87
- withdrawalId?: string;
88
- depositId?: string;
89
- }[];
90
- isEligible: boolean;
91
- isFirstTimeUser: {
92
- testnet: boolean;
93
- mainnet: boolean;
94
- };
95
- hasPlacedFirstOrder: {
96
- testnet: boolean;
97
- mainnet: boolean;
98
- };
99
- watchlistMarkets: {
100
- testnet: string[];
101
- mainnet: string[];
102
- };
103
- tradeConfigurations: {
104
- testnet: {
105
- [marketSymbol: string]: {
106
- leverage?: number;
107
- orderBookGrouping?: number;
108
- pendingConfig?: {
109
- amount?: string;
110
- leverage?: number;
111
- takeProfitPrice?: string;
112
- stopLossPrice?: string;
113
- limitPrice?: string;
114
- orderType?: OrderType;
115
- timestamp: number;
116
- };
117
- };
118
- };
119
- mainnet: {
120
- [marketSymbol: string]: {
121
- leverage?: number;
122
- orderBookGrouping?: number;
123
- pendingConfig?: {
124
- amount?: string;
125
- leverage?: number;
126
- takeProfitPrice?: string;
127
- stopLossPrice?: string;
128
- limitPrice?: string;
129
- orderType?: OrderType;
130
- timestamp: number;
131
- };
132
- };
133
- };
134
- };
135
- marketFilterPreferences: {
136
- optionId: SortOptionId;
137
- direction: SortDirection;
138
- };
139
- lastError: string | null;
140
- lastUpdateTimestamp: number;
141
- hip3ConfigVersion: number;
142
- selectedPaymentToken: Json | null;
143
- cachedMarketData: PerpsMarketData[] | null;
144
- cachedMarketDataTimestamp: number;
145
- cachedPositions: Position[] | null;
146
- cachedOrders: Order[] | null;
147
- cachedAccountState: AccountState | null;
148
- cachedUserDataTimestamp: number;
149
- cachedUserDataAddress: string | null;
150
- };
22
+ export declare function getDefaultPerpsControllerState(): PerpsControllerState;
151
23
  /**
152
- * Get default PerpsController state
153
- *
154
- * To change the active provider, modify the `activeProvider` value below:
155
- * - 'hyperliquid': HyperLiquid provider (default, production)
156
- * - 'aggregated': Multi-provider aggregation mode
157
- * - 'myx': MYX provider (future implementation)
158
- *
159
- * @returns The default perps controller state.
24
+ * Retrieves the state of the {@link PerpsController}.
160
25
  */
161
- export declare const getDefaultPerpsControllerState: () => PerpsControllerState;
26
+ export type PerpsControllerGetStateAction = ControllerGetStateAction<typeof controllerName, PerpsControllerState>;
162
27
  /**
163
- * PerpsController events
28
+ * Actions that {@link PerpsControllerMessenger} exposes to other consumers.
164
29
  */
165
- export type PerpsControllerEvents = ControllerStateChangeEvent<'PerpsController', PerpsControllerState>;
30
+ export type PerpsControllerActions = PerpsControllerGetStateAction;
166
31
  /**
167
- * PerpsController actions
32
+ * Actions from other messengers that {@link PerpsControllerMessenger} calls.
168
33
  */
169
- export type PerpsControllerActions = ControllerGetStateAction<'PerpsController', PerpsControllerState> | {
170
- type: 'PerpsController:placeOrder';
171
- handler: PerpsController['placeOrder'];
172
- } | {
173
- type: 'PerpsController:editOrder';
174
- handler: PerpsController['editOrder'];
175
- } | {
176
- type: 'PerpsController:cancelOrder';
177
- handler: PerpsController['cancelOrder'];
178
- } | {
179
- type: 'PerpsController:cancelOrders';
180
- handler: PerpsController['cancelOrders'];
181
- } | {
182
- type: 'PerpsController:closePosition';
183
- handler: PerpsController['closePosition'];
184
- } | {
185
- type: 'PerpsController:closePositions';
186
- handler: PerpsController['closePositions'];
187
- } | {
188
- type: 'PerpsController:withdraw';
189
- handler: PerpsController['withdraw'];
190
- } | {
191
- type: 'PerpsController:getPositions';
192
- handler: PerpsController['getPositions'];
193
- } | {
194
- type: 'PerpsController:getOrderFills';
195
- handler: PerpsController['getOrderFills'];
196
- } | {
197
- type: 'PerpsController:getOrders';
198
- handler: PerpsController['getOrders'];
199
- } | {
200
- type: 'PerpsController:getOpenOrders';
201
- handler: PerpsController['getOpenOrders'];
202
- } | {
203
- type: 'PerpsController:getFunding';
204
- handler: PerpsController['getFunding'];
205
- } | {
206
- type: 'PerpsController:getAccountState';
207
- handler: PerpsController['getAccountState'];
208
- } | {
209
- type: 'PerpsController:getMarkets';
210
- handler: PerpsController['getMarkets'];
211
- } | {
212
- type: 'PerpsController:refreshEligibility';
213
- handler: PerpsController['refreshEligibility'];
214
- } | {
215
- type: 'PerpsController:toggleTestnet';
216
- handler: PerpsController['toggleTestnet'];
217
- } | {
218
- type: 'PerpsController:disconnect';
219
- handler: PerpsController['disconnect'];
220
- } | {
221
- type: 'PerpsController:calculateFees';
222
- handler: PerpsController['calculateFees'];
223
- } | {
224
- type: 'PerpsController:markTutorialCompleted';
225
- handler: PerpsController['markTutorialCompleted'];
226
- } | {
227
- type: 'PerpsController:markFirstOrderCompleted';
228
- handler: PerpsController['markFirstOrderCompleted'];
229
- } | {
230
- type: 'PerpsController:getHistoricalPortfolio';
231
- handler: PerpsController['getHistoricalPortfolio'];
232
- } | {
233
- type: 'PerpsController:resetFirstTimeUserState';
234
- handler: PerpsController['resetFirstTimeUserState'];
235
- } | {
236
- type: 'PerpsController:clearPendingTransactionRequests';
237
- handler: PerpsController['clearPendingTransactionRequests'];
238
- } | {
239
- type: 'PerpsController:saveTradeConfiguration';
240
- handler: PerpsController['saveTradeConfiguration'];
241
- } | {
242
- type: 'PerpsController:getTradeConfiguration';
243
- handler: PerpsController['getTradeConfiguration'];
244
- } | {
245
- type: 'PerpsController:saveMarketFilterPreferences';
246
- handler: PerpsController['saveMarketFilterPreferences'];
247
- } | {
248
- type: 'PerpsController:getMarketFilterPreferences';
249
- handler: PerpsController['getMarketFilterPreferences'];
250
- } | {
251
- type: 'PerpsController:savePendingTradeConfiguration';
252
- handler: PerpsController['savePendingTradeConfiguration'];
253
- } | {
254
- type: 'PerpsController:getPendingTradeConfiguration';
255
- handler: PerpsController['getPendingTradeConfiguration'];
256
- } | {
257
- type: 'PerpsController:clearPendingTradeConfiguration';
258
- handler: PerpsController['clearPendingTradeConfiguration'];
259
- } | {
260
- type: 'PerpsController:getOrderBookGrouping';
261
- handler: PerpsController['getOrderBookGrouping'];
262
- } | {
263
- type: 'PerpsController:saveOrderBookGrouping';
264
- handler: PerpsController['saveOrderBookGrouping'];
265
- } | {
266
- type: 'PerpsController:setSelectedPaymentToken';
267
- handler: PerpsController['setSelectedPaymentToken'];
268
- } | {
269
- type: 'PerpsController:resetSelectedPaymentToken';
270
- handler: PerpsController['resetSelectedPaymentToken'];
271
- };
34
+ type AllowedActions = never;
272
35
  /**
273
- * PerpsController messenger constraints.
274
- * Includes both PerpsController's own actions/events and
275
- * allowed actions/events from external controllers.
36
+ * Published when the state of {@link PerpsController} changes.
276
37
  */
277
- export type PerpsControllerMessenger = Messenger<'PerpsController', PerpsControllerActions | PerpsControllerAllowedActions, PerpsControllerEvents | PerpsControllerAllowedEvents>;
38
+ export type PerpsControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, PerpsControllerState>;
278
39
  /**
279
- * PerpsController options
40
+ * Events that {@link PerpsControllerMessenger} exposes to other consumers.
280
41
  */
281
- export type PerpsControllerOptions = {
282
- messenger: PerpsControllerMessenger;
283
- state?: Partial<PerpsControllerState>;
284
- clientConfig?: PerpsControllerConfig;
285
- /**
286
- * Platform-specific dependencies (required)
287
- * Provides logging, metrics, tracing, stream management, and rewards.
288
- * Cross-controller communication uses the messenger pattern.
289
- * Must be provided by the platform (mobile/extension) at instantiation time.
290
- */
291
- infrastructure: PerpsPlatformDependencies;
292
- };
293
- type BlockedRegionList = {
294
- list: string[];
295
- source: 'remote' | 'fallback';
296
- };
42
+ export type PerpsControllerEvents = PerpsControllerStateChangeEvent;
43
+ /**
44
+ * Events from other messengers that {@link PerpsControllerMessenger} subscribes
45
+ * to.
46
+ */
47
+ type AllowedEvents = never;
297
48
  /**
298
- * PerpsController - Protocol-agnostic perpetuals trading controller
49
+ * The messenger restricted to actions and events accessed by
50
+ * {@link PerpsController}.
51
+ */
52
+ export type PerpsControllerMessenger = Messenger<typeof controllerName, PerpsControllerActions | AllowedActions, PerpsControllerEvents | AllowedEvents>;
53
+ /**
54
+ * `PerpsController` manages perpetual trading functionality in MetaMask.
55
+ *
56
+ * This controller provides platform-agnostic perps trading capabilities.
57
+ *
58
+ * @example
299
59
  *
300
- * Provides a unified interface for perpetual futures trading across multiple protocols.
301
- * Features dual data flow architecture:
302
- * - Trading actions use Redux for persistence and optimistic updates
303
- * - Live data uses direct callbacks for maximum performance
60
+ * ``` ts
61
+ * import { Messenger } from '@metamask/messenger';
62
+ * import type {
63
+ * PerpsControllerActions,
64
+ * PerpsControllerEvents,
65
+ * } from '@metamask/perps-controller';
66
+ * import { PerpsController } from '@metamask/perps-controller';
67
+ *
68
+ * const rootMessenger = new Messenger<
69
+ * 'Root',
70
+ * PerpsControllerActions,
71
+ * PerpsControllerEvents
72
+ * >({ namespace: 'Root' });
73
+ * const perpsControllerMessenger = new Messenger<
74
+ * 'PerpsController',
75
+ * PerpsControllerActions,
76
+ * PerpsControllerEvents,
77
+ * typeof rootMessenger,
78
+ * >({
79
+ * namespace: 'PerpsController',
80
+ * parent: rootMessenger,
81
+ * });
82
+ * // Instantiate the controller to register its actions on the messenger
83
+ * new PerpsController({
84
+ * messenger: perpsControllerMessenger,
85
+ * });
86
+ *
87
+ * const perpsControllerState = await rootMessenger.call(
88
+ * 'PerpsController:getState',
89
+ * );
90
+ * ```
304
91
  */
305
- export declare class PerpsController extends BaseController<'PerpsController', PerpsControllerState, PerpsControllerMessenger> {
306
- #private;
307
- protected providers: Map<PerpsProviderType, PerpsProvider>;
308
- protected isInitialized: boolean;
309
- protected blockedRegionList: BlockedRegionList;
310
- /**
311
- * Active provider instance for routing operations.
312
- * When activeProvider is 'hyperliquid' or 'myx': points to specific provider directly
313
- * When activeProvider is 'aggregated': points to AggregatedPerpsProvider wrapper
314
- */
315
- protected activeProviderInstance: PerpsProvider | null;
316
- constructor({ messenger, state, clientConfig, infrastructure, }: PerpsControllerOptions);
317
- /**
318
- * Test-observable accessor for whether a standalone provider is cached.
319
- *
320
- * @returns True if a standalone provider instance exists.
321
- */
322
- protected hasStandaloneProvider(): boolean;
323
- protected setBlockedRegionList(list: string[], source: 'remote' | 'fallback'): void;
324
- /**
325
- * Respond to RemoteFeatureFlagController state changes
326
- * Refreshes user eligibility based on geo-blocked regions defined in remote feature flag.
327
- * Uses fallback configuration when remote feature flag is undefined.
328
- * Note: Initial eligibility is set in the constructor if fallback regions are provided.
329
- *
330
- * @param remoteFeatureFlagControllerState - State from RemoteFeatureFlagController.
331
- */
332
- protected refreshEligibilityOnFeatureFlagChange(remoteFeatureFlagControllerState: PerpsRemoteFeatureFlagState): void;
333
- /**
334
- * Initialize the PerpsController providers
335
- * Must be called before using any other methods
336
- * Prevents double initialization with promise caching
337
- *
338
- * @returns A promise that resolves when the operation completes.
339
- */
340
- init(): Promise<void>;
341
- /**
342
- * Get the currently active provider.
343
- * In aggregated mode, returns AggregatedPerpsProvider which routes to underlying providers.
344
- * In single provider mode, returns HyperLiquidProvider directly.
345
- *
346
- * @returns The active provider (aggregated wrapper or direct provider based on mode)
347
- * @throws Error if provider is not initialized or reinitializing
348
- */
349
- getActiveProvider(): PerpsProvider;
350
- /**
351
- * Get the currently active provider, returning null if not available
352
- * Use this method when the caller can gracefully handle a missing provider
353
- * (e.g., UI components during initialization or reconnection)
354
- *
355
- * @returns The active provider, or null if not initialized/reinitializing
356
- */
357
- getActiveProviderOrNull(): PerpsProvider | null;
358
- /**
359
- * Place a new order
360
- * Thin delegation to TradingService
361
- *
362
- * @param params - The operation parameters.
363
- * @returns The order result with order ID and status.
364
- */
365
- placeOrder(params: OrderParams): Promise<OrderResult>;
366
- /**
367
- * Edit an existing order
368
- * Thin delegation to TradingService
369
- *
370
- * @param params - The operation parameters.
371
- * @returns The updated order result with order ID and status.
372
- */
373
- editOrder(params: EditOrderParams): Promise<OrderResult>;
374
- /**
375
- * Cancel an existing order
376
- *
377
- * @param params - The operation parameters.
378
- * @returns The cancellation result with status.
379
- */
380
- cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;
381
- /**
382
- * Cancel multiple orders in parallel
383
- * Batch version of cancelOrder() that cancels multiple orders simultaneously
384
- *
385
- * @param params - The operation parameters.
386
- * @returns The batch cancellation results for each order.
387
- */
388
- cancelOrders(params: CancelOrdersParams): Promise<CancelOrdersResult>;
389
- /**
390
- * Close a position (partial or full)
391
- * Thin delegation to TradingService
392
- *
393
- * @param params - The operation parameters.
394
- * @returns The order result from the close position request.
395
- */
396
- closePosition(params: ClosePositionParams): Promise<OrderResult>;
397
- /**
398
- * Close multiple positions in parallel
399
- * Batch version of closePosition() that closes multiple positions simultaneously
400
- *
401
- * @param params - The operation parameters.
402
- * @returns The batch close results for each position.
403
- */
404
- closePositions(params: ClosePositionsParams): Promise<ClosePositionsResult>;
405
- /**
406
- * Update TP/SL for an existing position
407
- *
408
- * @param params - The operation parameters.
409
- * @returns The order result from the TP/SL update.
410
- */
411
- updatePositionTPSL(params: UpdatePositionTPSLParams): Promise<OrderResult>;
412
- /**
413
- * Update margin for an existing position (add or remove)
414
- *
415
- * @param params - The operation parameters.
416
- * @returns The margin update result.
417
- */
418
- updateMargin(params: UpdateMarginParams): Promise<MarginResult>;
419
- /**
420
- * Flip position (reverse direction while keeping size and leverage)
421
- *
422
- * @param params - The operation parameters.
423
- * @returns The order result from the position flip.
424
- */
425
- flipPosition(params: FlipPositionParams): Promise<OrderResult>;
426
- /**
427
- * Simplified deposit method that prepares transaction for confirmation screen
428
- * No complex state tracking - just sets a loading flag
429
- *
430
- * @param params - Parameters for the deposit flow
431
- * @param params.amount - Optional deposit amount
432
- * @param params.placeOrder - If true, uses addTransaction instead of submit to avoid navigation
433
- * @returns An object containing a promise that resolves to the transaction hash.
434
- */
435
- depositWithConfirmation(params?: DepositWithConfirmationParams): Promise<{
436
- result: Promise<string>;
437
- }>;
438
- /**
439
- * Same as depositWithConfirmation - prepares transaction for confirmation screen.
440
- *
441
- * @returns A promise that resolves to the string result.
442
- */
443
- depositWithOrder(): Promise<{
444
- result: Promise<string>;
445
- }>;
446
- /**
447
- * Clear the last deposit result after it has been shown to the user
448
- */
449
- clearDepositResult(): void;
450
- clearWithdrawResult(): void;
451
- /**
452
- * Update withdrawal request status when it completes
453
- * This is called when a withdrawal is matched with a completed withdrawal from the API
454
- *
455
- * @param withdrawalId - The withdrawal transaction ID.
456
- * @param status - The current status.
457
- * @param txHash - The transaction hash.
458
- */
459
- updateWithdrawalStatus(withdrawalId: string, status: 'completed' | 'failed', txHash?: string): void;
460
- /**
461
- * Update withdrawal progress (persistent across navigation)
462
- *
463
- * @param progress - The progress indicator.
464
- * @param activeWithdrawalId - The active withdrawal ID.
465
- */
466
- updateWithdrawalProgress(progress: number, activeWithdrawalId?: string | null): void;
467
- /**
468
- * Get current withdrawal progress
469
- *
470
- * @returns The withdrawal progress, last update timestamp, and active withdrawal ID.
471
- */
472
- getWithdrawalProgress(): {
473
- progress: number;
474
- lastUpdated: number;
475
- activeWithdrawalId: string | null;
476
- };
477
- /**
478
- * Withdraw funds from trading account
479
- *
480
- * The withdrawal process varies by provider and may involve:
481
- * - Direct on-chain transfers
482
- * - Bridge operations
483
- * - Multi-step validation processes
484
- *
485
- * Check the specific provider documentation for detailed withdrawal flows.
486
- *
487
- * @param params Withdrawal parameters
488
- * @returns WithdrawResult with withdrawal ID and tracking info
489
- */
490
- withdraw(params: WithdrawParams): Promise<WithdrawResult>;
491
- /**
492
- * Get current positions
493
- * Thin delegation to MarketDataService
494
- *
495
- * For standalone mode, bypasses getActiveProvider() to allow position queries
496
- * without full perps initialization (e.g., for showing positions on token details page)
497
- *
498
- * @param params - The operation parameters.
499
- * @returns Array of open positions for the active provider.
500
- */
501
- getPositions(params?: GetPositionsParams): Promise<Position[]>;
502
- /**
503
- * Get historical user fills (trade executions)
504
- * Thin delegation to MarketDataService
505
- *
506
- * @param params - The operation parameters.
507
- * @returns Array of historical trade executions (fills).
508
- */
509
- getOrderFills(params?: GetOrderFillsParams): Promise<OrderFill[]>;
510
- /**
511
- * Get historical user orders (order lifecycle)
512
- * Thin delegation to MarketDataService
513
- *
514
- * @param params - The operation parameters.
515
- * @returns Array of historical orders.
516
- */
517
- getOrders(params?: GetOrdersParams): Promise<Order[]>;
518
- /**
519
- * Get currently open orders (real-time status)
520
- * Thin delegation to MarketDataService
521
- *
522
- * For standalone mode, bypasses getActiveProvider() to allow open order queries
523
- * without full perps initialization (e.g., for background preloading)
524
- *
525
- * @param params - The operation parameters.
526
- * @returns A promise that resolves to the result.
527
- */
528
- getOpenOrders(params?: GetOrdersParams): Promise<Order[]>;
529
- /**
530
- * Get historical user funding history (funding payments)
531
- * Thin delegation to MarketDataService
532
- *
533
- * @param params - The operation parameters.
534
- * @returns Array of historical funding payments.
535
- */
536
- getFunding(params?: GetFundingParams): Promise<Funding[]>;
537
- /**
538
- * Get account state (balances, etc.)
539
- * Thin delegation to MarketDataService
540
- *
541
- * For standalone mode, bypasses getActiveProvider() to allow account state queries
542
- * without full perps initialization (e.g., for checking if user has perps funds)
543
- *
544
- * @param params - The operation parameters.
545
- * @returns A promise that resolves to the result.
546
- */
547
- getAccountState(params?: GetAccountStateParams): Promise<AccountState>;
548
- /**
549
- * Get historical portfolio data
550
- * Thin delegation to MarketDataService
551
- *
552
- * @param params - The operation parameters.
553
- * @returns The historical portfolio data points.
554
- */
555
- getHistoricalPortfolio(params?: GetHistoricalPortfolioParams): Promise<HistoricalPortfolioResult>;
556
- /**
557
- * Get available markets with optional filtering
558
- * Thin delegation to MarketDataService
559
- *
560
- * For standalone mode, bypasses getActiveProvider() to allow market discovery
561
- * without full perps initialization (e.g., for discovery banners on spot screens)
562
- *
563
- * @param params - The operation parameters.
564
- * @returns Array of available markets matching the filter criteria.
565
- */
566
- getMarkets(params?: GetMarketsParams): Promise<MarketInfo[]>;
567
- /**
568
- * Get market data with prices (includes price, volume, 24h change)
569
- *
570
- * For standalone mode, bypasses getActiveProvider() to allow market data queries
571
- * without full perps initialization (e.g., for background preloading on app start)
572
- *
573
- * @param params - The operation parameters.
574
- * @param params.standalone - Whether to use standalone mode.
575
- * @returns A promise that resolves to the market data.
576
- */
577
- getMarketDataWithPrices(params?: {
578
- standalone?: boolean;
579
- }): Promise<PerpsMarketData[]>;
580
- /**
581
- * Start background market data preloading.
582
- * Fetches market data immediately and refreshes every 5 minutes.
583
- * Watches for isTestnet and hip3ConfigVersion changes to re-preload.
584
- */
585
- startMarketDataPreload(): void;
586
- /**
587
- * Stop background market data preloading.
588
- */
589
- stopMarketDataPreload(): void;
590
- /**
591
- * Get list of available HIP-3 builder-deployed DEXs
592
- *
593
- * @param params - Optional parameters for filtering
594
- * @returns Array of DEX names
595
- */
596
- getAvailableDexs(params?: GetAvailableDexsParams): Promise<string[]>;
597
- /**
598
- * Fetch historical candle data
599
- * Thin delegation to MarketDataService
600
- *
601
- * @param options - The configuration options.
602
- * @param options.symbol - The trading pair symbol.
603
- * @param options.interval - The candle interval period.
604
- * @param options.limit - Maximum number of items to fetch.
605
- * @param options.endTime - End timestamp in milliseconds.
606
- * @returns The historical candle data for the requested symbol and interval.
607
- */
608
- fetchHistoricalCandles(options: {
609
- symbol: string;
610
- interval: CandlePeriod;
611
- limit?: number;
612
- endTime?: number;
613
- }): Promise<CandleData>;
614
- /**
615
- * Calculate liquidation price for a position
616
- * Uses provider-specific formulas based on protocol rules
617
- *
618
- * @param params - The operation parameters.
619
- * @returns A promise that resolves to the string result.
620
- */
621
- calculateLiquidationPrice(params: LiquidationPriceParams): Promise<string>;
622
- /**
623
- * Calculate maintenance margin for a specific asset
624
- * Returns a percentage (e.g., 0.0125 for 1.25%)
625
- *
626
- * @param params - The operation parameters.
627
- * @returns A promise that resolves to the numeric result.
628
- */
629
- calculateMaintenanceMargin(params: MaintenanceMarginParams): Promise<number>;
630
- /**
631
- * Get maximum leverage allowed for an asset
632
- *
633
- * @param asset - The asset identifier.
634
- * @returns A promise that resolves to the numeric result.
635
- */
636
- getMaxLeverage(asset: string): Promise<number>;
637
- /**
638
- * Validate order parameters according to protocol-specific rules
639
- *
640
- * @param params - The operation parameters.
641
- * @returns True if the condition is met.
642
- */
643
- validateOrder(params: OrderParams): Promise<{
644
- isValid: boolean;
645
- error?: string;
646
- }>;
647
- /**
648
- * Validate close position parameters according to protocol-specific rules
649
- *
650
- * @param params - The operation parameters.
651
- * @returns A promise that resolves to the result.
652
- */
653
- validateClosePosition(params: ClosePositionParams): Promise<{
654
- isValid: boolean;
655
- error?: string;
656
- }>;
657
- /**
658
- * Validate withdrawal parameters according to protocol-specific rules
659
- *
660
- * @param params - The operation parameters.
661
- * @returns True if the condition is met.
662
- */
663
- validateWithdrawal(params: WithdrawParams): Promise<{
664
- isValid: boolean;
665
- error?: string;
666
- }>;
667
- /**
668
- * Get supported withdrawal routes - returns complete asset and routing information
669
- *
670
- * @returns Array of supported asset routes for withdrawals.
671
- */
672
- getWithdrawalRoutes(): AssetRoute[];
673
- /**
674
- * Toggle between testnet and mainnet
675
- *
676
- * @returns The toggle result with success status and current network mode.
677
- */
678
- toggleTestnet(): Promise<ToggleTestnetResult>;
679
- /**
680
- * Switch to a different provider
681
- * Uses a full reinit approach: disconnect() → update state → init()
682
- * This ensures complete state reset including WebSocket connections and caches.
683
- *
684
- * @param providerId - The provider identifier.
685
- * @returns The switch result with success status and active provider.
686
- */
687
- switchProvider(providerId: PerpsActiveProviderMode): Promise<SwitchProviderResult>;
688
- /**
689
- * Get current network (mainnet/testnet)
690
- *
691
- * @returns Either 'mainnet' or 'testnet' based on the current configuration.
692
- */
693
- getCurrentNetwork(): 'mainnet' | 'testnet';
694
- /**
695
- * Get the current WebSocket connection state from the active provider.
696
- * Used by the UI to monitor connection health and show notifications.
697
- *
698
- * @returns The current WebSocket connection state, or DISCONNECTED if not supported
699
- */
700
- getWebSocketConnectionState(): WebSocketConnectionState;
701
- /**
702
- * Subscribe to WebSocket connection state changes from the active provider.
703
- * The listener will be called immediately with the current state and whenever the state changes.
704
- *
705
- * @param listener - Callback function that receives the new connection state and reconnection attempt
706
- * @returns Unsubscribe function to remove the listener, or no-op if not supported
707
- */
708
- subscribeToConnectionState(listener: (state: WebSocketConnectionState, reconnectionAttempt: number) => void): () => void;
709
- /**
710
- * Manually trigger a WebSocket reconnection attempt.
711
- * Used by the UI retry button when connection is lost.
712
- */
713
- reconnect(): Promise<void>;
714
- /**
715
- * Subscribe to live price updates
716
- *
717
- * @param params - The operation parameters.
718
- * @returns A cleanup function to remove the subscription.
719
- */
720
- subscribeToPrices(params: SubscribePricesParams): () => void;
721
- /**
722
- * Subscribe to live position updates
723
- *
724
- * @param params - The operation parameters.
725
- * @returns A cleanup function to remove the subscription.
726
- */
727
- subscribeToPositions(params: SubscribePositionsParams): () => void;
728
- /**
729
- * Subscribe to live order fill updates
730
- *
731
- * @param params - The operation parameters.
732
- * @returns A cleanup function to remove the subscription.
733
- */
734
- subscribeToOrderFills(params: SubscribeOrderFillsParams): () => void;
735
- /**
736
- * Subscribe to live order updates
737
- *
738
- * @param params - The operation parameters.
739
- * @returns A cleanup function to remove the subscription.
740
- */
741
- subscribeToOrders(params: SubscribeOrdersParams): () => void;
742
- /**
743
- * Subscribe to live account updates.
744
- * Updates controller state (Redux) when new account data arrives so consumers
745
- * like usePerpsBalanceTokenFilter (PayWithModal) see the latest balance.
746
- *
747
- * @param params - The operation parameters.
748
- * @returns A cleanup function to remove the subscription.
749
- */
750
- subscribeToAccount(params: SubscribeAccountParams): () => void;
751
- /**
752
- * Subscribe to full order book updates with multiple depth levels
753
- * Creates a dedicated L2Book subscription for real-time order book data
754
- *
755
- * @param params - The operation parameters.
756
- * @returns A cleanup function to remove the subscription.
757
- */
758
- subscribeToOrderBook(params: SubscribeOrderBookParams): () => void;
759
- /**
760
- * Subscribe to live candle updates
761
- *
762
- * @param params - The operation parameters.
763
- * @returns A cleanup function to remove the subscription.
764
- */
765
- subscribeToCandles(params: SubscribeCandlesParams): () => void;
766
- /**
767
- * Subscribe to open interest cap updates
768
- * Zero additional network overhead - data comes from existing webData3 subscription
769
- *
770
- * @param params - The operation parameters.
771
- * @returns A cleanup function to remove the subscription.
772
- */
773
- subscribeToOICaps(params: SubscribeOICapsParams): () => void;
774
- /**
775
- * Configure live data throttling
776
- *
777
- * @param config - The configuration object.
778
- */
779
- setLiveDataConfig(config: Partial<LiveDataConfig>): void;
780
- /**
781
- * Calculate trading fees for the active provider
782
- * Each provider implements its own fee structure
783
- *
784
- * @param params - The operation parameters.
785
- * @returns The fee calculation result for the trade.
786
- */
787
- calculateFees(params: FeeCalculationParams): Promise<FeeCalculationResult>;
788
- /**
789
- * Disconnect provider and cleanup subscriptions
790
- * Call this when navigating away from Perps screens to prevent battery drain
791
- */
792
- disconnect(): Promise<void>;
793
- /**
794
- * Eligibility (Geo-Blocking)
795
- */
796
- /**
797
- * Fetch geo location
798
- *
799
- * Returned in Country or Country-Region format
800
- * Example: FR, DE, US-MI, CA-ON
801
- */
802
- /**
803
- * Refresh eligibility status
804
- */
805
- refreshEligibility(): Promise<void>;
806
- /**
807
- * Get block explorer URL for an address or just the base URL
808
- *
809
- * @param address - Optional address to append to the base URL
810
- * @returns Block explorer URL
811
- */
812
- getBlockExplorerUrl(address?: string): string;
813
- /**
814
- * Check if user is first-time for the current network
815
- *
816
- * @returns True if the condition is met.
817
- */
818
- isFirstTimeUserOnCurrentNetwork(): boolean;
819
- /**
820
- * Mark that the user has completed the tutorial/onboarding
821
- * This prevents the tutorial from showing again
822
- */
823
- markTutorialCompleted(): void;
824
- markFirstOrderCompleted(): void;
825
- /**
826
- * Reset first-time user state for both networks
827
- * This is useful for testing the tutorial flow
828
- * Called by Reset Account feature in settings
829
- */
830
- resetFirstTimeUserState(): void;
831
- /**
832
- * Clear pending/bridging withdrawal and deposit requests
833
- * This is useful when users want to clear stuck pending indicators
834
- * Called by Reset Account feature in settings
835
- */
836
- clearPendingTransactionRequests(): void;
837
- /**
838
- * Get saved trade configuration for a market
839
- *
840
- * @param symbol - The trading pair symbol.
841
- * @returns The resulting string value.
842
- */
843
- getTradeConfiguration(symbol: string): {
844
- leverage?: number;
845
- } | undefined;
846
- /**
847
- * Save trade configuration for a market
848
- *
849
- * @param symbol - Market symbol
850
- * @param leverage - Leverage value
851
- */
852
- saveTradeConfiguration(symbol: string, leverage: number): void;
853
- /**
854
- * Save pending trade configuration for a market
855
- * This is a temporary configuration that expires after 5 minutes
856
- *
857
- * @param symbol - Market symbol
858
- * @param config - Pending trade configuration (includes optional selected payment token from Pay row)
859
- * @param config.amount - The amount value.
860
- * @param config.leverage - The leverage multiplier.
861
- * @param config.takeProfitPrice - The take profit price.
862
- * @param config.stopLossPrice - The stop loss price.
863
- * @param config.limitPrice - The limit price.
864
- * @param config.orderType - The order type.
865
- * @param config.selectedPaymentToken - The selected payment token.
866
- */
867
- savePendingTradeConfiguration(symbol: string, config: {
868
- amount?: string;
869
- leverage?: number;
870
- takeProfitPrice?: string;
871
- stopLossPrice?: string;
872
- limitPrice?: string;
873
- orderType?: OrderType;
874
- /** When user used pay-with-token in PerpsPayRow: minimal token shape to restore selection */
875
- selectedPaymentToken?: PerpsSelectedPaymentToken | null;
876
- }): void;
877
- /**
878
- * Get pending trade configuration for a market
879
- * Returns undefined if config doesn't exist or has expired (more than 5 minutes old)
880
- *
881
- * @param symbol - Market symbol
882
- * @returns Pending trade configuration or undefined
883
- */
884
- getPendingTradeConfiguration(symbol: string): {
885
- amount?: string;
886
- leverage?: number;
887
- takeProfitPrice?: string;
888
- stopLossPrice?: string;
889
- limitPrice?: string;
890
- orderType?: OrderType;
891
- selectedPaymentToken?: PerpsSelectedPaymentToken | null;
892
- } | undefined;
893
- /**
894
- * Clear pending trade configuration for a market
895
- *
896
- * @param symbol - Market symbol
897
- */
898
- clearPendingTradeConfiguration(symbol: string): void;
899
- /**
900
- * Get saved market filter preferences
901
- * Handles backward compatibility with legacy string format
902
- *
903
- * @returns The saved sort option ID and direction.
904
- */
905
- getMarketFilterPreferences(): {
906
- optionId: SortOptionId;
907
- direction: SortDirection;
908
- };
909
- /**
910
- * Save market filter preferences
911
- *
912
- * @param optionId - Sort/filter option ID
913
- * @param direction - Sort direction ('asc' or 'desc')
914
- */
915
- saveMarketFilterPreferences(optionId: SortOptionId, direction: SortDirection): void;
916
- /**
917
- * Set the selected payment token for the Perps order/deposit flow.
918
- * Pass null or a token with description PERPS_CONSTANTS.PerpsBalanceTokenDescription to select Perps balance.
919
- * Only required fields (address, chainId) are stored in state; description and symbol are optional.
920
- *
921
- * @param token - The token identifier.
922
- */
923
- setSelectedPaymentToken(token: PerpsSelectedPaymentToken | null): void;
924
- /**
925
- * Reset the selected payment token to Perps balance (null).
926
- * Call when leaving the Perps order view so the next visit defaults to Perps balance.
927
- */
928
- resetSelectedPaymentToken(): void;
929
- /**
930
- * Get saved order book grouping for a market
931
- *
932
- * @param symbol - Market symbol
933
- * @returns The saved grouping value or undefined if not set
934
- */
935
- getOrderBookGrouping(symbol: string): number | undefined;
936
- /**
937
- * Save order book grouping for a market
938
- *
939
- * @param symbol - Market symbol
940
- * @param grouping - Price grouping value
941
- */
942
- saveOrderBookGrouping(symbol: string, grouping: number): void;
943
- /**
944
- * Toggle watchlist status for a market
945
- * Watchlist markets are stored per network (testnet/mainnet)
946
- *
947
- * @param symbol - The trading pair symbol.
948
- */
949
- toggleWatchlistMarket(symbol: string): void;
950
- /**
951
- * Check if a market is in the watchlist on the current network
952
- *
953
- * @param symbol - The trading pair symbol.
954
- * @returns True if the condition is met.
955
- */
956
- isWatchlistMarket(symbol: string): boolean;
957
- /**
958
- * Get all watchlist markets for the current network
959
- *
960
- * @returns The resulting string value.
961
- */
962
- getWatchlistMarkets(): string[];
963
- /**
964
- * Report order events to data lake API with retry (non-blocking)
965
- * Thin delegation to DataLakeService
966
- *
967
- * @param params - The operation parameters.
968
- * @param params.action - The order action.
969
- * @param params.symbol - The trading pair symbol.
970
- * @param params.slPrice - The stop loss price.
971
- * @param params.tpPrice - The take profit price.
972
- * @param params.retryCount - Internal retry counter.
973
- * @param params._traceId - Internal trace ID.
974
- * @returns Whether the report was sent successfully, with an optional error message.
975
- */
976
- protected reportOrderToDataLake(params: {
977
- action: 'open' | 'close';
978
- symbol: string;
979
- slPrice?: number;
980
- tpPrice?: number;
981
- retryCount?: number;
982
- _traceId?: string;
983
- }): Promise<{
984
- success: boolean;
985
- error?: string;
986
- }>;
92
+ export declare class PerpsController extends BaseController<typeof controllerName, PerpsControllerState, PerpsControllerMessenger> {
987
93
  /**
988
- * Check if the controller is currently reinitializing
94
+ * Constructs a new {@link PerpsController}.
989
95
  *
990
- * @returns true if providers are being reinitialized
96
+ * @param args - The arguments to this controller.
97
+ * @param args.messenger - The messenger suited for this controller.
98
+ * @param args.state - The desired state with which to initialize this
99
+ * controller. Missing properties will be filled in with defaults.
991
100
  */
992
- isCurrentlyReinitializing(): boolean;
101
+ constructor({ messenger, state, }: {
102
+ messenger: PerpsControllerMessenger;
103
+ state?: Partial<PerpsControllerState>;
104
+ });
993
105
  }
106
+ export {};
994
107
  //# sourceMappingURL=PerpsController.d.cts.map