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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (482) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/PerpsController.cjs +3077 -65
  3. package/dist/PerpsController.cjs.map +1 -1
  4. package/dist/PerpsController.d.cts +969 -82
  5. package/dist/PerpsController.d.cts.map +1 -1
  6. package/dist/PerpsController.d.mts +969 -82
  7. package/dist/PerpsController.d.mts.map +1 -1
  8. package/dist/PerpsController.mjs +3073 -62
  9. package/dist/PerpsController.mjs.map +1 -1
  10. package/dist/aggregation/SubscriptionMultiplexer.cjs +441 -0
  11. package/dist/aggregation/SubscriptionMultiplexer.cjs.map +1 -0
  12. package/dist/aggregation/SubscriptionMultiplexer.d.cts +171 -0
  13. package/dist/aggregation/SubscriptionMultiplexer.d.cts.map +1 -0
  14. package/dist/aggregation/SubscriptionMultiplexer.d.mts +171 -0
  15. package/dist/aggregation/SubscriptionMultiplexer.d.mts.map +1 -0
  16. package/dist/aggregation/SubscriptionMultiplexer.mjs +437 -0
  17. package/dist/aggregation/SubscriptionMultiplexer.mjs.map +1 -0
  18. package/dist/aggregation/index.cjs +9 -0
  19. package/dist/aggregation/index.cjs.map +1 -0
  20. package/dist/aggregation/index.d.cts +6 -0
  21. package/dist/aggregation/index.d.cts.map +1 -0
  22. package/dist/aggregation/index.d.mts +6 -0
  23. package/dist/aggregation/index.d.mts.map +1 -0
  24. package/dist/aggregation/index.mjs +5 -0
  25. package/dist/aggregation/index.mjs.map +1 -0
  26. package/dist/constants/chartConfig.cjs +227 -0
  27. package/dist/constants/chartConfig.cjs.map +1 -0
  28. package/dist/constants/chartConfig.d.cts +216 -0
  29. package/dist/constants/chartConfig.d.cts.map +1 -0
  30. package/dist/constants/chartConfig.d.mts +216 -0
  31. package/dist/constants/chartConfig.d.mts.map +1 -0
  32. package/dist/constants/chartConfig.mjs +221 -0
  33. package/dist/constants/chartConfig.mjs.map +1 -0
  34. package/dist/constants/eventNames.cjs +436 -0
  35. package/dist/constants/eventNames.cjs.map +1 -0
  36. package/dist/constants/eventNames.d.cts +387 -0
  37. package/dist/constants/eventNames.d.cts.map +1 -0
  38. package/dist/constants/eventNames.d.mts +387 -0
  39. package/dist/constants/eventNames.d.mts.map +1 -0
  40. package/dist/constants/eventNames.mjs +433 -0
  41. package/dist/constants/eventNames.mjs.map +1 -0
  42. package/dist/constants/hyperLiquidConfig.cjs +380 -0
  43. package/dist/constants/hyperLiquidConfig.cjs.map +1 -0
  44. package/dist/constants/hyperLiquidConfig.d.cts +236 -0
  45. package/dist/constants/hyperLiquidConfig.d.cts.map +1 -0
  46. package/dist/constants/hyperLiquidConfig.d.mts +236 -0
  47. package/dist/constants/hyperLiquidConfig.d.mts.map +1 -0
  48. package/dist/constants/hyperLiquidConfig.mjs +371 -0
  49. package/dist/constants/hyperLiquidConfig.mjs.map +1 -0
  50. package/dist/constants/index.cjs +28 -0
  51. package/dist/constants/index.cjs.map +1 -0
  52. package/dist/constants/index.d.cts +12 -0
  53. package/dist/constants/index.d.cts.map +1 -0
  54. package/dist/constants/index.d.mts +12 -0
  55. package/dist/constants/index.d.mts.map +1 -0
  56. package/dist/constants/index.mjs +12 -0
  57. package/dist/constants/index.mjs.map +1 -0
  58. package/dist/constants/myxConfig.cjs +229 -0
  59. package/dist/constants/myxConfig.cjs.map +1 -0
  60. package/dist/constants/myxConfig.d.cts +106 -0
  61. package/dist/constants/myxConfig.d.cts.map +1 -0
  62. package/dist/constants/myxConfig.d.mts +106 -0
  63. package/dist/constants/myxConfig.d.mts.map +1 -0
  64. package/dist/constants/myxConfig.mjs +219 -0
  65. package/dist/constants/myxConfig.mjs.map +1 -0
  66. package/dist/constants/orderTypes.cjs +31 -0
  67. package/dist/constants/orderTypes.cjs.map +1 -0
  68. package/dist/constants/orderTypes.d.cts +19 -0
  69. package/dist/constants/orderTypes.d.cts.map +1 -0
  70. package/dist/constants/orderTypes.d.mts +19 -0
  71. package/dist/constants/orderTypes.d.mts.map +1 -0
  72. package/dist/constants/orderTypes.mjs +27 -0
  73. package/dist/constants/orderTypes.mjs.map +1 -0
  74. package/dist/constants/performanceMetrics.cjs +63 -0
  75. package/dist/constants/performanceMetrics.cjs.map +1 -0
  76. package/dist/constants/performanceMetrics.d.cts +46 -0
  77. package/dist/constants/performanceMetrics.d.cts.map +1 -0
  78. package/dist/constants/performanceMetrics.d.mts +46 -0
  79. package/dist/constants/performanceMetrics.d.mts.map +1 -0
  80. package/dist/constants/performanceMetrics.mjs +60 -0
  81. package/dist/constants/performanceMetrics.mjs.map +1 -0
  82. package/dist/constants/perpsConfig.cjs +295 -0
  83. package/dist/constants/perpsConfig.cjs.map +1 -0
  84. package/dist/constants/perpsConfig.d.cts +221 -0
  85. package/dist/constants/perpsConfig.d.cts.map +1 -0
  86. package/dist/constants/perpsConfig.d.mts +221 -0
  87. package/dist/constants/perpsConfig.d.mts.map +1 -0
  88. package/dist/constants/perpsConfig.mjs +292 -0
  89. package/dist/constants/perpsConfig.mjs.map +1 -0
  90. package/dist/constants/transactionsHistoryConfig.cjs +19 -0
  91. package/dist/constants/transactionsHistoryConfig.cjs.map +1 -0
  92. package/dist/constants/transactionsHistoryConfig.d.cts +16 -0
  93. package/dist/constants/transactionsHistoryConfig.d.cts.map +1 -0
  94. package/dist/constants/transactionsHistoryConfig.d.mts +16 -0
  95. package/dist/constants/transactionsHistoryConfig.d.mts.map +1 -0
  96. package/dist/constants/transactionsHistoryConfig.mjs +16 -0
  97. package/dist/constants/transactionsHistoryConfig.mjs.map +1 -0
  98. package/dist/index.cjs +63 -1
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.d.cts +38 -2
  101. package/dist/index.d.cts.map +1 -1
  102. package/dist/index.d.mts +38 -2
  103. package/dist/index.d.mts.map +1 -1
  104. package/dist/index.mjs +46 -1
  105. package/dist/index.mjs.map +1 -1
  106. package/dist/perpsErrorCodes.cjs +80 -0
  107. package/dist/perpsErrorCodes.cjs.map +1 -0
  108. package/dist/perpsErrorCodes.d.cts +65 -0
  109. package/dist/perpsErrorCodes.d.cts.map +1 -0
  110. package/dist/perpsErrorCodes.d.mts +65 -0
  111. package/dist/perpsErrorCodes.d.mts.map +1 -0
  112. package/dist/perpsErrorCodes.mjs +77 -0
  113. package/dist/perpsErrorCodes.mjs.map +1 -0
  114. package/dist/providers/AggregatedPerpsProvider.cjs +508 -0
  115. package/dist/providers/AggregatedPerpsProvider.cjs.map +1 -0
  116. package/dist/providers/AggregatedPerpsProvider.d.cts +171 -0
  117. package/dist/providers/AggregatedPerpsProvider.d.cts.map +1 -0
  118. package/dist/providers/AggregatedPerpsProvider.d.mts +171 -0
  119. package/dist/providers/AggregatedPerpsProvider.d.mts.map +1 -0
  120. package/dist/providers/AggregatedPerpsProvider.mjs +504 -0
  121. package/dist/providers/AggregatedPerpsProvider.mjs.map +1 -0
  122. package/dist/providers/HyperLiquidProvider.cjs +5679 -0
  123. package/dist/providers/HyperLiquidProvider.cjs.map +1 -0
  124. package/dist/providers/HyperLiquidProvider.d.cts +516 -0
  125. package/dist/providers/HyperLiquidProvider.d.cts.map +1 -0
  126. package/dist/providers/HyperLiquidProvider.d.mts +516 -0
  127. package/dist/providers/HyperLiquidProvider.d.mts.map +1 -0
  128. package/dist/providers/HyperLiquidProvider.mjs +5675 -0
  129. package/dist/providers/HyperLiquidProvider.mjs.map +1 -0
  130. package/dist/providers/MYXProvider.cjs +514 -0
  131. package/dist/providers/MYXProvider.cjs.map +1 -0
  132. package/dist/providers/MYXProvider.d.cts +105 -0
  133. package/dist/providers/MYXProvider.d.cts.map +1 -0
  134. package/dist/providers/MYXProvider.d.mts +105 -0
  135. package/dist/providers/MYXProvider.d.mts.map +1 -0
  136. package/dist/providers/MYXProvider.mjs +510 -0
  137. package/dist/providers/MYXProvider.mjs.map +1 -0
  138. package/dist/routing/ProviderRouter.cjs +154 -0
  139. package/dist/routing/ProviderRouter.cjs.map +1 -0
  140. package/dist/routing/ProviderRouter.d.cts +112 -0
  141. package/dist/routing/ProviderRouter.d.cts.map +1 -0
  142. package/dist/routing/ProviderRouter.d.mts +112 -0
  143. package/dist/routing/ProviderRouter.d.mts.map +1 -0
  144. package/dist/routing/ProviderRouter.mjs +150 -0
  145. package/dist/routing/ProviderRouter.mjs.map +1 -0
  146. package/dist/routing/index.cjs +9 -0
  147. package/dist/routing/index.cjs.map +1 -0
  148. package/dist/routing/index.d.cts +6 -0
  149. package/dist/routing/index.d.cts.map +1 -0
  150. package/dist/routing/index.d.mts +6 -0
  151. package/dist/routing/index.d.mts.map +1 -0
  152. package/dist/routing/index.mjs +5 -0
  153. package/dist/routing/index.mjs.map +1 -0
  154. package/dist/selectors.cjs +166 -0
  155. package/dist/selectors.cjs.map +1 -0
  156. package/dist/selectors.d.cts +362 -0
  157. package/dist/selectors.d.cts.map +1 -0
  158. package/dist/selectors.d.mts +362 -0
  159. package/dist/selectors.d.mts.map +1 -0
  160. package/dist/selectors.mjs +158 -0
  161. package/dist/selectors.mjs.map +1 -0
  162. package/dist/services/AccountService.cjs +324 -0
  163. package/dist/services/AccountService.cjs.map +1 -0
  164. package/dist/services/AccountService.d.cts +56 -0
  165. package/dist/services/AccountService.d.cts.map +1 -0
  166. package/dist/services/AccountService.d.mts +56 -0
  167. package/dist/services/AccountService.d.mts.map +1 -0
  168. package/dist/services/AccountService.mjs +320 -0
  169. package/dist/services/AccountService.mjs.map +1 -0
  170. package/dist/services/DataLakeService.cjs +233 -0
  171. package/dist/services/DataLakeService.cjs.map +1 -0
  172. package/dist/services/DataLakeService.d.cts +51 -0
  173. package/dist/services/DataLakeService.d.cts.map +1 -0
  174. package/dist/services/DataLakeService.d.mts +51 -0
  175. package/dist/services/DataLakeService.d.mts.map +1 -0
  176. package/dist/services/DataLakeService.mjs +229 -0
  177. package/dist/services/DataLakeService.mjs.map +1 -0
  178. package/dist/services/DepositService.cjs +98 -0
  179. package/dist/services/DepositService.cjs.map +1 -0
  180. package/dist/services/DepositService.d.cts +39 -0
  181. package/dist/services/DepositService.d.cts.map +1 -0
  182. package/dist/services/DepositService.d.mts +39 -0
  183. package/dist/services/DepositService.d.mts.map +1 -0
  184. package/dist/services/DepositService.mjs +94 -0
  185. package/dist/services/DepositService.mjs.map +1 -0
  186. package/dist/services/EligibilityService.cjs +173 -0
  187. package/dist/services/EligibilityService.cjs.map +1 -0
  188. package/dist/services/EligibilityService.d.cts +39 -0
  189. package/dist/services/EligibilityService.d.cts.map +1 -0
  190. package/dist/services/EligibilityService.d.mts +39 -0
  191. package/dist/services/EligibilityService.d.mts.map +1 -0
  192. package/dist/services/EligibilityService.mjs +169 -0
  193. package/dist/services/EligibilityService.mjs.map +1 -0
  194. package/dist/services/FeatureFlagConfigurationService.cjs +257 -0
  195. package/dist/services/FeatureFlagConfigurationService.cjs.map +1 -0
  196. package/dist/services/FeatureFlagConfigurationService.d.cts +73 -0
  197. package/dist/services/FeatureFlagConfigurationService.d.cts.map +1 -0
  198. package/dist/services/FeatureFlagConfigurationService.d.mts +73 -0
  199. package/dist/services/FeatureFlagConfigurationService.d.mts.map +1 -0
  200. package/dist/services/FeatureFlagConfigurationService.mjs +253 -0
  201. package/dist/services/FeatureFlagConfigurationService.mjs.map +1 -0
  202. package/dist/services/HyperLiquidClientService.cjs +867 -0
  203. package/dist/services/HyperLiquidClientService.cjs.map +1 -0
  204. package/dist/services/HyperLiquidClientService.d.cts +214 -0
  205. package/dist/services/HyperLiquidClientService.d.cts.map +1 -0
  206. package/dist/services/HyperLiquidClientService.d.mts +214 -0
  207. package/dist/services/HyperLiquidClientService.d.mts.map +1 -0
  208. package/dist/services/HyperLiquidClientService.mjs +862 -0
  209. package/dist/services/HyperLiquidClientService.mjs.map +1 -0
  210. package/dist/services/HyperLiquidSubscriptionService.cjs +2199 -0
  211. package/dist/services/HyperLiquidSubscriptionService.cjs.map +1 -0
  212. package/dist/services/HyperLiquidSubscriptionService.d.cts +187 -0
  213. package/dist/services/HyperLiquidSubscriptionService.d.cts.map +1 -0
  214. package/dist/services/HyperLiquidSubscriptionService.d.mts +187 -0
  215. package/dist/services/HyperLiquidSubscriptionService.d.mts.map +1 -0
  216. package/dist/services/HyperLiquidSubscriptionService.mjs +2195 -0
  217. package/dist/services/HyperLiquidSubscriptionService.mjs.map +1 -0
  218. package/dist/services/HyperLiquidWalletService.cjs +163 -0
  219. package/dist/services/HyperLiquidWalletService.cjs.map +1 -0
  220. package/dist/services/HyperLiquidWalletService.d.cts +78 -0
  221. package/dist/services/HyperLiquidWalletService.d.cts.map +1 -0
  222. package/dist/services/HyperLiquidWalletService.d.mts +78 -0
  223. package/dist/services/HyperLiquidWalletService.d.mts.map +1 -0
  224. package/dist/services/HyperLiquidWalletService.mjs +159 -0
  225. package/dist/services/HyperLiquidWalletService.mjs.map +1 -0
  226. package/dist/services/MYXClientService.cjs +304 -0
  227. package/dist/services/MYXClientService.cjs.map +1 -0
  228. package/dist/services/MYXClientService.d.cts +81 -0
  229. package/dist/services/MYXClientService.d.cts.map +1 -0
  230. package/dist/services/MYXClientService.d.mts +81 -0
  231. package/dist/services/MYXClientService.d.mts.map +1 -0
  232. package/dist/services/MYXClientService.mjs +300 -0
  233. package/dist/services/MYXClientService.mjs.map +1 -0
  234. package/dist/services/MarketDataService.cjs +848 -0
  235. package/dist/services/MarketDataService.cjs.map +1 -0
  236. package/dist/services/MarketDataService.d.cts +291 -0
  237. package/dist/services/MarketDataService.d.cts.map +1 -0
  238. package/dist/services/MarketDataService.d.mts +291 -0
  239. package/dist/services/MarketDataService.d.mts.map +1 -0
  240. package/dist/services/MarketDataService.mjs +844 -0
  241. package/dist/services/MarketDataService.mjs.map +1 -0
  242. package/dist/services/RewardsIntegrationService.cjs +120 -0
  243. package/dist/services/RewardsIntegrationService.cjs.map +1 -0
  244. package/dist/services/RewardsIntegrationService.d.cts +28 -0
  245. package/dist/services/RewardsIntegrationService.d.cts.map +1 -0
  246. package/dist/services/RewardsIntegrationService.d.mts +28 -0
  247. package/dist/services/RewardsIntegrationService.d.mts.map +1 -0
  248. package/dist/services/RewardsIntegrationService.mjs +116 -0
  249. package/dist/services/RewardsIntegrationService.mjs.map +1 -0
  250. package/dist/services/ServiceContext.cjs +3 -0
  251. package/dist/services/ServiceContext.cjs.map +1 -0
  252. package/dist/services/ServiceContext.d.cts +86 -0
  253. package/dist/services/ServiceContext.d.cts.map +1 -0
  254. package/dist/services/ServiceContext.d.mts +86 -0
  255. package/dist/services/ServiceContext.d.mts.map +1 -0
  256. package/dist/services/ServiceContext.mjs +2 -0
  257. package/dist/services/ServiceContext.mjs.map +1 -0
  258. package/dist/services/TradingReadinessCache.cjs +288 -0
  259. package/dist/services/TradingReadinessCache.cjs.map +1 -0
  260. package/dist/services/TradingReadinessCache.d.cts +174 -0
  261. package/dist/services/TradingReadinessCache.d.cts.map +1 -0
  262. package/dist/services/TradingReadinessCache.d.mts +174 -0
  263. package/dist/services/TradingReadinessCache.d.mts.map +1 -0
  264. package/dist/services/TradingReadinessCache.mjs +285 -0
  265. package/dist/services/TradingReadinessCache.mjs.map +1 -0
  266. package/dist/services/TradingService.cjs +1457 -0
  267. package/dist/services/TradingService.cjs.map +1 -0
  268. package/dist/services/TradingService.d.cts +195 -0
  269. package/dist/services/TradingService.d.cts.map +1 -0
  270. package/dist/services/TradingService.d.mts +195 -0
  271. package/dist/services/TradingService.d.mts.map +1 -0
  272. package/dist/services/TradingService.mjs +1453 -0
  273. package/dist/services/TradingService.mjs.map +1 -0
  274. package/dist/types/config.cjs +3 -0
  275. package/dist/types/config.cjs.map +1 -0
  276. package/dist/types/config.d.cts +49 -0
  277. package/dist/types/config.d.cts.map +1 -0
  278. package/dist/types/config.d.mts +49 -0
  279. package/dist/types/config.d.mts.map +1 -0
  280. package/dist/types/config.mjs +2 -0
  281. package/dist/types/config.mjs.map +1 -0
  282. package/dist/types/hyperliquid-types.cjs +3 -0
  283. package/dist/types/hyperliquid-types.cjs.map +1 -0
  284. package/dist/types/hyperliquid-types.d.cts +20 -0
  285. package/dist/types/hyperliquid-types.d.cts.map +1 -0
  286. package/dist/types/hyperliquid-types.d.mts +20 -0
  287. package/dist/types/hyperliquid-types.d.mts.map +1 -0
  288. package/dist/types/hyperliquid-types.mjs +2 -0
  289. package/dist/types/hyperliquid-types.mjs.map +1 -0
  290. package/dist/types/index.cjs +115 -0
  291. package/dist/types/index.cjs.map +1 -0
  292. package/dist/types/index.d.cts +1262 -0
  293. package/dist/types/index.d.cts.map +1 -0
  294. package/dist/types/index.d.mts +1262 -0
  295. package/dist/types/index.d.mts.map +1 -0
  296. package/dist/types/index.mjs +97 -0
  297. package/dist/types/index.mjs.map +1 -0
  298. package/dist/types/messenger.cjs +3 -0
  299. package/dist/types/messenger.cjs.map +1 -0
  300. package/dist/types/messenger.d.cts +27 -0
  301. package/dist/types/messenger.d.cts.map +1 -0
  302. package/dist/types/messenger.d.mts +27 -0
  303. package/dist/types/messenger.d.mts.map +1 -0
  304. package/dist/types/messenger.mjs +2 -0
  305. package/dist/types/messenger.mjs.map +1 -0
  306. package/dist/types/myx-types.cjs +25 -0
  307. package/dist/types/myx-types.cjs.map +1 -0
  308. package/dist/types/myx-types.d.cts +63 -0
  309. package/dist/types/myx-types.d.cts.map +1 -0
  310. package/dist/types/myx-types.d.mts +63 -0
  311. package/dist/types/myx-types.d.mts.map +1 -0
  312. package/dist/types/myx-types.mjs +22 -0
  313. package/dist/types/myx-types.mjs.map +1 -0
  314. package/dist/types/perps-types.cjs +4 -0
  315. package/dist/types/perps-types.cjs.map +1 -0
  316. package/dist/types/perps-types.d.cts +105 -0
  317. package/dist/types/perps-types.d.cts.map +1 -0
  318. package/dist/types/perps-types.d.mts +105 -0
  319. package/dist/types/perps-types.d.mts.map +1 -0
  320. package/dist/types/perps-types.mjs +2 -0
  321. package/dist/types/perps-types.mjs.map +1 -0
  322. package/dist/types/token.cjs +3 -0
  323. package/dist/types/token.cjs.map +1 -0
  324. package/dist/types/token.d.cts +25 -0
  325. package/dist/types/token.d.cts.map +1 -0
  326. package/dist/types/token.d.mts +25 -0
  327. package/dist/types/token.d.mts.map +1 -0
  328. package/dist/types/token.mjs +2 -0
  329. package/dist/types/token.mjs.map +1 -0
  330. package/dist/types/transactionTypes.cjs +28 -0
  331. package/dist/types/transactionTypes.cjs.map +1 -0
  332. package/dist/types/transactionTypes.d.cts +64 -0
  333. package/dist/types/transactionTypes.d.cts.map +1 -0
  334. package/dist/types/transactionTypes.d.mts +64 -0
  335. package/dist/types/transactionTypes.d.mts.map +1 -0
  336. package/dist/types/transactionTypes.mjs +23 -0
  337. package/dist/types/transactionTypes.mjs.map +1 -0
  338. package/dist/utils/accountUtils.cjs +100 -0
  339. package/dist/utils/accountUtils.cjs.map +1 -0
  340. package/dist/utils/accountUtils.d.cts +30 -0
  341. package/dist/utils/accountUtils.d.cts.map +1 -0
  342. package/dist/utils/accountUtils.d.mts +30 -0
  343. package/dist/utils/accountUtils.d.mts.map +1 -0
  344. package/dist/utils/accountUtils.mjs +92 -0
  345. package/dist/utils/accountUtils.mjs.map +1 -0
  346. package/dist/utils/errorUtils.cjs +35 -0
  347. package/dist/utils/errorUtils.cjs.map +1 -0
  348. package/dist/utils/errorUtils.d.cts +15 -0
  349. package/dist/utils/errorUtils.d.cts.map +1 -0
  350. package/dist/utils/errorUtils.d.mts +15 -0
  351. package/dist/utils/errorUtils.d.mts.map +1 -0
  352. package/dist/utils/errorUtils.mjs +31 -0
  353. package/dist/utils/errorUtils.mjs.map +1 -0
  354. package/dist/utils/hyperLiquidAdapter.cjs +331 -0
  355. package/dist/utils/hyperLiquidAdapter.cjs.map +1 -0
  356. package/dist/utils/hyperLiquidAdapter.d.cts +42 -0
  357. package/dist/utils/hyperLiquidAdapter.d.cts.map +1 -0
  358. package/dist/utils/hyperLiquidAdapter.d.mts +42 -0
  359. package/dist/utils/hyperLiquidAdapter.d.mts.map +1 -0
  360. package/dist/utils/hyperLiquidAdapter.mjs +316 -0
  361. package/dist/utils/hyperLiquidAdapter.mjs.map +1 -0
  362. package/dist/utils/hyperLiquidOrderBookProcessor.cjs +83 -0
  363. package/dist/utils/hyperLiquidOrderBookProcessor.cjs.map +1 -0
  364. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts +55 -0
  365. package/dist/utils/hyperLiquidOrderBookProcessor.d.cts.map +1 -0
  366. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts +55 -0
  367. package/dist/utils/hyperLiquidOrderBookProcessor.d.mts.map +1 -0
  368. package/dist/utils/hyperLiquidOrderBookProcessor.mjs +78 -0
  369. package/dist/utils/hyperLiquidOrderBookProcessor.mjs.map +1 -0
  370. package/dist/utils/hyperLiquidValidation.cjs +426 -0
  371. package/dist/utils/hyperLiquidValidation.cjs.map +1 -0
  372. package/dist/utils/hyperLiquidValidation.d.cts +143 -0
  373. package/dist/utils/hyperLiquidValidation.d.cts.map +1 -0
  374. package/dist/utils/hyperLiquidValidation.d.mts +143 -0
  375. package/dist/utils/hyperLiquidValidation.d.mts.map +1 -0
  376. package/dist/utils/hyperLiquidValidation.mjs +413 -0
  377. package/dist/utils/hyperLiquidValidation.mjs.map +1 -0
  378. package/dist/utils/idUtils.cjs +18 -0
  379. package/dist/utils/idUtils.cjs.map +1 -0
  380. package/dist/utils/idUtils.d.cts +6 -0
  381. package/dist/utils/idUtils.d.cts.map +1 -0
  382. package/dist/utils/idUtils.d.mts +6 -0
  383. package/dist/utils/idUtils.d.mts.map +1 -0
  384. package/dist/utils/idUtils.mjs +10 -0
  385. package/dist/utils/idUtils.mjs.map +1 -0
  386. package/dist/utils/index.cjs +59 -0
  387. package/dist/utils/index.cjs.map +1 -0
  388. package/dist/utils/index.d.cts +25 -0
  389. package/dist/utils/index.d.cts.map +1 -0
  390. package/dist/utils/index.d.mts +25 -0
  391. package/dist/utils/index.d.mts.map +1 -0
  392. package/dist/utils/index.mjs +30 -0
  393. package/dist/utils/index.mjs.map +1 -0
  394. package/dist/utils/marketDataTransform.cjs +211 -0
  395. package/dist/utils/marketDataTransform.cjs.map +1 -0
  396. package/dist/utils/marketDataTransform.d.cts +40 -0
  397. package/dist/utils/marketDataTransform.d.cts.map +1 -0
  398. package/dist/utils/marketDataTransform.d.mts +40 -0
  399. package/dist/utils/marketDataTransform.d.mts.map +1 -0
  400. package/dist/utils/marketDataTransform.mjs +205 -0
  401. package/dist/utils/marketDataTransform.mjs.map +1 -0
  402. package/dist/utils/marketUtils.cjs +151 -0
  403. package/dist/utils/marketUtils.cjs.map +1 -0
  404. package/dist/utils/marketUtils.d.cts +30 -0
  405. package/dist/utils/marketUtils.d.cts.map +1 -0
  406. package/dist/utils/marketUtils.d.mts +30 -0
  407. package/dist/utils/marketUtils.d.mts.map +1 -0
  408. package/dist/utils/marketUtils.mjs +138 -0
  409. package/dist/utils/marketUtils.mjs.map +1 -0
  410. package/dist/utils/myxAdapter.cjs +224 -0
  411. package/dist/utils/myxAdapter.cjs.map +1 -0
  412. package/dist/utils/myxAdapter.d.cts +81 -0
  413. package/dist/utils/myxAdapter.d.cts.map +1 -0
  414. package/dist/utils/myxAdapter.d.mts +81 -0
  415. package/dist/utils/myxAdapter.d.mts.map +1 -0
  416. package/dist/utils/myxAdapter.mjs +213 -0
  417. package/dist/utils/myxAdapter.mjs.map +1 -0
  418. package/dist/utils/orderCalculations.cjs +283 -0
  419. package/dist/utils/orderCalculations.cjs.map +1 -0
  420. package/dist/utils/orderCalculations.d.cts +107 -0
  421. package/dist/utils/orderCalculations.d.cts.map +1 -0
  422. package/dist/utils/orderCalculations.d.mts +107 -0
  423. package/dist/utils/orderCalculations.d.mts.map +1 -0
  424. package/dist/utils/orderCalculations.mjs +274 -0
  425. package/dist/utils/orderCalculations.mjs.map +1 -0
  426. package/dist/utils/rewardsUtils.cjs +98 -0
  427. package/dist/utils/rewardsUtils.cjs.map +1 -0
  428. package/dist/utils/rewardsUtils.d.cts +33 -0
  429. package/dist/utils/rewardsUtils.d.cts.map +1 -0
  430. package/dist/utils/rewardsUtils.d.mts +33 -0
  431. package/dist/utils/rewardsUtils.d.mts.map +1 -0
  432. package/dist/utils/rewardsUtils.mjs +92 -0
  433. package/dist/utils/rewardsUtils.mjs.map +1 -0
  434. package/dist/utils/significantFigures.cjs +88 -0
  435. package/dist/utils/significantFigures.cjs.map +1 -0
  436. package/dist/utils/significantFigures.d.cts +25 -0
  437. package/dist/utils/significantFigures.d.cts.map +1 -0
  438. package/dist/utils/significantFigures.d.mts +25 -0
  439. package/dist/utils/significantFigures.d.mts.map +1 -0
  440. package/dist/utils/significantFigures.mjs +82 -0
  441. package/dist/utils/significantFigures.mjs.map +1 -0
  442. package/dist/utils/sortMarkets.cjs +93 -0
  443. package/dist/utils/sortMarkets.cjs.map +1 -0
  444. package/dist/utils/sortMarkets.d.cts +27 -0
  445. package/dist/utils/sortMarkets.d.cts.map +1 -0
  446. package/dist/utils/sortMarkets.d.mts +27 -0
  447. package/dist/utils/sortMarkets.d.mts.map +1 -0
  448. package/dist/utils/sortMarkets.mjs +88 -0
  449. package/dist/utils/sortMarkets.mjs.map +1 -0
  450. package/dist/utils/standaloneInfoClient.cjs +70 -0
  451. package/dist/utils/standaloneInfoClient.cjs.map +1 -0
  452. package/dist/utils/standaloneInfoClient.d.cts +37 -0
  453. package/dist/utils/standaloneInfoClient.d.cts.map +1 -0
  454. package/dist/utils/standaloneInfoClient.d.mts +37 -0
  455. package/dist/utils/standaloneInfoClient.d.mts.map +1 -0
  456. package/dist/utils/standaloneInfoClient.mjs +64 -0
  457. package/dist/utils/standaloneInfoClient.mjs.map +1 -0
  458. package/dist/utils/stringParseUtils.cjs +18 -0
  459. package/dist/utils/stringParseUtils.cjs.map +1 -0
  460. package/dist/utils/stringParseUtils.d.cts +3 -0
  461. package/dist/utils/stringParseUtils.d.cts.map +1 -0
  462. package/dist/utils/stringParseUtils.d.mts +3 -0
  463. package/dist/utils/stringParseUtils.d.mts.map +1 -0
  464. package/dist/utils/stringParseUtils.mjs +13 -0
  465. package/dist/utils/stringParseUtils.mjs.map +1 -0
  466. package/dist/utils/transferData.cjs +33 -0
  467. package/dist/utils/transferData.cjs.map +1 -0
  468. package/dist/utils/transferData.d.cts +9 -0
  469. package/dist/utils/transferData.d.cts.map +1 -0
  470. package/dist/utils/transferData.d.mts +9 -0
  471. package/dist/utils/transferData.d.mts.map +1 -0
  472. package/dist/utils/transferData.mjs +29 -0
  473. package/dist/utils/transferData.mjs.map +1 -0
  474. package/dist/utils/wait.cjs +6 -0
  475. package/dist/utils/wait.cjs.map +1 -0
  476. package/dist/utils/wait.d.cts +2 -0
  477. package/dist/utils/wait.d.cts.map +1 -0
  478. package/dist/utils/wait.d.mts +2 -0
  479. package/dist/utils/wait.d.mts.map +1 -0
  480. package/dist/utils/wait.mjs +2 -0
  481. package/dist/utils/wait.mjs.map +1 -0
  482. package/package.json +16 -2
@@ -0,0 +1,295 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROVIDER_CONFIG = exports.MARKET_SORTING_CONFIG = exports.DECIMAL_PRECISION_CONFIG = exports.DATA_LAKE_API_CONFIG = exports.MARGIN_ADJUSTMENT_CONFIG = exports.CLOSE_POSITION_CONFIG = exports.HYPERLIQUID_ORDER_LIMITS = exports.TP_SL_CONFIG = exports.PERFORMANCE_CONFIG = exports.ORDER_SLIPPAGE_CONFIG = exports.VALIDATION_THRESHOLDS = exports.WITHDRAWAL_CONSTANTS = exports.PERPS_CONSTANTS = void 0;
4
+ /**
5
+ * Perps feature constants - Controller layer (portable)
6
+ *
7
+ * This file contains only controller-portable configuration:
8
+ * - Constants used by controller logic, providers, and services
9
+ * - Calculation thresholds, API configs, and protocol constants
10
+ *
11
+ * UI-only constants (layout, display, navigation) live in:
12
+ * app/components/UI/Perps/constants/perpsConfig.ts
13
+ */
14
+ exports.PERPS_CONSTANTS = {
15
+ FeatureFlagKey: 'perpsEnabled',
16
+ FeatureName: 'perps', // Constant for Sentry error filtering - enables "feature:perps" dashboard queries
17
+ /** Token description used to identify the synthetic "Perps balance" option in pay-with token lists */
18
+ PerpsBalanceTokenDescription: 'perps-balance',
19
+ /** Symbol displayed for the synthetic "Perps balance" token in pay-with token lists */
20
+ PerpsBalanceTokenSymbol: 'USD',
21
+ WebsocketTimeout: 5000, // 5 seconds
22
+ WebsocketCleanupDelay: 1000, // 1 second
23
+ BackgroundDisconnectDelay: 20000, // 20 seconds delay before disconnecting when app is backgrounded or when user exits perps UX
24
+ ConnectionTimeoutMs: 10000, // 10 seconds timeout for connection and position loading states
25
+ DefaultMonitoringTimeoutMs: 10000, // 10 seconds default timeout for data monitoring operations
26
+ // Connection timing constants
27
+ ConnectionGracePeriodMs: 20000, // 20 seconds grace period before actual disconnection (same as BackgroundDisconnectDelay for semantic clarity)
28
+ ConnectionAttemptTimeoutMs: 30000, // 30 seconds timeout for connection attempts to prevent indefinite hanging
29
+ WebsocketPingTimeoutMs: 5000, // 5 seconds timeout for WebSocket health check ping
30
+ ConnectRetryDelayMs: 200, // Delay before retrying connect() when connection isn't ready yet
31
+ ReconnectionCleanupDelayMs: 500, // Platform-agnostic delay to ensure WebSocket is ready
32
+ ReconnectionDelayAndroidMs: 300, // Android-specific reconnection delay for better reliability on slower devices
33
+ ReconnectionDelayIosMs: 100, // iOS-specific reconnection delay for optimal performance
34
+ ReconnectionRetryDelayMs: 5000, // 5 seconds delay between reconnection attempts
35
+ // Connection manager timing constants
36
+ BalanceUpdateThrottleMs: 15000, // Update at most every 15 seconds to reduce state updates in PerpsConnectionManager
37
+ InitialDataDelayMs: 100, // Delay to allow initial data to load after connection establishment
38
+ // Deposit toast timing
39
+ DepositTakingLongerToastDelayMs: 30000, // Delay before showing "Deposit taking longer than usual" toast
40
+ DefaultAssetPreviewLimit: 5,
41
+ DefaultMaxLeverage: 3, // Default fallback max leverage when market data is unavailable - conservative default
42
+ FallbackPriceDisplay: '$---', // Display when price data is unavailable
43
+ FallbackPercentageDisplay: '--%', // Display when change data is unavailable
44
+ FallbackDataDisplay: '--', // Display when non-price data is unavailable
45
+ ZeroAmountDisplay: '$0', // Display for zero dollar amounts (e.g., no volume)
46
+ ZeroAmountDetailedDisplay: '$0.00', // Display for zero dollar amounts with decimals
47
+ RecentActivityLimit: 3,
48
+ // Historical data fetching constants
49
+ FillsLookbackMs: 90 * 24 * 60 * 60 * 1000, // 3 months in milliseconds - limits REST API fills fetch
50
+ };
51
+ /**
52
+ * Withdrawal-specific constants (protocol-agnostic)
53
+ * Note: Protocol-specific values like estimated time should be defined in each protocol's config
54
+ */
55
+ exports.WITHDRAWAL_CONSTANTS = {
56
+ DefaultMinAmount: '1.01', // Default minimum withdrawal amount in USDC
57
+ DefaultFeeAmount: 1, // Default withdrawal fee in USDC
58
+ DefaultFeeToken: 'USDC', // Default fee token
59
+ };
60
+ /**
61
+ * Validation thresholds for UI warnings and checks
62
+ * These values control when warnings are shown to users
63
+ */
64
+ exports.VALIDATION_THRESHOLDS = {
65
+ // Leverage threshold for warning users about high leverage
66
+ HighLeverageWarning: 20, // Show warning when leverage > 20x
67
+ // Limit price difference threshold (as decimal, 0.1 = 10%)
68
+ LimitPriceDifferenceWarning: 0.1, // Warn if limit price differs by >10% from current price
69
+ // Price deviation threshold (as decimal, 0.1 = 10%)
70
+ PriceDeviation: 0.1, // Warn if perps price deviates by >10% from spot price
71
+ };
72
+ /**
73
+ * Order slippage configuration
74
+ * Controls default slippage tolerance for different order types
75
+ * Conservative defaults based on HyperLiquid platform interface
76
+ * See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md
77
+ */
78
+ exports.ORDER_SLIPPAGE_CONFIG = {
79
+ // Market order slippage (basis points)
80
+ // 300 basis points = 3% = 0.03 decimal
81
+ // Conservative default for measured rollout, prevents most IOC failures
82
+ DefaultMarketSlippageBps: 300,
83
+ // TP/SL order slippage (basis points)
84
+ // 1000 basis points = 10% = 0.10 decimal
85
+ // Aligns with HyperLiquid platform default for triggered orders
86
+ DefaultTpslSlippageBps: 1000,
87
+ // Limit order slippage (basis points)
88
+ // 100 basis points = 1% = 0.01 decimal
89
+ // Kept conservative as limit orders rest on book (not IOC/immediate execution)
90
+ DefaultLimitSlippageBps: 100,
91
+ };
92
+ /**
93
+ * Performance optimization constants
94
+ * These values control debouncing and throttling for better performance
95
+ */
96
+ exports.PERFORMANCE_CONFIG = {
97
+ // Price updates debounce delay (milliseconds)
98
+ // Batches rapid WebSocket price updates to reduce re-renders
99
+ PriceUpdateDebounceMs: 1000,
100
+ // Order validation debounce delay (milliseconds)
101
+ // Prevents excessive validation calls during rapid form input changes
102
+ ValidationDebounceMs: 300,
103
+ // Liquidation price debounce delay (milliseconds)
104
+ // Prevents excessive liquidation price calls during rapid form input changes
105
+ LiquidationPriceDebounceMs: 500,
106
+ // Navigation params delay (milliseconds)
107
+ // Required for React Navigation to complete state transitions before setting params
108
+ // This ensures navigation context is available when programmatically selecting tabs
109
+ NavigationParamsDelayMs: 200,
110
+ // Tab control reset delay (milliseconds)
111
+ // Delay to reset programmatic tab control after tab switching to prevent render loops
112
+ TabControlResetDelayMs: 500,
113
+ // Market data cache duration (milliseconds)
114
+ // How long to cache market list data before fetching fresh data
115
+ MarketDataCacheDurationMs: 5 * 60 * 1000, // 5 minutes
116
+ // Asset metadata cache duration (milliseconds)
117
+ // How long to cache asset icon validation results
118
+ AssetMetadataCacheDurationMs: 60 * 60 * 1000, // 1 hour
119
+ // Max leverage cache duration (milliseconds)
120
+ // How long to cache max leverage values per asset (leverage rarely changes)
121
+ MaxLeverageCacheDurationMs: 60 * 60 * 1000, // 1 hour
122
+ // Rewards cache durations (milliseconds)
123
+ // How long to cache fee discount data from rewards API
124
+ FeeDiscountCacheDurationMs: 5 * 60 * 1000, // 5 minutes
125
+ // How long to cache points calculation parameters from rewards API
126
+ PointsCalculationCacheDurationMs: 5 * 60 * 1000, // 5 minutes
127
+ /**
128
+ * Performance logging markers for filtering logs during development and debugging
129
+ * These markers help isolate performance-related logs from general application logs
130
+ * Usage: Use in DevLogger calls to easily filter specific performance areas
131
+ * Impact: Development only (uses DevLogger) - zero production performance cost
132
+ *
133
+ * Examples:
134
+ * - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`
135
+ * - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`
136
+ * - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`
137
+ * - Filter all Perps performance: `adb logcat | grep PERPSMARK_`
138
+ */
139
+ LoggingMarkers: {
140
+ // Sentry performance measurement logs (screen loads, bottom sheets, API timing)
141
+ SentryPerformance: 'PERPSMARK_SENTRY',
142
+ // MetaMetrics event tracking logs (user interactions, business analytics)
143
+ MetametricsEvents: 'PERPSMARK_METRICS',
144
+ // WebSocket performance logs (connection timing, data flow, reconnections)
145
+ WebsocketPerformance: 'PERPSMARK_SENTRY_WS',
146
+ },
147
+ };
148
+ exports.TP_SL_CONFIG = {
149
+ UsePositionBoundTpsl: true,
150
+ };
151
+ /**
152
+ * HyperLiquid order limits based on leverage
153
+ * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications
154
+ */
155
+ exports.HYPERLIQUID_ORDER_LIMITS = {
156
+ // Market orders
157
+ MarketOrderLimits: {
158
+ // $15,000,000 for max leverage >= 25
159
+ HighLeverage: 15000000,
160
+ // $5,000,000 for max leverage in [20, 25)
161
+ MediumHighLeverage: 5000000,
162
+ // $2,000,000 for max leverage in [10, 20)
163
+ MediumLeverage: 2000000,
164
+ // $500,000 for max leverage < 10
165
+ LowLeverage: 500000,
166
+ },
167
+ // Limit orders are 10x market order limits
168
+ LimitOrderMultiplier: 10,
169
+ };
170
+ /**
171
+ * Close position configuration
172
+ * Controls behavior and constants specific to position closing
173
+ */
174
+ exports.CLOSE_POSITION_CONFIG = {
175
+ // Decimal places for USD amount input display
176
+ UsdDecimalPlaces: 2,
177
+ // Default close percentage when opening the close position view
178
+ DefaultClosePercentage: 100,
179
+ // Precision for position size calculations to prevent rounding errors
180
+ AmountCalculationPrecision: 6,
181
+ // Throttle delay for real-time price updates during position closing
182
+ PriceThrottleMs: 3000,
183
+ // Fallback decimal places for tokens without metadata
184
+ FallbackTokenDecimals: 18,
185
+ };
186
+ /**
187
+ * Margin adjustment configuration
188
+ * Controls behavior for adding/removing margin from positions
189
+ */
190
+ exports.MARGIN_ADJUSTMENT_CONFIG = {
191
+ // Risk thresholds for margin removal warnings
192
+ // Threshold values represent ratio of (price distance to liquidation) / (liquidation price)
193
+ // Values < 1.0 mean price is dangerously close to liquidation
194
+ LiquidationRiskThreshold: 1.2, // 20% buffer before liquidation - triggers danger state
195
+ LiquidationWarningThreshold: 1.5, // 50% buffer before liquidation - triggers warning state
196
+ // Minimum margin adjustment amount (USD)
197
+ // Prevents dust adjustments and ensures meaningful position changes
198
+ MinAdjustmentAmount: 1,
199
+ // Precision for margin calculations
200
+ // Ensures accurate decimal handling in margin/leverage calculations
201
+ CalculationPrecision: 6,
202
+ // Safety buffer for margin removal to account for HyperLiquid's transfer margin requirement
203
+ // HyperLiquid enforces: transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)
204
+ // See: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margin-and-pnl
205
+ MarginRemovalSafetyBuffer: 0.1,
206
+ // Fallback max leverage when market data is unavailable
207
+ // Conservative value to prevent over-removal of margin
208
+ // Most HyperLiquid assets support at least 50x leverage
209
+ FallbackMaxLeverage: 50,
210
+ };
211
+ /**
212
+ * Data Lake API configuration
213
+ * Endpoints for reporting perps trading activity for notifications
214
+ */
215
+ exports.DATA_LAKE_API_CONFIG = {
216
+ // Order reporting endpoint - only used for mainnet perps trading
217
+ OrdersEndpoint: 'https://perps.api.cx.metamask.io/api/v1/orders',
218
+ };
219
+ /**
220
+ * Decimal precision configuration
221
+ * Controls maximum decimal places for price and input validation
222
+ */
223
+ exports.DECIMAL_PRECISION_CONFIG = {
224
+ // Maximum decimal places for price input (matches Hyperliquid limit)
225
+ // Used in TP/SL forms, limit price inputs, and price validation
226
+ MaxPriceDecimals: 6,
227
+ // Maximum significant figures allowed by HyperLiquid API
228
+ // Orders with more than 5 significant figures will be rejected
229
+ MaxSignificantFigures: 5,
230
+ // Defensive fallback for size decimals when market data fails to load
231
+ // Real szDecimals should always come from market data API (varies by asset)
232
+ // Using 6 as safe maximum to prevent crashes (covers most assets)
233
+ // NOTE: This is NOT semantically correct - just a defensive measure
234
+ FallbackSizeDecimals: 6,
235
+ };
236
+ /**
237
+ * Market sorting configuration
238
+ * Controls sorting behavior and presets for the trending markets view
239
+ */
240
+ exports.MARKET_SORTING_CONFIG = {
241
+ // Default sort settings
242
+ DefaultSortOptionId: 'volume',
243
+ DefaultDirection: 'desc',
244
+ // Available sort fields (only includes fields supported by PerpsMarketData)
245
+ SortFields: {
246
+ Volume: 'volume',
247
+ PriceChange: 'priceChange',
248
+ OpenInterest: 'openInterest',
249
+ FundingRate: 'fundingRate',
250
+ },
251
+ // Sort button presets for filter chips (simplified buttons without direction)
252
+ SortButtonPresets: [
253
+ { field: 'volume', labelKey: 'perps.sort.volume' },
254
+ { field: 'priceChange', labelKey: 'perps.sort.price_change' },
255
+ { field: 'fundingRate', labelKey: 'perps.sort.funding_rate' },
256
+ ],
257
+ // Sort options for the bottom sheet
258
+ // All options support direction toggle (high-to-low / low-to-high)
259
+ SortOptions: [
260
+ {
261
+ id: 'volume',
262
+ labelKey: 'perps.sort.volume',
263
+ field: 'volume',
264
+ direction: 'desc',
265
+ },
266
+ {
267
+ id: 'priceChange',
268
+ labelKey: 'perps.sort.price_change',
269
+ field: 'priceChange',
270
+ direction: 'desc',
271
+ },
272
+ {
273
+ id: 'openInterest',
274
+ labelKey: 'perps.sort.open_interest',
275
+ field: 'openInterest',
276
+ direction: 'desc',
277
+ },
278
+ {
279
+ id: 'fundingRate',
280
+ labelKey: 'perps.sort.funding_rate',
281
+ field: 'fundingRate',
282
+ direction: 'desc',
283
+ },
284
+ ],
285
+ };
286
+ /**
287
+ * Provider configuration for multi-provider support
288
+ */
289
+ exports.PROVIDER_CONFIG = {
290
+ /** Default perpetual DEX provider when no explicit selection exists */
291
+ DefaultProvider: 'hyperliquid',
292
+ /** Force MYX to testnet only (mainnet credentials not yet available) */
293
+ MYX_TESTNET_ONLY: true,
294
+ };
295
+ //# sourceMappingURL=perpsConfig.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perpsConfig.cjs","sourceRoot":"","sources":["../../src/constants/perpsConfig.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Perps feature constants - Controller layer (portable)\n *\n * This file contains only controller-portable configuration:\n * - Constants used by controller logic, providers, and services\n * - Calculation thresholds, API configs, and protocol constants\n *\n * UI-only constants (layout, display, navigation) live in:\n * app/components/UI/Perps/constants/perpsConfig.ts\n */\nexport const PERPS_CONSTANTS = {\n FeatureFlagKey: 'perpsEnabled',\n FeatureName: 'perps', // Constant for Sentry error filtering - enables \"feature:perps\" dashboard queries\n /** Token description used to identify the synthetic \"Perps balance\" option in pay-with token lists */\n PerpsBalanceTokenDescription: 'perps-balance',\n /** Symbol displayed for the synthetic \"Perps balance\" token in pay-with token lists */\n PerpsBalanceTokenSymbol: 'USD',\n WebsocketTimeout: 5000, // 5 seconds\n WebsocketCleanupDelay: 1000, // 1 second\n BackgroundDisconnectDelay: 20_000, // 20 seconds delay before disconnecting when app is backgrounded or when user exits perps UX\n ConnectionTimeoutMs: 10_000, // 10 seconds timeout for connection and position loading states\n DefaultMonitoringTimeoutMs: 10_000, // 10 seconds default timeout for data monitoring operations\n\n // Connection timing constants\n ConnectionGracePeriodMs: 20_000, // 20 seconds grace period before actual disconnection (same as BackgroundDisconnectDelay for semantic clarity)\n ConnectionAttemptTimeoutMs: 30_000, // 30 seconds timeout for connection attempts to prevent indefinite hanging\n WebsocketPingTimeoutMs: 5_000, // 5 seconds timeout for WebSocket health check ping\n ConnectRetryDelayMs: 200, // Delay before retrying connect() when connection isn't ready yet\n ReconnectionCleanupDelayMs: 500, // Platform-agnostic delay to ensure WebSocket is ready\n ReconnectionDelayAndroidMs: 300, // Android-specific reconnection delay for better reliability on slower devices\n ReconnectionDelayIosMs: 100, // iOS-specific reconnection delay for optimal performance\n ReconnectionRetryDelayMs: 5_000, // 5 seconds delay between reconnection attempts\n\n // Connection manager timing constants\n BalanceUpdateThrottleMs: 15000, // Update at most every 15 seconds to reduce state updates in PerpsConnectionManager\n InitialDataDelayMs: 100, // Delay to allow initial data to load after connection establishment\n\n // Deposit toast timing\n DepositTakingLongerToastDelayMs: 30_000, // Delay before showing \"Deposit taking longer than usual\" toast\n\n DefaultAssetPreviewLimit: 5,\n DefaultMaxLeverage: 3 as number, // Default fallback max leverage when market data is unavailable - conservative default\n FallbackPriceDisplay: '$---', // Display when price data is unavailable\n FallbackPercentageDisplay: '--%', // Display when change data is unavailable\n FallbackDataDisplay: '--', // Display when non-price data is unavailable\n ZeroAmountDisplay: '$0', // Display for zero dollar amounts (e.g., no volume)\n ZeroAmountDetailedDisplay: '$0.00', // Display for zero dollar amounts with decimals\n\n RecentActivityLimit: 3,\n\n // Historical data fetching constants\n FillsLookbackMs: 90 * 24 * 60 * 60 * 1000, // 3 months in milliseconds - limits REST API fills fetch\n} as const;\n\n/**\n * Withdrawal-specific constants (protocol-agnostic)\n * Note: Protocol-specific values like estimated time should be defined in each protocol's config\n */\nexport const WITHDRAWAL_CONSTANTS = {\n DefaultMinAmount: '1.01', // Default minimum withdrawal amount in USDC\n DefaultFeeAmount: 1, // Default withdrawal fee in USDC\n DefaultFeeToken: 'USDC', // Default fee token\n} as const;\n\n/**\n * Validation thresholds for UI warnings and checks\n * These values control when warnings are shown to users\n */\nexport const VALIDATION_THRESHOLDS = {\n // Leverage threshold for warning users about high leverage\n HighLeverageWarning: 20, // Show warning when leverage > 20x\n\n // Limit price difference threshold (as decimal, 0.1 = 10%)\n LimitPriceDifferenceWarning: 0.1, // Warn if limit price differs by >10% from current price\n\n // Price deviation threshold (as decimal, 0.1 = 10%)\n PriceDeviation: 0.1, // Warn if perps price deviates by >10% from spot price\n} as const;\n\n/**\n * Order slippage configuration\n * Controls default slippage tolerance for different order types\n * Conservative defaults based on HyperLiquid platform interface\n * See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md\n */\nexport const ORDER_SLIPPAGE_CONFIG = {\n // Market order slippage (basis points)\n // 300 basis points = 3% = 0.03 decimal\n // Conservative default for measured rollout, prevents most IOC failures\n DefaultMarketSlippageBps: 300,\n\n // TP/SL order slippage (basis points)\n // 1000 basis points = 10% = 0.10 decimal\n // Aligns with HyperLiquid platform default for triggered orders\n DefaultTpslSlippageBps: 1000,\n\n // Limit order slippage (basis points)\n // 100 basis points = 1% = 0.01 decimal\n // Kept conservative as limit orders rest on book (not IOC/immediate execution)\n DefaultLimitSlippageBps: 100,\n} as const;\n\n/**\n * Performance optimization constants\n * These values control debouncing and throttling for better performance\n */\nexport const PERFORMANCE_CONFIG = {\n // Price updates debounce delay (milliseconds)\n // Batches rapid WebSocket price updates to reduce re-renders\n PriceUpdateDebounceMs: 1000,\n\n // Order validation debounce delay (milliseconds)\n // Prevents excessive validation calls during rapid form input changes\n ValidationDebounceMs: 300,\n\n // Liquidation price debounce delay (milliseconds)\n // Prevents excessive liquidation price calls during rapid form input changes\n LiquidationPriceDebounceMs: 500,\n\n // Navigation params delay (milliseconds)\n // Required for React Navigation to complete state transitions before setting params\n // This ensures navigation context is available when programmatically selecting tabs\n NavigationParamsDelayMs: 200,\n\n // Tab control reset delay (milliseconds)\n // Delay to reset programmatic tab control after tab switching to prevent render loops\n TabControlResetDelayMs: 500,\n\n // Market data cache duration (milliseconds)\n // How long to cache market list data before fetching fresh data\n MarketDataCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n // Asset metadata cache duration (milliseconds)\n // How long to cache asset icon validation results\n AssetMetadataCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Max leverage cache duration (milliseconds)\n // How long to cache max leverage values per asset (leverage rarely changes)\n MaxLeverageCacheDurationMs: 60 * 60 * 1000, // 1 hour\n\n // Rewards cache durations (milliseconds)\n // How long to cache fee discount data from rewards API\n FeeDiscountCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n // How long to cache points calculation parameters from rewards API\n PointsCalculationCacheDurationMs: 5 * 60 * 1000, // 5 minutes\n\n /**\n * Performance logging markers for filtering logs during development and debugging\n * These markers help isolate performance-related logs from general application logs\n * Usage: Use in DevLogger calls to easily filter specific performance areas\n * Impact: Development only (uses DevLogger) - zero production performance cost\n *\n * Examples:\n * - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`\n * - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`\n * - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`\n * - Filter all Perps performance: `adb logcat | grep PERPSMARK_`\n */\n LoggingMarkers: {\n // Sentry performance measurement logs (screen loads, bottom sheets, API timing)\n SentryPerformance: 'PERPSMARK_SENTRY',\n\n // MetaMetrics event tracking logs (user interactions, business analytics)\n MetametricsEvents: 'PERPSMARK_METRICS',\n\n // WebSocket performance logs (connection timing, data flow, reconnections)\n WebsocketPerformance: 'PERPSMARK_SENTRY_WS',\n } as const,\n} as const;\n\nexport const TP_SL_CONFIG = {\n UsePositionBoundTpsl: true,\n} as const;\n\n/**\n * HyperLiquid order limits based on leverage\n * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications\n */\nexport const HYPERLIQUID_ORDER_LIMITS = {\n // Market orders\n MarketOrderLimits: {\n // $15,000,000 for max leverage >= 25\n HighLeverage: 15_000_000,\n // $5,000,000 for max leverage in [20, 25)\n MediumHighLeverage: 5_000_000,\n // $2,000,000 for max leverage in [10, 20)\n MediumLeverage: 2_000_000,\n // $500,000 for max leverage < 10\n LowLeverage: 500_000,\n },\n // Limit orders are 10x market order limits\n LimitOrderMultiplier: 10,\n} as const;\n\n/**\n * Close position configuration\n * Controls behavior and constants specific to position closing\n */\nexport const CLOSE_POSITION_CONFIG = {\n // Decimal places for USD amount input display\n UsdDecimalPlaces: 2,\n\n // Default close percentage when opening the close position view\n DefaultClosePercentage: 100,\n\n // Precision for position size calculations to prevent rounding errors\n AmountCalculationPrecision: 6,\n\n // Throttle delay for real-time price updates during position closing\n PriceThrottleMs: 3000,\n\n // Fallback decimal places for tokens without metadata\n FallbackTokenDecimals: 18,\n} as const;\n\n/**\n * Margin adjustment configuration\n * Controls behavior for adding/removing margin from positions\n */\nexport const MARGIN_ADJUSTMENT_CONFIG = {\n // Risk thresholds for margin removal warnings\n // Threshold values represent ratio of (price distance to liquidation) / (liquidation price)\n // Values < 1.0 mean price is dangerously close to liquidation\n LiquidationRiskThreshold: 1.2, // 20% buffer before liquidation - triggers danger state\n LiquidationWarningThreshold: 1.5, // 50% buffer before liquidation - triggers warning state\n\n // Minimum margin adjustment amount (USD)\n // Prevents dust adjustments and ensures meaningful position changes\n MinAdjustmentAmount: 1,\n\n // Precision for margin calculations\n // Ensures accurate decimal handling in margin/leverage calculations\n CalculationPrecision: 6,\n\n // Safety buffer for margin removal to account for HyperLiquid's transfer margin requirement\n // HyperLiquid enforces: transfer_margin_required = max(initial_margin_required, 0.1 * total_position_value)\n // See: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/margin-and-pnl\n MarginRemovalSafetyBuffer: 0.1,\n\n // Fallback max leverage when market data is unavailable\n // Conservative value to prevent over-removal of margin\n // Most HyperLiquid assets support at least 50x leverage\n FallbackMaxLeverage: 50,\n} as const;\n\n/**\n * Data Lake API configuration\n * Endpoints for reporting perps trading activity for notifications\n */\nexport const DATA_LAKE_API_CONFIG = {\n // Order reporting endpoint - only used for mainnet perps trading\n OrdersEndpoint: 'https://perps.api.cx.metamask.io/api/v1/orders',\n} as const;\n\n/**\n * Decimal precision configuration\n * Controls maximum decimal places for price and input validation\n */\nexport const DECIMAL_PRECISION_CONFIG = {\n // Maximum decimal places for price input (matches Hyperliquid limit)\n // Used in TP/SL forms, limit price inputs, and price validation\n MaxPriceDecimals: 6,\n // Maximum significant figures allowed by HyperLiquid API\n // Orders with more than 5 significant figures will be rejected\n MaxSignificantFigures: 5,\n // Defensive fallback for size decimals when market data fails to load\n // Real szDecimals should always come from market data API (varies by asset)\n // Using 6 as safe maximum to prevent crashes (covers most assets)\n // NOTE: This is NOT semantically correct - just a defensive measure\n FallbackSizeDecimals: 6,\n} as const;\n\n/**\n * Market sorting configuration\n * Controls sorting behavior and presets for the trending markets view\n */\nexport const MARKET_SORTING_CONFIG = {\n // Default sort settings\n DefaultSortOptionId: 'volume' as const,\n DefaultDirection: 'desc' as const,\n\n // Available sort fields (only includes fields supported by PerpsMarketData)\n SortFields: {\n Volume: 'volume',\n PriceChange: 'priceChange',\n OpenInterest: 'openInterest',\n FundingRate: 'fundingRate',\n } as const,\n\n // Sort button presets for filter chips (simplified buttons without direction)\n SortButtonPresets: [\n { field: 'volume', labelKey: 'perps.sort.volume' },\n { field: 'priceChange', labelKey: 'perps.sort.price_change' },\n { field: 'fundingRate', labelKey: 'perps.sort.funding_rate' },\n ] as const,\n\n // Sort options for the bottom sheet\n // All options support direction toggle (high-to-low / low-to-high)\n SortOptions: [\n {\n id: 'volume',\n labelKey: 'perps.sort.volume',\n field: 'volume',\n direction: 'desc',\n },\n {\n id: 'priceChange',\n labelKey: 'perps.sort.price_change',\n field: 'priceChange',\n direction: 'desc',\n },\n {\n id: 'openInterest',\n labelKey: 'perps.sort.open_interest',\n field: 'openInterest',\n direction: 'desc',\n },\n {\n id: 'fundingRate',\n labelKey: 'perps.sort.funding_rate',\n field: 'fundingRate',\n direction: 'desc',\n },\n ] as const,\n} as const;\n\n/**\n * Type for valid sort option IDs\n * Derived from SORT_OPTIONS to ensure type safety\n * Valid values: 'volume' | 'priceChange' | 'openInterest' | 'fundingRate'\n */\nexport type SortOptionId =\n (typeof MARKET_SORTING_CONFIG.SortOptions)[number]['id'];\n\n/**\n * Provider configuration for multi-provider support\n */\nexport const PROVIDER_CONFIG = {\n /** Default perpetual DEX provider when no explicit selection exists */\n DefaultProvider: 'hyperliquid' as const,\n /** Force MYX to testnet only (mainnet credentials not yet available) */\n MYX_TESTNET_ONLY: true,\n} as const;\n"]}
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Perps feature constants - Controller layer (portable)
3
+ *
4
+ * This file contains only controller-portable configuration:
5
+ * - Constants used by controller logic, providers, and services
6
+ * - Calculation thresholds, API configs, and protocol constants
7
+ *
8
+ * UI-only constants (layout, display, navigation) live in:
9
+ * app/components/UI/Perps/constants/perpsConfig.ts
10
+ */
11
+ export declare const PERPS_CONSTANTS: {
12
+ readonly FeatureFlagKey: "perpsEnabled";
13
+ readonly FeatureName: "perps";
14
+ /** Token description used to identify the synthetic "Perps balance" option in pay-with token lists */
15
+ readonly PerpsBalanceTokenDescription: "perps-balance";
16
+ /** Symbol displayed for the synthetic "Perps balance" token in pay-with token lists */
17
+ readonly PerpsBalanceTokenSymbol: "USD";
18
+ readonly WebsocketTimeout: 5000;
19
+ readonly WebsocketCleanupDelay: 1000;
20
+ readonly BackgroundDisconnectDelay: 20000;
21
+ readonly ConnectionTimeoutMs: 10000;
22
+ readonly DefaultMonitoringTimeoutMs: 10000;
23
+ readonly ConnectionGracePeriodMs: 20000;
24
+ readonly ConnectionAttemptTimeoutMs: 30000;
25
+ readonly WebsocketPingTimeoutMs: 5000;
26
+ readonly ConnectRetryDelayMs: 200;
27
+ readonly ReconnectionCleanupDelayMs: 500;
28
+ readonly ReconnectionDelayAndroidMs: 300;
29
+ readonly ReconnectionDelayIosMs: 100;
30
+ readonly ReconnectionRetryDelayMs: 5000;
31
+ readonly BalanceUpdateThrottleMs: 15000;
32
+ readonly InitialDataDelayMs: 100;
33
+ readonly DepositTakingLongerToastDelayMs: 30000;
34
+ readonly DefaultAssetPreviewLimit: 5;
35
+ readonly DefaultMaxLeverage: number;
36
+ readonly FallbackPriceDisplay: "$---";
37
+ readonly FallbackPercentageDisplay: "--%";
38
+ readonly FallbackDataDisplay: "--";
39
+ readonly ZeroAmountDisplay: "$0";
40
+ readonly ZeroAmountDetailedDisplay: "$0.00";
41
+ readonly RecentActivityLimit: 3;
42
+ readonly FillsLookbackMs: number;
43
+ };
44
+ /**
45
+ * Withdrawal-specific constants (protocol-agnostic)
46
+ * Note: Protocol-specific values like estimated time should be defined in each protocol's config
47
+ */
48
+ export declare const WITHDRAWAL_CONSTANTS: {
49
+ readonly DefaultMinAmount: "1.01";
50
+ readonly DefaultFeeAmount: 1;
51
+ readonly DefaultFeeToken: "USDC";
52
+ };
53
+ /**
54
+ * Validation thresholds for UI warnings and checks
55
+ * These values control when warnings are shown to users
56
+ */
57
+ export declare const VALIDATION_THRESHOLDS: {
58
+ readonly HighLeverageWarning: 20;
59
+ readonly LimitPriceDifferenceWarning: 0.1;
60
+ readonly PriceDeviation: 0.1;
61
+ };
62
+ /**
63
+ * Order slippage configuration
64
+ * Controls default slippage tolerance for different order types
65
+ * Conservative defaults based on HyperLiquid platform interface
66
+ * See: docs/perps/hyperliquid/ORDER-MATCHING-ERRORS.md
67
+ */
68
+ export declare const ORDER_SLIPPAGE_CONFIG: {
69
+ readonly DefaultMarketSlippageBps: 300;
70
+ readonly DefaultTpslSlippageBps: 1000;
71
+ readonly DefaultLimitSlippageBps: 100;
72
+ };
73
+ /**
74
+ * Performance optimization constants
75
+ * These values control debouncing and throttling for better performance
76
+ */
77
+ export declare const PERFORMANCE_CONFIG: {
78
+ readonly PriceUpdateDebounceMs: 1000;
79
+ readonly ValidationDebounceMs: 300;
80
+ readonly LiquidationPriceDebounceMs: 500;
81
+ readonly NavigationParamsDelayMs: 200;
82
+ readonly TabControlResetDelayMs: 500;
83
+ readonly MarketDataCacheDurationMs: number;
84
+ readonly AssetMetadataCacheDurationMs: number;
85
+ readonly MaxLeverageCacheDurationMs: number;
86
+ readonly FeeDiscountCacheDurationMs: number;
87
+ readonly PointsCalculationCacheDurationMs: number;
88
+ /**
89
+ * Performance logging markers for filtering logs during development and debugging
90
+ * These markers help isolate performance-related logs from general application logs
91
+ * Usage: Use in DevLogger calls to easily filter specific performance areas
92
+ * Impact: Development only (uses DevLogger) - zero production performance cost
93
+ *
94
+ * Examples:
95
+ * - Filter Sentry performance logs: `adb logcat | grep PERPSMARK_SENTRY`
96
+ * - Filter MetaMetrics events: `adb logcat | grep PERPSMARK_METRICS`
97
+ * - Filter WebSocket performance: `adb logcat | grep PERPSMARK_WS`
98
+ * - Filter all Perps performance: `adb logcat | grep PERPSMARK_`
99
+ */
100
+ readonly LoggingMarkers: {
101
+ readonly SentryPerformance: "PERPSMARK_SENTRY";
102
+ readonly MetametricsEvents: "PERPSMARK_METRICS";
103
+ readonly WebsocketPerformance: "PERPSMARK_SENTRY_WS";
104
+ };
105
+ };
106
+ export declare const TP_SL_CONFIG: {
107
+ readonly UsePositionBoundTpsl: true;
108
+ };
109
+ /**
110
+ * HyperLiquid order limits based on leverage
111
+ * From: https://hyperliquid.gitbook.io/hyperliquid-docs/trading/contract-specifications
112
+ */
113
+ export declare const HYPERLIQUID_ORDER_LIMITS: {
114
+ readonly MarketOrderLimits: {
115
+ readonly HighLeverage: 15000000;
116
+ readonly MediumHighLeverage: 5000000;
117
+ readonly MediumLeverage: 2000000;
118
+ readonly LowLeverage: 500000;
119
+ };
120
+ readonly LimitOrderMultiplier: 10;
121
+ };
122
+ /**
123
+ * Close position configuration
124
+ * Controls behavior and constants specific to position closing
125
+ */
126
+ export declare const CLOSE_POSITION_CONFIG: {
127
+ readonly UsdDecimalPlaces: 2;
128
+ readonly DefaultClosePercentage: 100;
129
+ readonly AmountCalculationPrecision: 6;
130
+ readonly PriceThrottleMs: 3000;
131
+ readonly FallbackTokenDecimals: 18;
132
+ };
133
+ /**
134
+ * Margin adjustment configuration
135
+ * Controls behavior for adding/removing margin from positions
136
+ */
137
+ export declare const MARGIN_ADJUSTMENT_CONFIG: {
138
+ readonly LiquidationRiskThreshold: 1.2;
139
+ readonly LiquidationWarningThreshold: 1.5;
140
+ readonly MinAdjustmentAmount: 1;
141
+ readonly CalculationPrecision: 6;
142
+ readonly MarginRemovalSafetyBuffer: 0.1;
143
+ readonly FallbackMaxLeverage: 50;
144
+ };
145
+ /**
146
+ * Data Lake API configuration
147
+ * Endpoints for reporting perps trading activity for notifications
148
+ */
149
+ export declare const DATA_LAKE_API_CONFIG: {
150
+ readonly OrdersEndpoint: "https://perps.api.cx.metamask.io/api/v1/orders";
151
+ };
152
+ /**
153
+ * Decimal precision configuration
154
+ * Controls maximum decimal places for price and input validation
155
+ */
156
+ export declare const DECIMAL_PRECISION_CONFIG: {
157
+ readonly MaxPriceDecimals: 6;
158
+ readonly MaxSignificantFigures: 5;
159
+ readonly FallbackSizeDecimals: 6;
160
+ };
161
+ /**
162
+ * Market sorting configuration
163
+ * Controls sorting behavior and presets for the trending markets view
164
+ */
165
+ export declare const MARKET_SORTING_CONFIG: {
166
+ readonly DefaultSortOptionId: "volume";
167
+ readonly DefaultDirection: "desc";
168
+ readonly SortFields: {
169
+ readonly Volume: "volume";
170
+ readonly PriceChange: "priceChange";
171
+ readonly OpenInterest: "openInterest";
172
+ readonly FundingRate: "fundingRate";
173
+ };
174
+ readonly SortButtonPresets: readonly [{
175
+ readonly field: "volume";
176
+ readonly labelKey: "perps.sort.volume";
177
+ }, {
178
+ readonly field: "priceChange";
179
+ readonly labelKey: "perps.sort.price_change";
180
+ }, {
181
+ readonly field: "fundingRate";
182
+ readonly labelKey: "perps.sort.funding_rate";
183
+ }];
184
+ readonly SortOptions: readonly [{
185
+ readonly id: "volume";
186
+ readonly labelKey: "perps.sort.volume";
187
+ readonly field: "volume";
188
+ readonly direction: "desc";
189
+ }, {
190
+ readonly id: "priceChange";
191
+ readonly labelKey: "perps.sort.price_change";
192
+ readonly field: "priceChange";
193
+ readonly direction: "desc";
194
+ }, {
195
+ readonly id: "openInterest";
196
+ readonly labelKey: "perps.sort.open_interest";
197
+ readonly field: "openInterest";
198
+ readonly direction: "desc";
199
+ }, {
200
+ readonly id: "fundingRate";
201
+ readonly labelKey: "perps.sort.funding_rate";
202
+ readonly field: "fundingRate";
203
+ readonly direction: "desc";
204
+ }];
205
+ };
206
+ /**
207
+ * Type for valid sort option IDs
208
+ * Derived from SORT_OPTIONS to ensure type safety
209
+ * Valid values: 'volume' | 'priceChange' | 'openInterest' | 'fundingRate'
210
+ */
211
+ export type SortOptionId = (typeof MARKET_SORTING_CONFIG.SortOptions)[number]['id'];
212
+ /**
213
+ * Provider configuration for multi-provider support
214
+ */
215
+ export declare const PROVIDER_CONFIG: {
216
+ /** Default perpetual DEX provider when no explicit selection exists */
217
+ readonly DefaultProvider: "hyperliquid";
218
+ /** Force MYX to testnet only (mainnet credentials not yet available) */
219
+ readonly MYX_TESTNET_ONLY: true;
220
+ };
221
+ //# sourceMappingURL=perpsConfig.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perpsConfig.d.cts","sourceRoot":"","sources":["../../src/constants/perpsConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;IAG1B,sGAAsG;;IAEtG,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC/E,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;CASxB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;CAexB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;IAwC7B;;;;;;;;;;;OAWG;;;;;;CAWK,CAAC;AAEX,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;CAc3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;CAexB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;CAwB3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;CAGvB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;CAY3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDxB,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACtB,CAAC,OAAO,qBAAqB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B,uEAAuE;;IAEvE,wEAAwE;;CAEhE,CAAC"}