perp-cli 0.14.3 → 0.16.0

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 (363) hide show
  1. package/README.ja.md +243 -0
  2. package/README.ko.md +243 -0
  3. package/README.md +138 -405
  4. package/README.zh.md +243 -0
  5. package/dist/agent-wallet/store.d.ts +3 -2
  6. package/dist/agent-wallet/store.js +2 -2
  7. package/dist/api/public/hyperliquid.js +4 -0
  8. package/dist/api/public/lighter.d.ts +5 -0
  9. package/dist/api/public/lighter.js +5 -0
  10. package/dist/api/public/pacifica.js +85 -15
  11. package/dist/api/public/urls.d.ts +2 -0
  12. package/dist/api/public/urls.js +3 -0
  13. package/dist/arb/sizing.js +4 -2
  14. package/dist/arb/state.d.ts +6 -0
  15. package/dist/arb/utils.d.ts +1 -2
  16. package/dist/arb/utils.js +1 -2
  17. package/dist/balance-by-address.d.ts +39 -0
  18. package/dist/balance-by-address.js +44 -0
  19. package/dist/bot/apex/pulse.js +3 -0
  20. package/dist/bot/apex/radar.js +2 -1
  21. package/dist/bot/engine.d.ts +10 -1
  22. package/dist/bot/engine.js +14 -6
  23. package/dist/bot/indicators.d.ts +7 -0
  24. package/dist/bot/indicators.js +16 -0
  25. package/dist/bot/perp-order.d.ts +4 -4
  26. package/dist/bot/perp-order.js +5 -5
  27. package/dist/bot/quarantine.d.ts +1 -1
  28. package/dist/bot/quarantine.js +1 -1
  29. package/dist/bot/quote-rules.js +1 -1
  30. package/dist/bot/strategies/apex-strategy.js +3 -2
  31. package/dist/bot/strategies/engine-mm.js +6 -5
  32. package/dist/bot/strategies/funding-arb-strategy.js +12 -5
  33. package/dist/bot/strategies/funding-arb-utils.d.ts +15 -3
  34. package/dist/bot/strategies/funding-arb-utils.js +53 -20
  35. package/dist/bot/strategies/funding-auto.js +2 -2
  36. package/dist/bot/strategies/liquidation-mm.d.ts +1 -0
  37. package/dist/bot/strategies/liquidation-mm.js +8 -2
  38. package/dist/bot/strategies/momentum-breakout.d.ts +1 -0
  39. package/dist/bot/strategies/momentum-breakout.js +11 -3
  40. package/dist/bot/strategies/spot-perp-arb-strategy.d.ts +1 -1
  41. package/dist/bot/strategies/spot-perp-arb-strategy.js +6 -4
  42. package/dist/bot/strategies/spot-perp-executor.d.ts +1 -1
  43. package/dist/bot/strategies/spot-perp-executor.js +3 -3
  44. package/dist/bot/strategy-types.d.ts +2 -1
  45. package/dist/bot/tui/BotDashboard.d.ts +1 -1
  46. package/dist/bot/tui/BotDashboard.js +1 -1
  47. package/dist/cache.js +12 -6
  48. package/dist/cli-program.d.ts +15 -0
  49. package/dist/cli-program.js +126 -6
  50. package/dist/commands/account.js +168 -24
  51. package/dist/commands/agent-import.d.ts +7 -0
  52. package/dist/commands/agent-import.js +30 -1
  53. package/dist/commands/agent.d.ts +6 -3
  54. package/dist/commands/agent.js +160 -12
  55. package/dist/commands/arb/index.js +23 -81
  56. package/dist/commands/arb-auto.d.ts +24 -0
  57. package/dist/commands/arb-auto.js +175 -97
  58. package/dist/commands/arb.d.ts +20 -0
  59. package/dist/commands/arb.js +107 -163
  60. package/dist/commands/backtest.js +23 -21
  61. package/dist/commands/bot.js +1 -1
  62. package/dist/commands/builder.js +1 -1
  63. package/dist/commands/funds.js +113 -3
  64. package/dist/commands/init.d.ts +1 -1
  65. package/dist/commands/init.js +27 -7
  66. package/dist/commands/manage.js +23 -21
  67. package/dist/commands/market.d.ts +48 -0
  68. package/dist/commands/market.js +395 -100
  69. package/dist/commands/options.d.ts +14 -0
  70. package/dist/commands/options.js +151 -0
  71. package/dist/commands/pacifica-earn.d.ts +5 -0
  72. package/dist/commands/pacifica-earn.js +455 -0
  73. package/dist/commands/pacifica-orders.d.ts +14 -0
  74. package/dist/commands/pacifica-orders.js +142 -0
  75. package/dist/commands/portfolio.d.ts +16 -0
  76. package/dist/commands/portfolio.js +83 -55
  77. package/dist/commands/rebalance.d.ts +1 -0
  78. package/dist/commands/rebalance.js +15 -0
  79. package/dist/commands/risk.d.ts +11 -2
  80. package/dist/commands/risk.js +39 -44
  81. package/dist/commands/trade.d.ts +1 -0
  82. package/dist/commands/trade.js +67 -62
  83. package/dist/commands/wallet.js +1 -1
  84. package/dist/config.d.ts +2 -2
  85. package/dist/config.js +15 -4
  86. package/dist/constants.js +6 -0
  87. package/dist/cross-chain-margin.d.ts +3 -1
  88. package/dist/cross-chain-margin.js +4 -2
  89. package/dist/dashboard/server.js +3 -3
  90. package/dist/dashboard/ui.js +9 -6
  91. package/dist/errors.d.ts +29 -1
  92. package/dist/errors.js +35 -3
  93. package/dist/exchanges/address.d.ts +8 -0
  94. package/dist/exchanges/address.js +47 -0
  95. package/dist/exchanges/arcus/adapter.d.ts +16 -12
  96. package/dist/exchanges/arcus/adapter.js +45 -18
  97. package/dist/exchanges/arcus/agent.d.ts +1 -1
  98. package/dist/exchanges/arcus/agent.js +1 -1
  99. package/dist/exchanges/arcus/client.js +1 -1
  100. package/dist/exchanges/arcus/public.js +3 -2
  101. package/dist/exchanges/arcus/signing.d.ts +2 -3
  102. package/dist/exchanges/arcus/signing.js +1 -1
  103. package/dist/exchanges/arcus/spot-chain.d.ts +1 -1
  104. package/dist/exchanges/arcus/spot-chain.js +1 -1
  105. package/dist/exchanges/arcus/spot-router.d.ts +1 -1
  106. package/dist/exchanges/arcus/spot-router.js +2 -2
  107. package/dist/exchanges/arcus/spot.d.ts +2 -3
  108. package/dist/exchanges/arcus/spot.js +2 -3
  109. package/dist/exchanges/aster-spot.d.ts +3 -3
  110. package/dist/exchanges/aster-spot.js +6 -9
  111. package/dist/exchanges/aster-typed-data.d.ts +1 -1
  112. package/dist/exchanges/aster-typed-data.js +1 -1
  113. package/dist/exchanges/aster.d.ts +30 -10
  114. package/dist/exchanges/aster.js +153 -53
  115. package/dist/exchanges/builder-fee.d.ts +1 -1
  116. package/dist/exchanges/builder-fee.js +13 -2
  117. package/dist/exchanges/canonical-symbols.d.ts +8 -2
  118. package/dist/exchanges/canonical-symbols.js +46 -2
  119. package/dist/exchanges/capabilities.d.ts +2 -0
  120. package/dist/exchanges/capabilities.js +2 -1
  121. package/dist/exchanges/derive/client.d.ts +37 -0
  122. package/dist/exchanges/derive/client.js +135 -0
  123. package/dist/exchanges/derive/options.d.ts +73 -0
  124. package/dist/exchanges/derive/options.js +379 -0
  125. package/dist/exchanges/extended/adapter.d.ts +96 -0
  126. package/dist/exchanges/extended/adapter.js +241 -0
  127. package/dist/exchanges/extended/client.d.ts +38 -0
  128. package/dist/exchanges/extended/client.js +88 -0
  129. package/dist/exchanges/extended/public.d.ts +133 -0
  130. package/dist/exchanges/extended/public.js +436 -0
  131. package/dist/exchanges/grvt/adapter.d.ts +100 -0
  132. package/dist/exchanges/grvt/adapter.js +283 -0
  133. package/dist/exchanges/grvt/client.d.ts +25 -0
  134. package/dist/exchanges/grvt/client.js +86 -0
  135. package/dist/exchanges/grvt/public.d.ts +151 -0
  136. package/dist/exchanges/grvt/public.js +438 -0
  137. package/dist/exchanges/hyperliquid-outcome.d.ts +2 -0
  138. package/dist/exchanges/hyperliquid-outcome.js +29 -1
  139. package/dist/exchanges/hyperliquid-spot.d.ts +9 -1
  140. package/dist/exchanges/hyperliquid-spot.js +24 -16
  141. package/dist/exchanges/hyperliquid.d.ts +199 -22
  142. package/dist/exchanges/hyperliquid.js +550 -202
  143. package/dist/exchanges/index.d.ts +1 -1
  144. package/dist/exchanges/index.js +1 -1
  145. package/dist/exchanges/interface.d.ts +157 -13
  146. package/dist/exchanges/interface.js +47 -0
  147. package/dist/exchanges/ioc-outcome.d.ts +1 -1
  148. package/dist/exchanges/ioc-outcome.js +1 -1
  149. package/dist/exchanges/legacy-trading-v2.d.ts +2 -2
  150. package/dist/exchanges/legacy-trading-v2.js +7 -2
  151. package/dist/exchanges/lighter-public.d.ts +67 -12
  152. package/dist/exchanges/lighter-public.js +250 -82
  153. package/dist/exchanges/lighter-signer.d.ts +1 -1
  154. package/dist/exchanges/lighter-signer.js +1 -1
  155. package/dist/exchanges/lighter-spot.d.ts +10 -5
  156. package/dist/exchanges/lighter-spot.js +105 -97
  157. package/dist/exchanges/lighter.d.ts +80 -21
  158. package/dist/exchanges/lighter.js +312 -105
  159. package/dist/exchanges/ondo/adapter.d.ts +38 -13
  160. package/dist/exchanges/ondo/adapter.js +86 -27
  161. package/dist/exchanges/ondo/agent.d.ts +1 -1
  162. package/dist/exchanges/ondo/agent.js +1 -1
  163. package/dist/exchanges/ondo/client.d.ts +1 -1
  164. package/dist/exchanges/ondo/client.js +2 -2
  165. package/dist/exchanges/ondo/public.d.ts +35 -3
  166. package/dist/exchanges/ondo/public.js +75 -32
  167. package/dist/exchanges/ondo/spot.d.ts +2 -2
  168. package/dist/exchanges/ondo/spot.js +3 -3
  169. package/dist/exchanges/options-interface.d.ts +158 -0
  170. package/dist/exchanges/options-interface.js +17 -0
  171. package/dist/exchanges/options-venues.d.ts +12 -0
  172. package/dist/exchanges/options-venues.js +35 -0
  173. package/dist/exchanges/outcome-interface.d.ts +4 -0
  174. package/dist/exchanges/pacifica-atomic.d.ts +211 -0
  175. package/dist/exchanges/pacifica-atomic.js +440 -0
  176. package/dist/exchanges/pacifica-decimal.d.ts +10 -0
  177. package/dist/exchanges/pacifica-decimal.js +51 -0
  178. package/dist/exchanges/pacifica-presigned.d.ts +53 -0
  179. package/dist/exchanges/pacifica-presigned.js +141 -0
  180. package/dist/exchanges/pacifica-print.d.ts +200 -0
  181. package/dist/exchanges/pacifica-print.js +417 -0
  182. package/dist/exchanges/pacifica-spot.d.ts +8 -2
  183. package/dist/exchanges/pacifica-spot.js +26 -18
  184. package/dist/exchanges/pacifica-typed-data.d.ts +1 -1
  185. package/dist/exchanges/pacifica-typed-data.js +1 -1
  186. package/dist/exchanges/pacifica-vaults.d.ts +130 -0
  187. package/dist/exchanges/pacifica-vaults.js +277 -0
  188. package/dist/exchanges/pacifica.d.ts +108 -10
  189. package/dist/exchanges/pacifica.js +428 -171
  190. package/dist/exchanges/precision.d.ts +3 -1
  191. package/dist/exchanges/precision.js +9 -2
  192. package/dist/exchanges/public-balances.d.ts +25 -0
  193. package/dist/exchanges/public-balances.js +158 -0
  194. package/dist/exchanges/public-positions.d.ts +43 -0
  195. package/dist/exchanges/public-positions.js +154 -0
  196. package/dist/exchanges/qfex/adapter.d.ts +69 -13
  197. package/dist/exchanges/qfex/adapter.js +102 -17
  198. package/dist/exchanges/qfex/agent.d.ts +1 -1
  199. package/dist/exchanges/qfex/agent.js +1 -1
  200. package/dist/exchanges/qfex/client.d.ts +1 -1
  201. package/dist/exchanges/qfex/client.js +1 -1
  202. package/dist/exchanges/qfex/errors.d.ts +1 -1
  203. package/dist/exchanges/qfex/errors.js +2 -2
  204. package/dist/exchanges/qfex/public.d.ts +65 -12
  205. package/dist/exchanges/qfex/public.js +131 -25
  206. package/dist/exchanges/qfex/signing.d.ts +2 -2
  207. package/dist/exchanges/qfex/signing.js +4 -5
  208. package/dist/exchanges/qfex/ws-transport.d.ts +3 -3
  209. package/dist/exchanges/qfex/ws-transport.js +3 -3
  210. package/dist/exchanges/rate-limiter.d.ts +1 -1
  211. package/dist/exchanges/rate-limiter.js +5 -2
  212. package/dist/exchanges/registry.d.ts +1 -1
  213. package/dist/exchanges/registry.js +1 -1
  214. package/dist/exchanges/risex/adapter.d.ts +160 -0
  215. package/dist/exchanges/risex/adapter.js +842 -0
  216. package/dist/exchanges/risex/agent.d.ts +154 -0
  217. package/dist/exchanges/risex/agent.js +384 -0
  218. package/dist/exchanges/risex/client.d.ts +47 -0
  219. package/dist/exchanges/risex/client.js +174 -0
  220. package/dist/exchanges/risex/nonce.d.ts +43 -0
  221. package/dist/exchanges/risex/nonce.js +212 -0
  222. package/dist/exchanges/risex/public.d.ts +64 -0
  223. package/dist/exchanges/risex/public.js +150 -0
  224. package/dist/exchanges/risex/session.d.ts +71 -0
  225. package/dist/exchanges/risex/session.js +171 -0
  226. package/dist/exchanges/risex/typed-data.d.ts +173 -0
  227. package/dist/exchanges/risex/typed-data.js +240 -0
  228. package/dist/exchanges/risex/units.d.ts +29 -0
  229. package/dist/exchanges/risex/units.js +104 -0
  230. package/dist/exchanges/slippage.d.ts +1 -1
  231. package/dist/exchanges/slippage.js +1 -1
  232. package/dist/exchanges/spot-factory.d.ts +3 -3
  233. package/dist/exchanges/spot-factory.js +8 -8
  234. package/dist/exchanges/spot-interface.d.ts +5 -5
  235. package/dist/exchanges/spot-interface.js +2 -2
  236. package/dist/exchanges/spot-result.d.ts +3 -3
  237. package/dist/exchanges/spot-result.js +3 -3
  238. package/dist/exchanges/trading-v2.d.ts +3 -3
  239. package/dist/exchanges/trading-v2.js +9 -6
  240. package/dist/exchanges/txflow/adapter.d.ts +61 -0
  241. package/dist/exchanges/txflow/adapter.js +150 -0
  242. package/dist/exchanges/txflow/client.d.ts +47 -0
  243. package/dist/exchanges/txflow/client.js +155 -0
  244. package/dist/exchanges/txflow/public.d.ts +87 -0
  245. package/dist/exchanges/txflow/public.js +355 -0
  246. package/dist/exchanges/unknown-symbol.d.ts +34 -0
  247. package/dist/exchanges/unknown-symbol.js +56 -0
  248. package/dist/exchanges/variational/adapter.d.ts +67 -0
  249. package/dist/exchanges/variational/adapter.js +137 -0
  250. package/dist/exchanges/variational/client.d.ts +21 -0
  251. package/dist/exchanges/variational/client.js +66 -0
  252. package/dist/exchanges/variational/public.d.ts +126 -0
  253. package/dist/exchanges/variational/public.js +430 -0
  254. package/dist/exchanges/venue-types.d.ts +52 -10
  255. package/dist/exchanges/venue-types.js +82 -11
  256. package/dist/exchanges/venue.d.ts +150 -11
  257. package/dist/exchanges/venue.js +126 -4
  258. package/dist/exchanges/venues/arcus.d.ts +1 -2
  259. package/dist/exchanges/venues/arcus.js +5 -4
  260. package/dist/exchanges/venues/aster.d.ts +2 -2
  261. package/dist/exchanges/venues/aster.js +6 -4
  262. package/dist/exchanges/venues/create-helpers.d.ts +1 -1
  263. package/dist/exchanges/venues/create-helpers.js +3 -3
  264. package/dist/exchanges/venues/extended.d.ts +21 -0
  265. package/dist/exchanges/venues/extended.js +96 -0
  266. package/dist/exchanges/venues/grvt.d.ts +30 -0
  267. package/dist/exchanges/venues/grvt.js +98 -0
  268. package/dist/exchanges/venues/hyperliquid.d.ts +2 -2
  269. package/dist/exchanges/venues/hyperliquid.js +19 -8
  270. package/dist/exchanges/venues/index.d.ts +7 -2
  271. package/dist/exchanges/venues/index.js +8 -2
  272. package/dist/exchanges/venues/lighter-family.d.ts +7 -9
  273. package/dist/exchanges/venues/lighter-family.js +9 -11
  274. package/dist/exchanges/venues/lighter-rh.d.ts +2 -2
  275. package/dist/exchanges/venues/lighter-rh.js +20 -8
  276. package/dist/exchanges/venues/lighter.d.ts +1 -1
  277. package/dist/exchanges/venues/lighter.js +18 -6
  278. package/dist/exchanges/venues/ondo.d.ts +1 -1
  279. package/dist/exchanges/venues/ondo.js +5 -3
  280. package/dist/exchanges/venues/pacifica.d.ts +2 -2
  281. package/dist/exchanges/venues/pacifica.js +15 -4
  282. package/dist/exchanges/venues/qfex.d.ts +1 -1
  283. package/dist/exchanges/venues/qfex.js +4 -2
  284. package/dist/exchanges/venues/risex-release.d.ts +14 -0
  285. package/dist/exchanges/venues/risex-release.js +14 -0
  286. package/dist/exchanges/venues/risex.d.ts +31 -0
  287. package/dist/exchanges/venues/risex.js +131 -0
  288. package/dist/exchanges/venues/txflow.d.ts +18 -0
  289. package/dist/exchanges/venues/txflow.js +77 -0
  290. package/dist/exchanges/venues/variational.d.ts +21 -0
  291. package/dist/exchanges/venues/variational.js +85 -0
  292. package/dist/execution-log.d.ts +1 -1
  293. package/dist/funding/legacy-public.d.ts +6 -4
  294. package/dist/funding/legacy-public.js +42 -41
  295. package/dist/funding/normalize.d.ts +1 -1
  296. package/dist/funding/normalize.js +1 -1
  297. package/dist/funding/rates.d.ts +95 -6
  298. package/dist/funding/rates.js +99 -19
  299. package/dist/index.js +7 -6
  300. package/dist/jobs.d.ts +1 -0
  301. package/dist/jobs.js +25 -1
  302. package/dist/landing.d.ts +2 -0
  303. package/dist/landing.js +1 -1
  304. package/dist/liquidity.d.ts +3 -1
  305. package/dist/liquidity.js +8 -4
  306. package/dist/mcp-pacifica-earn.d.ts +9 -0
  307. package/dist/mcp-pacifica-earn.js +64 -0
  308. package/dist/mcp-server.js +211 -68
  309. package/dist/pacifica/client.d.ts +69 -5
  310. package/dist/pacifica/client.js +181 -8
  311. package/dist/pacifica/rate-limit.d.ts +144 -0
  312. package/dist/pacifica/rate-limit.js +267 -0
  313. package/dist/pacifica/types/order.d.ts +2 -1
  314. package/dist/plan-executor.js +7 -2
  315. package/dist/positions-by-address.d.ts +34 -0
  316. package/dist/positions-by-address.js +46 -0
  317. package/dist/rebalance.js +1 -1
  318. package/dist/risk.d.ts +2 -1
  319. package/dist/risk.js +2 -4
  320. package/dist/settings.d.ts +32 -3
  321. package/dist/signer/ows-evm.d.ts +1 -1
  322. package/dist/signer/ows-evm.js +1 -1
  323. package/dist/smart-order.d.ts +1 -1
  324. package/dist/smart-order.js +1 -1
  325. package/dist/strategies/funding-arb.d.ts +1 -1
  326. package/dist/strategies/funding-arb.js +36 -63
  327. package/dist/trade-validator.js +2 -2
  328. package/dist/utils.d.ts +22 -3
  329. package/dist/utils.js +11 -3
  330. package/dist/venue-health.d.ts +40 -0
  331. package/dist/venue-health.js +75 -0
  332. package/dist/withdraw-gate.d.ts +1 -1
  333. package/dist/withdraw-gate.js +1 -1
  334. package/dist/ws/arcus-market.d.ts +9 -0
  335. package/dist/ws/arcus-market.js +9 -0
  336. package/dist/ws/aster-market.d.ts +33 -0
  337. package/dist/ws/aster-market.js +30 -0
  338. package/dist/ws/index.d.ts +980 -0
  339. package/dist/ws/index.js +4460 -0
  340. package/dist/ws/lighter-market.d.ts +14 -0
  341. package/dist/ws/lighter-market.js +13 -0
  342. package/dist/ws/node.d.ts +996 -0
  343. package/dist/ws/node.js +4554 -0
  344. package/dist/ws/pacifica-instrument.d.ts +8 -0
  345. package/dist/ws/pacifica-instrument.js +8 -0
  346. package/dist/ws/unclassified.d.ts +16 -0
  347. package/dist/ws/unclassified.js +43 -0
  348. package/dist/ws-cli/credentials.d.ts +62 -0
  349. package/dist/ws-cli/credentials.js +126 -0
  350. package/package.json +71 -10
  351. package/skills/perp-cli/SKILL.md +153 -36
  352. package/skills/perp-cli/package.json +15 -2
  353. package/skills/perp-cli/references/agent-operations.md +22 -12
  354. package/skills/perp-cli/references/commands.md +143 -17
  355. package/skills/perp-cli/references/strategies.md +38 -3
  356. package/skills/perp-cli/references/ws-library.md +523 -0
  357. package/skills/perp-cli/scripts/arb-monitor.sh +13 -10
  358. package/skills/perp-cli/scripts/funding-analysis.sh +57 -29
  359. package/skills/perp-cli/scripts/preflight.sh +27 -19
  360. package/skills/perp-cli/scripts/spot-perp-scan.sh +58 -38
  361. package/skills/perp-cli/scripts/validate-arb.sh +56 -39
  362. package/dist/cli-spec.d.ts +0 -46
  363. package/dist/cli-spec.js +0 -81
@@ -7,7 +7,10 @@ import { registerFundsBridgeCommands } from "./bridge.js";
7
7
  import { registerFundsRebalanceCommands } from "./rebalance.js";
8
8
  import { PerpError, isConnectFailure, isDefiniteOrderFailure, isTransportFailure, orderOutcomeUnknown, parsePositiveDecimal } from "../errors.js";
9
9
  import { cliCredentialOptsFrom, requireMasterWallet } from "../config.js";
10
- import { getVenue, requireCapabilities, READ_ONLY_CREDENTIALS } from "../exchanges/venue.js";
10
+ import { getVenue, requireCapabilities, roleUnsupported, READ_ONLY_CREDENTIALS } from "../exchanges/venue.js";
11
+ import { RISEX_APP_URL, RISEX_FUNDS_APP_ONLY } from "../exchanges/venues/risex.js";
12
+ import { VARIATIONAL_READ_ONLY_REMEDIATION } from "../exchanges/venues/variational.js";
13
+ import { EXTENDED_READ_ONLY_REMEDIATION } from "../exchanges/venues/extended.js";
11
14
  import { unsupported } from "../exchanges/trading-v2.js";
12
15
  import { registerOnchainFundsCommands } from "./funds-onchain.js";
13
16
  import { QFEX_BANKER_NETWORK, QFEX_WITHDRAW_DISABLED, QFEX_WITHDRAW_ENABLED, QFEX_WITHDRAW_NETWORK } from "../exchanges/venues/qfex.js";
@@ -857,6 +860,34 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
857
860
  throw err;
858
861
  }
859
862
  });
863
+ supportsDryRun(faucet.command("risex"))
864
+ .description("[testnet tooling] Get the RISEx testnet faucet's 1000 test USDC (once per wallet; also registers the account; refused on mainnet; supports --dry-run). Refused while RISEx is read-only (trading in a later release)")
865
+ .action(async () => {
866
+ // Gated with RISEx trading (read-only release): the faucet is a venue write.
867
+ const risexDef = getVenue("risex");
868
+ if (!risexDef.roles.includes("trading"))
869
+ throw roleUnsupported(risexDef, "faucet");
870
+ const network = getNetwork();
871
+ if (network !== "testnet") {
872
+ throw unsupported("RISEx", `the test-USDC faucet on ${network}`, "the faucet exists only on testnet", "Run on testnet: perp -n testnet funds faucet risex");
873
+ }
874
+ const adapter = await getAdapterForExchange("risex");
875
+ const { RisexAdapter } = await import("../exchanges/risex/adapter.js");
876
+ if (!(adapter instanceof RisexAdapter))
877
+ throw new Error("risex venue did not produce a RisexAdapter");
878
+ const account = adapter.accountAddress();
879
+ if (isDryRun()) {
880
+ return printFundsPlan({ action: "deposit", venue: "risex", network, asset: "USDC (test)", amount: "1000", method: "testnet faucet POST /v1/account/deposit", account });
881
+ }
882
+ const res = await adapter.testnetFaucet();
883
+ logExecution({ type: "bridge", exchange: "risex", symbol: "USDC", side: "deposit", size: "1000", status: "success", dryRun: false, meta: { action: "faucet", network, account } });
884
+ if (isJson())
885
+ return printJson(jsonOk({ ...res, account, amount: "1000", network, method: "faucet" }));
886
+ console.log(chalk.green(`\n RISEx testnet faucet: 1000 test USDC requested for ${account}`));
887
+ if (res.txHash !== null)
888
+ console.log(` Tx: ${res.txHash}`);
889
+ console.log();
890
+ });
860
891
  // ═══════════════════════════════════════════════════════
861
892
  // WITHDRAW
862
893
  // ═══════════════════════════════════════════════════════
@@ -1049,7 +1080,7 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1049
1080
  throw err;
1050
1081
  }
1051
1082
  });
1052
- // ── Arcus — uniform surface (design §13.1): same <amount> + --to,
1083
+ // ── Arcus — uniform surface: same <amount> + --to,
1053
1084
  // same jsonOk(result), global --dry-run plans without sending. ──
1054
1085
  // Ondo Perps: the API does not allow withdrawals (address-book destinations only; adding one is
1055
1086
  // refused for API keys). The command stays so the refusal is explicit — also under --dry-run.
@@ -1059,6 +1090,42 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1059
1090
  .action(async () => {
1060
1091
  throw unsupported("Ondo Perps", "withdraw", "the Ondo Perps API does not allow withdrawals", "Withdraw from the Ondo Perps web app");
1061
1092
  });
1093
+ // RISEx: deposits / withdrawals are app-only (owner decision). The commands stay so the refusal
1094
+ // is explicit — also under --dry-run, before any credential or request.
1095
+ supportsDryRun(withdraw.command("risex [amount]"))
1096
+ .description(`Not available: RISEx withdrawals are done in the RISEx app (${RISEX_APP_URL}) — refused, also with --dry-run`)
1097
+ .option("--to <address>", "Ignored — perp-cli does not move RISEx funds")
1098
+ .action(async () => {
1099
+ throw unsupported("risex", "withdraw", RISEX_FUNDS_APP_ONLY.reason, RISEX_FUNDS_APP_ONLY.remediation);
1100
+ });
1101
+ // TxFlow: market data only (unofficial read-only API).
1102
+ supportsDryRun(withdraw.command("txflow [amount]"))
1103
+ .description("Not available: TxFlow is market data only in perp-cli (unofficial read-only API) — refused")
1104
+ .option("--to <address>", "Ignored")
1105
+ .action(async () => {
1106
+ throw roleUnsupported(getVenue("txflow"), "withdraw");
1107
+ });
1108
+ // Variational: read-only (market data) in perp-cli; no public trading API yet.
1109
+ supportsDryRun(withdraw.command("variational [amount]"))
1110
+ .description("Not available: Variational is read-only (market data) in perp-cli — refused")
1111
+ .option("--to <address>", "Ignored")
1112
+ .action(async () => {
1113
+ throw roleUnsupported(getVenue("variational"), "withdraw");
1114
+ });
1115
+ // GRVT: read-only (market data) in this version.
1116
+ supportsDryRun(withdraw.command("grvt [amount]"))
1117
+ .description("Not available: GRVT is read-only (market data) in this version — refused, also with --dry-run")
1118
+ .option("--to <address>", "Ignored")
1119
+ .action(async () => {
1120
+ throw roleUnsupported(getVenue("grvt"), "withdraw");
1121
+ });
1122
+ // Extended: market data only in this version.
1123
+ supportsDryRun(withdraw.command("extended [amount]"))
1124
+ .description("Not available: Extended is market data only in this version — refused, also with --dry-run")
1125
+ .option("--to <address>", "Ignored")
1126
+ .action(async () => {
1127
+ throw roleUnsupported(getVenue("extended"), "withdraw");
1128
+ });
1062
1129
  for (const venueId of ["arcus"]) {
1063
1130
  const def = getVenue(venueId);
1064
1131
  const asset = withdrawAssetOf(def);
@@ -1128,7 +1195,7 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1128
1195
  }
1129
1196
  });
1130
1197
  }
1131
- // ── QFEX (design §14.6, §14.12 #8) — custodial; deposit = address display, withdraw = banker POST
1198
+ // ── QFEX — custodial; deposit = address display, withdraw = banker POST
1132
1199
  // gated by settings.withdraw.qfex inside QfexAdapter.withdraw(); switched off (QFEX_WITHDRAW_ENABLED). ──
1133
1200
  /** QFEX adapter for the active network — the default imported key, or the one named by --agent. */
1134
1201
  const qfexAdapterFor = async (agentName) => {
@@ -1206,6 +1273,31 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1206
1273
  throw err;
1207
1274
  }
1208
1275
  });
1276
+ supportsDryRun(deposit.command("risex [amount]"))
1277
+ .description(`Not available: RISEx deposits are done in the RISEx app (${RISEX_APP_URL}) — refused, also with --dry-run`)
1278
+ .action(async () => {
1279
+ throw unsupported("risex", "deposit", RISEX_FUNDS_APP_ONLY.reason, RISEX_FUNDS_APP_ONLY.remediation);
1280
+ });
1281
+ supportsDryRun(deposit.command("txflow [amount]"))
1282
+ .description("Not available: TxFlow is market data only in perp-cli (unofficial read-only API) — refused")
1283
+ .action(async () => {
1284
+ throw roleUnsupported(getVenue("txflow"), "deposit");
1285
+ });
1286
+ supportsDryRun(deposit.command("variational [amount]"))
1287
+ .description("Not available: Variational is read-only (market data) in perp-cli — refused")
1288
+ .action(async () => {
1289
+ throw roleUnsupported(getVenue("variational"), "deposit");
1290
+ });
1291
+ supportsDryRun(deposit.command("grvt [amount]"))
1292
+ .description("Not available: GRVT is read-only (market data) in this version — refused, also with --dry-run")
1293
+ .action(async () => {
1294
+ throw roleUnsupported(getVenue("grvt"), "deposit");
1295
+ });
1296
+ supportsDryRun(deposit.command("extended [amount]"))
1297
+ .description("Not available: Extended is market data only in this version — refused, also with --dry-run")
1298
+ .action(async () => {
1299
+ throw roleUnsupported(getVenue("extended"), "deposit");
1300
+ });
1209
1301
  supportsDryRun(deposit.command("qfex"))
1210
1302
  .description("Show the QFEX deposit address for USDC on Arbitrum One (perp-cli sends nothing — transfer from your own wallet; supports --dry-run)")
1211
1303
  // --chain, not --network: the root -n/--network (mainnet | testnet) would swallow a subcommand --network.
@@ -1258,6 +1350,14 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1258
1350
  if (isNaN(amountNum) || amountNum <= 0)
1259
1351
  throw new Error("Invalid amount");
1260
1352
  const exchangeOpt = program.opts().exchange;
1353
+ // -e names a venue this command cannot move funds on: refuse instead of transferring on Hyperliquid.
1354
+ if (exchangeOpt !== undefined) {
1355
+ const def = getVenue(exchangeOpt);
1356
+ if (!def.roles.includes("account"))
1357
+ throw roleUnsupported(def, "transfer");
1358
+ if (def.id === "risex")
1359
+ throw unsupported("risex", "transfer", RISEX_FUNDS_APP_ONLY.reason, RISEX_FUNDS_APP_ONLY.remediation);
1360
+ }
1261
1361
  if (exchangeOpt !== undefined && getVenue(exchangeOpt).id === "qfex") {
1262
1362
  if (isDryRun()) {
1263
1363
  return printFundsPlan({ action: "transfer", venue: "qfex", network: getNetwork(), asset: "USDC", amount, from: opts.from ?? "the key's account", destination });
@@ -1349,6 +1449,11 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1349
1449
  qfex: { chain: "Arbitrum", token: "USDC", min: null, method: "address display only: perp funds deposit qfex, then send USDC from your wallet" },
1350
1450
  aster: { chain: "BNB Chain (default) / Arbitrum", token: "USDT (default) / USDC", min: null, gas: "BNB / Arbitrum ETH", method: "approve + vault depositFor(token, forAddress, amount, broker 1) (mainnet only)", command: "perp funds deposit aster <amount> [--chain bsc|arbitrum] [--asset USDT|USDC]" },
1351
1451
  ondo: { chain: "Arbitrum (default) / Ethereum", token: "USDC", min: null, gas: "ETH", method: "USDC transfer to the account's funding address (mainnet only)", command: "perp funds deposit ondo <amount> [--chain arbitrum|ethereum] [--probe <amount>]" },
1452
+ risex: { supported: false, note: `${RISEX_FUNDS_APP_ONLY.reason} — ${RISEX_FUNDS_APP_ONLY.remediation}`, testnet: getVenue("risex").roles.includes("trading") ? "perp -n testnet funds faucet risex (1000 test USDC, once)" : null },
1453
+ txflow: { supported: false, note: "TxFlow is market data only in perp-cli (unofficial read-only API)" },
1454
+ variational: { supported: false, note: VARIATIONAL_READ_ONLY_REMEDIATION },
1455
+ grvt: { supported: false, note: "GRVT is read-only (market data) in this version; trading is planned for a later release" },
1456
+ extended: { supported: false, note: EXTENDED_READ_ONLY_REMEDIATION },
1352
1457
  },
1353
1458
  withdraw: {
1354
1459
  pacifica: { chain: "Solana", token: "USDC", speed: "~10s", fee: "none" },
@@ -1360,6 +1465,11 @@ export function registerFundsCommands(program, getAdapter, isJson, getNetwork, g
1360
1465
  ? { chain: chainLabel(QFEX_WITHDRAW_NETWORK), token: "USDC", command: "perp funds withdraw qfex <amount> --to <allowlisted address>", gate: "settings withdraw.qfex (allowlist, maxPerTx, maxPerDay)", note: "needs a key with the \"Deposit and withdraw\" permission" }
1361
1466
  : { supported: false, note: `${QFEX_WITHDRAW_DISABLED.reason} — ${QFEX_WITHDRAW_DISABLED.remediation}` },
1362
1467
  arcus: { chain: "Robinhood Chain", token: "USDG", command: "perp funds withdraw arcus <amount>" },
1468
+ risex: { supported: false, note: `${RISEX_FUNDS_APP_ONLY.reason} — ${RISEX_FUNDS_APP_ONLY.remediation}` },
1469
+ txflow: { supported: false, note: "TxFlow is market data only in perp-cli (unofficial read-only API)" },
1470
+ variational: { supported: false, note: VARIATIONAL_READ_ONLY_REMEDIATION },
1471
+ grvt: { supported: false, note: "GRVT is read-only (market data) in this version; trading is planned for a later release" },
1472
+ extended: { supported: false, note: EXTENDED_READ_ONLY_REMEDIATION },
1363
1473
  aster: { chain: "BNB Chain (default) / Arbitrum", token: "USDT (default) / USDC", command: "perp funds withdraw aster <amount> [--chain bsc|arbitrum] [--asset USDT|USDC]", fee: "POST /fapi/v3/aster/user-withdraw-info (taken from the amount)", requires: "mainnet; API wallet approved with --can-withdraw --ip-whitelist; destination = the account's own address" },
1364
1474
  },
1365
1475
  }));
@@ -47,7 +47,7 @@ export interface SetupSettingsChange {
47
47
  export declare function applySetupSettings(change: SetupSettingsChange): Settings;
48
48
  /** Real follow-up commands for the configured venues (all exist in this CLI). */
49
49
  export declare function nextStepCommands(venues: VenueId[], network: Network): string[];
50
- /** Plain-language slippage explanation (design §13.2, §13.10 #3). */
50
+ /** Plain-language slippage explanation. */
51
51
  export declare function slippageExplanation(venues: VenueId[]): string[];
52
52
  export type AgentStepResult = {
53
53
  venue: VenueId;
@@ -9,8 +9,9 @@ import { PerpError, classifyError } from "../errors.js";
9
9
  import { jsonOk, jsonError, printJson } from "../utils.js";
10
10
  import { resolvePassphrase } from "../agent-wallet/passphrase.js";
11
11
  import { loadOws } from "../signer/ows-loader.js";
12
- import { getVenue, listVenuesWithRole, networkConfig, tryResolveVenueId } from "../exchanges/venue.js";
12
+ import { getVenue, listVenuesWithRole, networkConfig, roleUnsupported, tryResolveVenueId } from "../exchanges/venue.js";
13
13
  import "../exchanges/venues/index.js";
14
+ import { VARIATIONAL_READ_ONLY_REMEDIATION } from "../exchanges/venues/variational.js";
14
15
  import { maxDefaultSlippageBps, parseSlippageSettingBps } from "../exchanges/slippage.js";
15
16
  import { agentApproveUnsupportedReason, approveVenueAgent, assertLighterSlot, isLighterFamilyVenue, deprecatedPassphraseOption, printApproveOutcome, promptHidden, verifyVenueAgent, warnDeprecatedPassphrase, } from "./agent.js";
16
17
  import { importOwsWallet } from "./wallet.js";
@@ -127,7 +128,11 @@ export function setupVenues() {
127
128
  /** Resolve one venue id/alias for setup: must be a trading venue with an environment on `network`. */
128
129
  export function resolveSetupVenue(input, network) {
129
130
  const id = tryResolveVenueId(input.trim());
130
- if (id === null || !getVenue(id).roles.includes("trading")) {
131
+ // A registered venue without the trading role (release-gated RISEx, market-data-only TxFlow /
132
+ // Variational / GRVT) is a capability refusal, not an unknown name.
133
+ if (id !== null && !getVenue(id).roles.includes("trading"))
134
+ throw roleUnsupported(getVenue(id), "setup");
135
+ if (id === null) {
131
136
  throw new PerpError("INVALID_PARAMS", `Unknown trading venue "${input}"`, {
132
137
  remediation: `Use one of: ${setupVenues().map(v => v.id).join(", ")}`,
133
138
  });
@@ -177,7 +182,7 @@ export function applySetupSettings(change) {
177
182
  }
178
183
  /** Agent names already registered for `venue` on `network` in settings. */
179
184
  function registeredAgentNames(venue, network) {
180
- if (venue === "ondo" || venue === "arcus" || venue === "qfex") {
185
+ if (venue === "ondo" || venue === "arcus" || venue === "qfex" || venue === "risex") {
181
186
  const map = loadSettings().agents?.[venue];
182
187
  return map ? Object.values(map).filter(m => m.network === network).map(m => m.agentName) : [];
183
188
  }
@@ -186,11 +191,11 @@ function registeredAgentNames(venue, network) {
186
191
  function rotateHint(venue) {
187
192
  if (venue === "qfex")
188
193
  return "perp wallet agent import qfex --replace";
189
- return venue === "ondo" || venue === "arcus"
194
+ return venue === "ondo" || venue === "arcus" || venue === "risex"
190
195
  ? `perp wallet agent approve ${venue} --rotate`
191
196
  : `perp wallet agent rotate ${venue}`;
192
197
  }
193
- /** Why the wizard cannot register an agent for `venue` on `network`; null when it can (uniform wording, design §13.6). */
198
+ /** Why the wizard cannot register an agent for `venue` on `network`; null when it can (uniform wording). */
194
199
  function approveBlocker(venue, network) {
195
200
  const reason = agentApproveUnsupportedReason(venue, network, "approve");
196
201
  return reason === null ? null : `${getVenue(venue).displayName} agent management on ${network} not supported — ${reason}`;
@@ -215,7 +220,7 @@ export function nextStepCommands(venues, network) {
215
220
  cmds.push("perp settings show");
216
221
  return cmds;
217
222
  }
218
- /** Plain-language slippage explanation (design §13.2, §13.10 #3). */
223
+ /** Plain-language slippage explanation. */
219
224
  export function slippageExplanation(venues) {
220
225
  const lines = [
221
226
  "Market orders are sent as immediate-or-cancel (IOC) limit orders. The limit price is the",
@@ -260,6 +265,19 @@ function signingSummary(p, master) {
260
265
  return ["No signature. Your Ondo API key is stored encrypted in ~/.perp/ondo-agents/ and checked with one read-only account request."];
261
266
  case "qfex":
262
267
  return ["No signature. Your QFEX API key is stored encrypted in ~/.perp/qfex-agents/ and checked with read-only requests."];
268
+ case "risex":
269
+ return [
270
+ `EIP-712 RegisterSigner signed by master EVM ${master.evm} (+ VerifySigner by the new signer): registers a session signer (${expiry}).`,
271
+ `Then the new signer signs DisablePermission for every permission except trading, and ${master.evm} sends those transactions ON-CHAIN on RISE chain (needs RISE-chain ETH for gas): the signer can trade but never move funds, and only the master could re-enable a permission.`,
272
+ ];
273
+ case "txflow":
274
+ return ["Nothing — TxFlow is market data only (unofficial read-only API)."];
275
+ case "variational":
276
+ return [`Nothing — ${VARIATIONAL_READ_ONLY_REMEDIATION}.`];
277
+ case "grvt":
278
+ return ["Nothing — GRVT is read-only (market data) in this version; trading is planned for a later release."];
279
+ case "extended":
280
+ return ["Nothing — Extended is read-only (market data) in this version; trading is planned for a later release."];
263
281
  }
264
282
  }
265
283
  function failed(venue, err) {
@@ -944,7 +962,9 @@ export async function runNonInteractiveSetup(opts) {
944
962
  let defaultVenue = null;
945
963
  if (defaultRaw !== undefined) {
946
964
  const id = tryResolveVenueId(defaultRaw);
947
- if (id === null || !getVenue(id).roles.includes("trading")) {
965
+ if (id !== null && !getVenue(id).roles.includes("trading"))
966
+ throw roleUnsupported(getVenue(id), "setup");
967
+ if (id === null) {
948
968
  throw new PerpError("INVALID_PARAMS", `Invalid --default-venue "${defaultRaw}"`, {
949
969
  remediation: `Use one of: ${(venues.length > 0 ? venues : setupVenues().map(v => v.id)).join(", ")}`,
950
970
  });
@@ -99,9 +99,17 @@ export function registerWalletManageCommands(parent, getAdapter, isJson, getPaci
99
99
  .description("Create a new vault (lake)")
100
100
  .option("--manager <address>", "Manager address (omit to create a fresh vault with no manager)")
101
101
  .option("--nickname <name>", "Display name for the vault")
102
- .option("--initial-deposit <amount>", "Seed deposit in USDC from the creator")
102
+ .option("--initial-deposit <amount>", "Seed deposit in USDC from the creator (master-signed only: refused with an agent key)")
103
103
  .action(async (opts) => {
104
104
  const a = await pac();
105
+ // A seed deposit moves funds into a vault like `vault deposit`: master-signed only (an agent
106
+ // key must not be able to fund a vault it names the manager of).
107
+ if (opts.initialDeposit !== undefined && a.activeSignerTier !== "master" && a.activeSignerTier !== "pk") {
108
+ throw new PerpError("NO_SIGNER_AVAILABLE", "A vault seed deposit (--initial-deposit) must be signed by the master wallet, not the agent key", {
109
+ exchange: "pacifica",
110
+ remediation: "Re-run with --no-agent (master wallet), or create the vault without --initial-deposit and deposit with: perp -e pacifica vault deposit <vault> <amount>",
111
+ });
112
+ }
105
113
  const result = await a.sdk.createLake({
106
114
  manager: opts.manager === undefined ? null : opts.manager,
107
115
  nickname: opts.nickname === undefined ? null : opts.nickname,
@@ -112,26 +120,20 @@ export function registerWalletManageCommands(parent, getAdapter, isJson, getPaci
112
120
  console.log(chalk.green(`\n Vault created.\n`));
113
121
  console.log(JSON.stringify(result, null, 2));
114
122
  });
115
- lake
116
- .command("deposit <lake> <amount>")
117
- .description("Deposit USDC into a vault (<lake> = vault address)")
118
- .action(async (lakeAddress, amount) => {
119
- const a = await pac();
120
- const result = await a.sdk.depositToLake({ lake: lakeAddress, amount: parsePositiveDecimal(amount, "deposit amount") }, a.publicKey, a.signer);
121
- if (isJson())
122
- return printJson(jsonOk(result));
123
- console.log(chalk.green(`\n Deposited $${amount} to vault ${lakeAddress}.\n`));
124
- });
125
- lake
126
- .command("withdraw <lake> <shares>")
127
- .description("Redeem vault shares (<lake> = vault address, <shares> = number of shares, not USDC)")
128
- .action(async (lakeAddress, shares) => {
129
- const a = await pac();
130
- const result = await a.sdk.withdrawFromLake({ lake: lakeAddress, shares: parsePositiveDecimal(shares, "shares") }, a.publicKey, a.signer);
131
- if (isJson())
132
- return printJson(jsonOk(result));
133
- console.log(chalk.green(`\n Redeemed ${shares} shares from vault ${lakeAddress}.\n`));
134
- });
123
+ // deposit / withdraw moved to the validated path (`perp -e pacifica vault deposit|withdraw`):
124
+ // nickname / address resolution, documented limits, --dry-run, unknown-outcome handling, and a
125
+ // master-only vault deposit. These stubs refuse before any key is loaded or anything is signed.
126
+ for (const [sub, args, target] of [["deposit", "<lake> <amount>", "vault deposit <vault> <amount>"], ["withdraw", "<lake> <shares>", "vault withdraw <vault> <shares>|--all"]]) {
127
+ lake
128
+ .command(`${sub} ${args}`)
129
+ .description(`Moved: use perp -e pacifica ${target} (validated, supports --dry-run)`)
130
+ .action(() => {
131
+ throw new PerpError("INVALID_PARAMS", `wallet manage lake ${sub} was replaced by: perp -e pacifica ${target}`, {
132
+ exchange: "pacifica",
133
+ remediation: `Run: perp -e pacifica --dry-run ${target} — then without --dry-run (nothing was signed or sent)`,
134
+ });
135
+ });
136
+ }
135
137
  // Pacifica builder-OWNER tools. A user's builder approval / revoke / status is
136
138
  // `perp wallet builder approve|revoke|status <venue>` (settings builder.<venue>).
137
139
  const builder = manage.command("builder").description("Pacifica builder-owner tools (overview, trades, leaderboard, update-fee). Approve / revoke / status: perp wallet builder");
@@ -1,6 +1,54 @@
1
1
  import { Command } from "commander";
2
2
  import type { ExchangeAdapter } from "../exchanges/index.js";
3
3
  import "../exchanges/venues/index.js";
4
+ /**
5
+ * Venues of the multi-venue `market list|prices` (no -e): every venue with the marketData role
6
+ * and a (public) adapter — market-data-only venues (TxFlow, Variational, GRVT, Extended) included.
7
+ * They were left out in 0.15.0 because the list was the account-role venues.
8
+ */
9
+ export declare const MARKET_DATA_VENUES: import("../exchanges/venue-types.js").VenueId[];
10
+ /**
11
+ * `--limit` / `-l` / `--depth`: a positive integer, the same rule on every venue (parseInt took
12
+ * "abc" as NaN and "-5" as a negative slice). Anything else → INVALID_PARAMS before any request.
13
+ */
14
+ export declare function parsePositiveIntArg(raw: string, flag: string): number;
15
+ /**
16
+ * Most order-book levels per side each venue serves (measured live 2026-10-19; the request size
17
+ * where the venue takes one): one rule for every venue — `--depth` above it is INVALID_PARAMS
18
+ * naming the max, never clamped or silently short. Absent = the full book (Extended).
19
+ */
20
+ export declare const BOOK_DEPTH_MAX: Readonly<Record<string, number>>;
21
+ export declare function assertBookDepth(venue: string, depth: number): void;
22
+ /**
23
+ * `--start` / `--end`: unix ms (digits) or an ISO-8601 date / time (`Date.parse`; "2026-10-18" is
24
+ * UTC midnight). parseInt("2026-10-18") read 2026 ms. Non-finite → INVALID_PARAMS.
25
+ */
26
+ export declare function parseTimeArg(raw: string, flag: string): number;
27
+ /**
28
+ * Bare market symbol of a CLI argument as `market info` matches it against getMarkets() rows:
29
+ * "btc-perp" → "BTC", Extended "BTC-USD" / "TSLA_24_5-USD" → "BTC" / "TSLA", TxFlow "BTC-USDC" → "BTC"
30
+ * (book / funding resolve these through the venue; info read the raw argument and missed them).
31
+ * HIP-3 "xyz:XYZ100" keeps its prefix.
32
+ */
33
+ export declare function bareSymbolOf(arg: string): string;
34
+ /**
35
+ * History order, one rule for every venue: trades and funding history newest first, candles
36
+ * oldest first (Aster / QFEX answered funding oldest first, GRVT trades oldest first). A stable
37
+ * copy — the adapter's array (and its non-enumerable tape metadata) is left as is.
38
+ */
39
+ export declare function newestFirst<T extends {
40
+ time: number;
41
+ }>(rows: readonly T[]): T[];
42
+ export declare function notTradableReason(m: {
43
+ tradable?: boolean;
44
+ status?: string | null;
45
+ }): string | null;
4
46
  export declare function registerMarketCommands(program: Command, getAdapter: () => Promise<ExchangeAdapter>, isJson: () => boolean, getAdapterForExchange?: (exchange: string) => Promise<ExchangeAdapter>,
5
47
  /** Credentialed adapter of the selected venue — for market data the venue serves only to an authenticated account. */
6
48
  getAccountAdapter?: () => Promise<ExchangeAdapter>): void;
49
+ /**
50
+ * Why a listed market is not tradable, from the row's `status` when the venue states it (QFEX
51
+ * "nonUsdQuote", Ondo "closed" / "reduceOnly"); the generic off-hours text only when it does not.
52
+ * null = tradable or no tradability flag.
53
+ */
54
+ export declare function notTradableNote(m: object): string | null;