perp-cli 0.14.3 → 0.15.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 (311) hide show
  1. package/README.md +152 -13
  2. package/dist/agent-wallet/store.d.ts +3 -2
  3. package/dist/agent-wallet/store.js +2 -2
  4. package/dist/api/public/hyperliquid.js +4 -0
  5. package/dist/api/public/pacifica.js +83 -13
  6. package/dist/api/public/urls.d.ts +2 -0
  7. package/dist/api/public/urls.js +3 -0
  8. package/dist/arb/utils.d.ts +1 -2
  9. package/dist/arb/utils.js +1 -2
  10. package/dist/bot/apex/pulse.js +3 -0
  11. package/dist/bot/apex/radar.js +2 -1
  12. package/dist/bot/engine.d.ts +10 -1
  13. package/dist/bot/engine.js +14 -6
  14. package/dist/bot/indicators.d.ts +7 -0
  15. package/dist/bot/indicators.js +16 -0
  16. package/dist/bot/perp-order.d.ts +4 -4
  17. package/dist/bot/perp-order.js +5 -5
  18. package/dist/bot/quarantine.d.ts +1 -1
  19. package/dist/bot/quarantine.js +1 -1
  20. package/dist/bot/strategies/apex-strategy.js +3 -2
  21. package/dist/bot/strategies/engine-mm.js +6 -5
  22. package/dist/bot/strategies/funding-arb-strategy.js +2 -2
  23. package/dist/bot/strategies/funding-arb-utils.d.ts +1 -1
  24. package/dist/bot/strategies/funding-arb-utils.js +5 -5
  25. package/dist/bot/strategies/funding-auto.js +2 -2
  26. package/dist/bot/strategies/liquidation-mm.d.ts +1 -0
  27. package/dist/bot/strategies/liquidation-mm.js +8 -2
  28. package/dist/bot/strategies/momentum-breakout.d.ts +1 -0
  29. package/dist/bot/strategies/momentum-breakout.js +11 -3
  30. package/dist/bot/strategies/spot-perp-arb-strategy.js +2 -2
  31. package/dist/bot/strategies/spot-perp-executor.d.ts +1 -1
  32. package/dist/bot/strategies/spot-perp-executor.js +1 -1
  33. package/dist/bot/strategy-types.d.ts +2 -1
  34. package/dist/bot/tui/BotDashboard.d.ts +1 -1
  35. package/dist/bot/tui/BotDashboard.js +1 -1
  36. package/dist/cache.js +12 -6
  37. package/dist/cli-program.d.ts +15 -0
  38. package/dist/cli-program.js +125 -5
  39. package/dist/commands/agent-import.d.ts +7 -0
  40. package/dist/commands/agent-import.js +30 -1
  41. package/dist/commands/agent.d.ts +6 -3
  42. package/dist/commands/agent.js +160 -12
  43. package/dist/commands/arb/index.js +4 -4
  44. package/dist/commands/arb-auto.js +21 -17
  45. package/dist/commands/arb.d.ts +12 -0
  46. package/dist/commands/arb.js +61 -143
  47. package/dist/commands/bot.js +1 -1
  48. package/dist/commands/builder.js +1 -1
  49. package/dist/commands/funds.js +113 -3
  50. package/dist/commands/init.d.ts +1 -1
  51. package/dist/commands/init.js +27 -7
  52. package/dist/commands/manage.js +23 -21
  53. package/dist/commands/market.js +167 -35
  54. package/dist/commands/options.d.ts +9 -0
  55. package/dist/commands/options.js +134 -0
  56. package/dist/commands/pacifica-earn.d.ts +5 -0
  57. package/dist/commands/pacifica-earn.js +468 -0
  58. package/dist/commands/pacifica-orders.d.ts +14 -0
  59. package/dist/commands/pacifica-orders.js +142 -0
  60. package/dist/commands/portfolio.js +32 -47
  61. package/dist/commands/rebalance.d.ts +1 -0
  62. package/dist/commands/rebalance.js +15 -0
  63. package/dist/commands/risk.d.ts +11 -2
  64. package/dist/commands/risk.js +39 -44
  65. package/dist/commands/trade.d.ts +1 -0
  66. package/dist/commands/trade.js +63 -58
  67. package/dist/commands/wallet.js +1 -1
  68. package/dist/config.d.ts +2 -2
  69. package/dist/config.js +15 -4
  70. package/dist/constants.js +6 -0
  71. package/dist/dashboard/server.js +1 -1
  72. package/dist/errors.d.ts +24 -1
  73. package/dist/errors.js +25 -3
  74. package/dist/exchanges/arcus/adapter.d.ts +7 -7
  75. package/dist/exchanges/arcus/adapter.js +12 -12
  76. package/dist/exchanges/arcus/agent.d.ts +1 -1
  77. package/dist/exchanges/arcus/agent.js +1 -1
  78. package/dist/exchanges/arcus/client.js +1 -1
  79. package/dist/exchanges/arcus/signing.d.ts +2 -3
  80. package/dist/exchanges/arcus/signing.js +1 -1
  81. package/dist/exchanges/arcus/spot-chain.d.ts +1 -1
  82. package/dist/exchanges/arcus/spot-chain.js +1 -1
  83. package/dist/exchanges/arcus/spot-router.d.ts +1 -1
  84. package/dist/exchanges/arcus/spot-router.js +2 -2
  85. package/dist/exchanges/arcus/spot.d.ts +2 -3
  86. package/dist/exchanges/arcus/spot.js +2 -3
  87. package/dist/exchanges/aster-spot.d.ts +3 -3
  88. package/dist/exchanges/aster-spot.js +6 -9
  89. package/dist/exchanges/aster-typed-data.d.ts +1 -1
  90. package/dist/exchanges/aster-typed-data.js +1 -1
  91. package/dist/exchanges/aster.d.ts +4 -4
  92. package/dist/exchanges/aster.js +31 -13
  93. package/dist/exchanges/builder-fee.d.ts +1 -1
  94. package/dist/exchanges/builder-fee.js +13 -2
  95. package/dist/exchanges/canonical-symbols.d.ts +1 -2
  96. package/dist/exchanges/canonical-symbols.js +26 -2
  97. package/dist/exchanges/derive/client.d.ts +37 -0
  98. package/dist/exchanges/derive/client.js +135 -0
  99. package/dist/exchanges/derive/options.d.ts +68 -0
  100. package/dist/exchanges/derive/options.js +360 -0
  101. package/dist/exchanges/extended/adapter.d.ts +82 -0
  102. package/dist/exchanges/extended/adapter.js +179 -0
  103. package/dist/exchanges/extended/client.d.ts +38 -0
  104. package/dist/exchanges/extended/client.js +88 -0
  105. package/dist/exchanges/extended/public.d.ts +130 -0
  106. package/dist/exchanges/extended/public.js +429 -0
  107. package/dist/exchanges/grvt/adapter.d.ts +86 -0
  108. package/dist/exchanges/grvt/adapter.js +206 -0
  109. package/dist/exchanges/grvt/client.d.ts +25 -0
  110. package/dist/exchanges/grvt/client.js +86 -0
  111. package/dist/exchanges/grvt/public.d.ts +151 -0
  112. package/dist/exchanges/grvt/public.js +438 -0
  113. package/dist/exchanges/hyperliquid-spot.d.ts +1 -1
  114. package/dist/exchanges/hyperliquid-spot.js +5 -5
  115. package/dist/exchanges/hyperliquid.d.ts +22 -12
  116. package/dist/exchanges/hyperliquid.js +80 -34
  117. package/dist/exchanges/index.d.ts +1 -1
  118. package/dist/exchanges/index.js +1 -1
  119. package/dist/exchanges/interface.d.ts +94 -6
  120. package/dist/exchanges/interface.js +16 -0
  121. package/dist/exchanges/ioc-outcome.d.ts +1 -1
  122. package/dist/exchanges/ioc-outcome.js +1 -1
  123. package/dist/exchanges/legacy-trading-v2.d.ts +2 -2
  124. package/dist/exchanges/legacy-trading-v2.js +7 -2
  125. package/dist/exchanges/lighter-public.d.ts +2 -2
  126. package/dist/exchanges/lighter-public.js +2 -2
  127. package/dist/exchanges/lighter-signer.d.ts +1 -1
  128. package/dist/exchanges/lighter-signer.js +1 -1
  129. package/dist/exchanges/lighter-spot.d.ts +3 -4
  130. package/dist/exchanges/lighter-spot.js +6 -7
  131. package/dist/exchanges/lighter.d.ts +11 -11
  132. package/dist/exchanges/lighter.js +28 -14
  133. package/dist/exchanges/ondo/adapter.d.ts +5 -6
  134. package/dist/exchanges/ondo/adapter.js +16 -14
  135. package/dist/exchanges/ondo/agent.d.ts +1 -1
  136. package/dist/exchanges/ondo/agent.js +1 -1
  137. package/dist/exchanges/ondo/client.d.ts +1 -1
  138. package/dist/exchanges/ondo/client.js +2 -2
  139. package/dist/exchanges/ondo/public.d.ts +8 -1
  140. package/dist/exchanges/ondo/public.js +13 -2
  141. package/dist/exchanges/ondo/spot.d.ts +2 -2
  142. package/dist/exchanges/ondo/spot.js +3 -3
  143. package/dist/exchanges/options-interface.d.ts +158 -0
  144. package/dist/exchanges/options-interface.js +17 -0
  145. package/dist/exchanges/options-venues.d.ts +12 -0
  146. package/dist/exchanges/options-venues.js +35 -0
  147. package/dist/exchanges/pacifica-atomic.d.ts +211 -0
  148. package/dist/exchanges/pacifica-atomic.js +440 -0
  149. package/dist/exchanges/pacifica-decimal.d.ts +10 -0
  150. package/dist/exchanges/pacifica-decimal.js +51 -0
  151. package/dist/exchanges/pacifica-presigned.d.ts +53 -0
  152. package/dist/exchanges/pacifica-presigned.js +141 -0
  153. package/dist/exchanges/pacifica-print.d.ts +200 -0
  154. package/dist/exchanges/pacifica-print.js +417 -0
  155. package/dist/exchanges/pacifica-spot.d.ts +2 -2
  156. package/dist/exchanges/pacifica-spot.js +3 -3
  157. package/dist/exchanges/pacifica-typed-data.d.ts +1 -1
  158. package/dist/exchanges/pacifica-typed-data.js +1 -1
  159. package/dist/exchanges/pacifica-vaults.d.ts +121 -0
  160. package/dist/exchanges/pacifica-vaults.js +264 -0
  161. package/dist/exchanges/pacifica.d.ts +32 -5
  162. package/dist/exchanges/pacifica.js +114 -48
  163. package/dist/exchanges/precision.d.ts +3 -1
  164. package/dist/exchanges/precision.js +9 -2
  165. package/dist/exchanges/qfex/adapter.d.ts +18 -5
  166. package/dist/exchanges/qfex/adapter.js +32 -12
  167. package/dist/exchanges/qfex/agent.d.ts +1 -1
  168. package/dist/exchanges/qfex/agent.js +1 -1
  169. package/dist/exchanges/qfex/client.d.ts +1 -1
  170. package/dist/exchanges/qfex/client.js +1 -1
  171. package/dist/exchanges/qfex/errors.d.ts +1 -1
  172. package/dist/exchanges/qfex/errors.js +2 -2
  173. package/dist/exchanges/qfex/public.d.ts +3 -3
  174. package/dist/exchanges/qfex/public.js +3 -3
  175. package/dist/exchanges/qfex/signing.d.ts +2 -2
  176. package/dist/exchanges/qfex/signing.js +4 -5
  177. package/dist/exchanges/qfex/ws-transport.d.ts +2 -2
  178. package/dist/exchanges/qfex/ws-transport.js +3 -3
  179. package/dist/exchanges/rate-limiter.d.ts +1 -1
  180. package/dist/exchanges/rate-limiter.js +5 -2
  181. package/dist/exchanges/registry.d.ts +1 -1
  182. package/dist/exchanges/registry.js +1 -1
  183. package/dist/exchanges/risex/adapter.d.ts +148 -0
  184. package/dist/exchanges/risex/adapter.js +796 -0
  185. package/dist/exchanges/risex/agent.d.ts +154 -0
  186. package/dist/exchanges/risex/agent.js +384 -0
  187. package/dist/exchanges/risex/client.d.ts +47 -0
  188. package/dist/exchanges/risex/client.js +174 -0
  189. package/dist/exchanges/risex/nonce.d.ts +43 -0
  190. package/dist/exchanges/risex/nonce.js +212 -0
  191. package/dist/exchanges/risex/public.d.ts +64 -0
  192. package/dist/exchanges/risex/public.js +150 -0
  193. package/dist/exchanges/risex/session.d.ts +71 -0
  194. package/dist/exchanges/risex/session.js +171 -0
  195. package/dist/exchanges/risex/typed-data.d.ts +173 -0
  196. package/dist/exchanges/risex/typed-data.js +240 -0
  197. package/dist/exchanges/risex/units.d.ts +29 -0
  198. package/dist/exchanges/risex/units.js +104 -0
  199. package/dist/exchanges/slippage.d.ts +1 -1
  200. package/dist/exchanges/slippage.js +1 -1
  201. package/dist/exchanges/spot-factory.d.ts +3 -3
  202. package/dist/exchanges/spot-factory.js +7 -7
  203. package/dist/exchanges/spot-interface.d.ts +5 -5
  204. package/dist/exchanges/spot-interface.js +2 -2
  205. package/dist/exchanges/spot-result.d.ts +3 -3
  206. package/dist/exchanges/spot-result.js +3 -3
  207. package/dist/exchanges/trading-v2.d.ts +3 -3
  208. package/dist/exchanges/trading-v2.js +9 -6
  209. package/dist/exchanges/txflow/adapter.d.ts +54 -0
  210. package/dist/exchanges/txflow/adapter.js +118 -0
  211. package/dist/exchanges/txflow/client.d.ts +47 -0
  212. package/dist/exchanges/txflow/client.js +153 -0
  213. package/dist/exchanges/txflow/public.d.ts +76 -0
  214. package/dist/exchanges/txflow/public.js +284 -0
  215. package/dist/exchanges/unknown-symbol.d.ts +29 -0
  216. package/dist/exchanges/unknown-symbol.js +51 -0
  217. package/dist/exchanges/variational/adapter.d.ts +71 -0
  218. package/dist/exchanges/variational/adapter.js +137 -0
  219. package/dist/exchanges/variational/client.d.ts +21 -0
  220. package/dist/exchanges/variational/client.js +66 -0
  221. package/dist/exchanges/variational/public.d.ts +126 -0
  222. package/dist/exchanges/variational/public.js +430 -0
  223. package/dist/exchanges/venue-types.d.ts +6 -7
  224. package/dist/exchanges/venue-types.js +2 -2
  225. package/dist/exchanges/venue.d.ts +51 -8
  226. package/dist/exchanges/venue.js +54 -4
  227. package/dist/exchanges/venues/arcus.d.ts +1 -2
  228. package/dist/exchanges/venues/arcus.js +5 -4
  229. package/dist/exchanges/venues/aster.d.ts +2 -2
  230. package/dist/exchanges/venues/aster.js +6 -4
  231. package/dist/exchanges/venues/create-helpers.d.ts +1 -1
  232. package/dist/exchanges/venues/create-helpers.js +3 -3
  233. package/dist/exchanges/venues/extended.d.ts +21 -0
  234. package/dist/exchanges/venues/extended.js +96 -0
  235. package/dist/exchanges/venues/grvt.d.ts +30 -0
  236. package/dist/exchanges/venues/grvt.js +98 -0
  237. package/dist/exchanges/venues/hyperliquid.d.ts +2 -2
  238. package/dist/exchanges/venues/hyperliquid.js +10 -8
  239. package/dist/exchanges/venues/index.d.ts +7 -2
  240. package/dist/exchanges/venues/index.js +8 -2
  241. package/dist/exchanges/venues/lighter-family.d.ts +7 -9
  242. package/dist/exchanges/venues/lighter-family.js +9 -11
  243. package/dist/exchanges/venues/lighter-rh.d.ts +2 -2
  244. package/dist/exchanges/venues/lighter-rh.js +7 -5
  245. package/dist/exchanges/venues/lighter.d.ts +1 -1
  246. package/dist/exchanges/venues/lighter.js +5 -3
  247. package/dist/exchanges/venues/ondo.d.ts +1 -1
  248. package/dist/exchanges/venues/ondo.js +5 -3
  249. package/dist/exchanges/venues/pacifica.d.ts +2 -2
  250. package/dist/exchanges/venues/pacifica.js +6 -4
  251. package/dist/exchanges/venues/qfex.d.ts +1 -1
  252. package/dist/exchanges/venues/qfex.js +4 -2
  253. package/dist/exchanges/venues/risex-release.d.ts +14 -0
  254. package/dist/exchanges/venues/risex-release.js +14 -0
  255. package/dist/exchanges/venues/risex.d.ts +31 -0
  256. package/dist/exchanges/venues/risex.js +116 -0
  257. package/dist/exchanges/venues/txflow.d.ts +18 -0
  258. package/dist/exchanges/venues/txflow.js +77 -0
  259. package/dist/exchanges/venues/variational.d.ts +21 -0
  260. package/dist/exchanges/venues/variational.js +85 -0
  261. package/dist/execution-log.d.ts +1 -1
  262. package/dist/funding/legacy-public.d.ts +1 -1
  263. package/dist/funding/legacy-public.js +9 -4
  264. package/dist/funding/normalize.d.ts +1 -1
  265. package/dist/funding/normalize.js +1 -1
  266. package/dist/funding/rates.d.ts +44 -4
  267. package/dist/funding/rates.js +56 -12
  268. package/dist/index.js +7 -6
  269. package/dist/jobs.d.ts +1 -0
  270. package/dist/jobs.js +25 -1
  271. package/dist/landing.d.ts +2 -0
  272. package/dist/landing.js +1 -1
  273. package/dist/mcp-pacifica-earn.d.ts +9 -0
  274. package/dist/mcp-pacifica-earn.js +58 -0
  275. package/dist/mcp-server.js +113 -59
  276. package/dist/pacifica/client.d.ts +67 -4
  277. package/dist/pacifica/client.js +170 -8
  278. package/dist/pacifica/rate-limit.d.ts +144 -0
  279. package/dist/pacifica/rate-limit.js +267 -0
  280. package/dist/pacifica/types/order.d.ts +2 -1
  281. package/dist/plan-executor.js +7 -2
  282. package/dist/rebalance.js +1 -1
  283. package/dist/risk.d.ts +2 -1
  284. package/dist/risk.js +2 -4
  285. package/dist/settings.d.ts +32 -3
  286. package/dist/signer/ows-evm.d.ts +1 -1
  287. package/dist/signer/ows-evm.js +1 -1
  288. package/dist/smart-order.d.ts +1 -1
  289. package/dist/smart-order.js +1 -1
  290. package/dist/strategies/funding-arb.d.ts +1 -1
  291. package/dist/strategies/funding-arb.js +1 -1
  292. package/dist/trade-validator.js +2 -2
  293. package/dist/utils.d.ts +12 -3
  294. package/dist/utils.js +11 -3
  295. package/dist/venue-health.d.ts +40 -0
  296. package/dist/venue-health.js +75 -0
  297. package/dist/withdraw-gate.d.ts +1 -1
  298. package/dist/withdraw-gate.js +1 -1
  299. package/dist/ws/index.d.ts +959 -0
  300. package/dist/ws/index.js +4295 -0
  301. package/dist/ws/node.d.ts +975 -0
  302. package/dist/ws/node.js +4366 -0
  303. package/dist/ws/pacifica-instrument.d.ts +8 -0
  304. package/dist/ws/pacifica-instrument.js +8 -0
  305. package/dist/ws-cli/credentials.d.ts +62 -0
  306. package/dist/ws-cli/credentials.js +126 -0
  307. package/package.json +58 -10
  308. package/skills/perp-cli/SKILL.md +62 -9
  309. package/skills/perp-cli/references/agent-operations.md +7 -0
  310. package/skills/perp-cli/references/commands.md +76 -5
  311. package/skills/perp-cli/references/ws-library.md +492 -0
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Lighter-family constants shared by the `lighter` and `lighter-rh` venues
3
- * (design §4 "Lighter RH" row, §10.3–§10.5, §10.8, §10.13 #4).
4
3
  *
5
4
  * Both venues run the same API/engine and the same LighterAdapter class; they
6
5
  * differ only in the values below. This module has no runtime imports so venue
@@ -11,8 +10,7 @@ export type LighterVenueId = "lighter" | "lighter-rh";
11
10
  /**
12
11
  * Lighter (main). REST hosts are the values LighterAdapter used before
13
12
  * venue-parameterization. Mainnet WS is the one ws-feeds.ts connects to.
14
- * Testnet WS is not in code or docs we hold → null (a WS upgrade on
15
- * wss://testnet.zklighter.elliot.ai/stream answered 101 on 2026-09-30, but that is a probe, not a source).
13
+ * Testnet WS per apidocs.lighter.xyz websocket-reference (opened in the 2026-10-13 ws probe).
16
14
  * explorerUrl is the explorer API host; callers append `/api/...`
17
15
  * (lighter-spot.ts uses `${explorerUrl}/api/markets`). The testnet explorer host
18
16
  * is the one lighter-ts-sdk documented (`https://testnet.explorer.elliot.ai/api`).
@@ -30,7 +28,8 @@ export declare const LIGHTER_NETWORKS: {
30
28
  * explorerUrl is the explorer **API** host (`https://explorerapi.rh.lighter.xyz/api/`,
31
29
  * rate-limits.md); no UI explorer URL is documented.
32
30
  * Testnet WS is not documented → null (a WS upgrade on
33
- * wss://api.rh-testnet.lighter.xyz/stream answered 101 on 2026-09-30).
31
+ * wss://api.rh-testnet.lighter.xyz/stream answered 101 on 2026-09-30, but HTTP 403 from
32
+ * CloudFront in the 2026-10-13 ws probe).
34
33
  * Testnet explorer is not documented → null.
35
34
  * rpcUrl (mainnet): Robinhood Chain RPC — the L1 the RH contract lives on
36
35
  * (GET /api/v1/layer1BasicInfo l1_providers chainId 4663; eth_chainId 0x1237 verified
@@ -46,22 +45,21 @@ export declare function lighterFamilyNetworks(venue: LighterVenueId): {
46
45
  testnet: VenueNetworkConfig;
47
46
  };
48
47
  /**
49
- * §10.8 + §10.13 #4 + §13.3. timeInForce lists the CLI inputs the adapter accepts:
48
+ * timeInForce lists the CLI inputs the adapter accepts:
50
49
  * GTC is mapped to GTT (28-day expiry, LIGHTER_GTT_EXPIRY_MS) by LighterAdapter.limitOrder;
51
50
  * ALO is sent as time-in-force 2 (POST_ONLY); FOK is not offered.
52
- * clientOrderId (§13.10 #9): Lighter `clientOrderIndex`, a numeric id — CLI format rule
51
+ * clientOrderId: Lighter `clientOrderIndex`, a numeric id — CLI format rule
53
52
  * in LIGHTER_CLIENT_ORDER_INDEX_MAX / lighterClientOrderIndex() (lighter.ts).
54
53
  */
55
54
  export declare const LIGHTER_CAPABILITIES: VenueCapabilities;
56
55
  /**
57
56
  * GTC/GTT (and post-only) resting-order lifetime on both Lighter venues: orderExpiry -1 is
58
57
  * resolved to now + 28 days by LighterWasmSigner (the venue allows 5 min – 30 days).
59
- * Recorded as the execution record's expiry for GTC→GTT (§13.10 #14).
58
+ * Recorded as the execution record's expiry for GTC→GTT.
60
59
  */
61
60
  export declare const LIGHTER_GTT_EXPIRY_MS: number;
62
61
  /**
63
- * The ONE declared reference price for slippage-bounded orders on both Lighter venues
64
- * (§13.10 #5): mid of best bid / best ask from `/api/v1/orderBookOrders`. Replaces
62
+ * The ONE declared reference price for slippage-bounded orders on both Lighter venues: mid of best bid / best ask from `/api/v1/orderBookOrders`. Replaces
65
63
  * orderBookDetails `last_trade_price` (stale on thin RH stock books). No runtime
66
64
  * substitute: a missing side → PRICE_STALE before anything is sent.
67
65
  */
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Lighter-family constants shared by the `lighter` and `lighter-rh` venues
3
- * (design §4 "Lighter RH" row, §10.3–§10.5, §10.8, §10.13 #4).
4
3
  *
5
4
  * Both venues run the same API/engine and the same LighterAdapter class; they
6
5
  * differ only in the values below. This module has no runtime imports so venue
@@ -9,8 +8,7 @@
9
8
  /**
10
9
  * Lighter (main). REST hosts are the values LighterAdapter used before
11
10
  * venue-parameterization. Mainnet WS is the one ws-feeds.ts connects to.
12
- * Testnet WS is not in code or docs we hold → null (a WS upgrade on
13
- * wss://testnet.zklighter.elliot.ai/stream answered 101 on 2026-09-30, but that is a probe, not a source).
11
+ * Testnet WS per apidocs.lighter.xyz websocket-reference (opened in the 2026-10-13 ws probe).
14
12
  * explorerUrl is the explorer API host; callers append `/api/...`
15
13
  * (lighter-spot.ts uses `${explorerUrl}/api/markets`). The testnet explorer host
16
14
  * is the one lighter-ts-sdk documented (`https://testnet.explorer.elliot.ai/api`).
@@ -29,7 +27,7 @@ export const LIGHTER_NETWORKS = {
29
27
  },
30
28
  testnet: {
31
29
  restUrl: "https://testnet.zklighter.elliot.ai",
32
- wsUrl: null,
30
+ wsUrl: "wss://testnet.zklighter.elliot.ai/stream",
33
31
  explorerUrl: "https://testnet.explorer.elliot.ai",
34
32
  signingChainId: 300,
35
33
  settlementChain: "ethereum",
@@ -48,7 +46,8 @@ export const LIGHTER_NETWORKS = {
48
46
  * explorerUrl is the explorer **API** host (`https://explorerapi.rh.lighter.xyz/api/`,
49
47
  * rate-limits.md); no UI explorer URL is documented.
50
48
  * Testnet WS is not documented → null (a WS upgrade on
51
- * wss://api.rh-testnet.lighter.xyz/stream answered 101 on 2026-09-30).
49
+ * wss://api.rh-testnet.lighter.xyz/stream answered 101 on 2026-09-30, but HTTP 403 from
50
+ * CloudFront in the 2026-10-13 ws probe).
52
51
  * Testnet explorer is not documented → null.
53
52
  * rpcUrl (mainnet): Robinhood Chain RPC — the L1 the RH contract lives on
54
53
  * (GET /api/v1/layer1BasicInfo l1_providers chainId 4663; eth_chainId 0x1237 verified
@@ -98,17 +97,17 @@ export function lighterFamilyNetworks(venue) {
98
97
  }
99
98
  }
100
99
  /**
101
- * §10.8 + §10.13 #4 + §13.3. timeInForce lists the CLI inputs the adapter accepts:
100
+ * timeInForce lists the CLI inputs the adapter accepts:
102
101
  * GTC is mapped to GTT (28-day expiry, LIGHTER_GTT_EXPIRY_MS) by LighterAdapter.limitOrder;
103
102
  * ALO is sent as time-in-force 2 (POST_ONLY); FOK is not offered.
104
- * clientOrderId (§13.10 #9): Lighter `clientOrderIndex`, a numeric id — CLI format rule
103
+ * clientOrderId: Lighter `clientOrderIndex`, a numeric id — CLI format rule
105
104
  * in LIGHTER_CLIENT_ORDER_INDEX_MAX / lighterClientOrderIndex() (lighter.ts).
106
105
  */
107
106
  export const LIGHTER_CAPABILITIES = {
108
107
  marketOrder: "slippageBounded",
109
108
  // ALO → time-in-force 2 = POST_ONLY (apidocs trading.md; signed by the official lighter-go
110
109
  // v1.0.9 WASM). Testnet confirmation that a crossing post-only is cancelled
111
- // (canceled-post-only) is still pending (design §11).
110
+ // (canceled-post-only) is still pending.
112
111
  timeInForce: ["GTC", "GTT", "IOC", "ALO"],
113
112
  reduceOnlyTif: null,
114
113
  clientOrderId: true,
@@ -122,12 +121,11 @@ export const LIGHTER_CAPABILITIES = {
122
121
  /**
123
122
  * GTC/GTT (and post-only) resting-order lifetime on both Lighter venues: orderExpiry -1 is
124
123
  * resolved to now + 28 days by LighterWasmSigner (the venue allows 5 min – 30 days).
125
- * Recorded as the execution record's expiry for GTC→GTT (§13.10 #14).
124
+ * Recorded as the execution record's expiry for GTC→GTT.
126
125
  */
127
126
  export const LIGHTER_GTT_EXPIRY_MS = 28 * 24 * 60 * 60 * 1000;
128
127
  /**
129
- * The ONE declared reference price for slippage-bounded orders on both Lighter venues
130
- * (§13.10 #5): mid of best bid / best ask from `/api/v1/orderBookOrders`. Replaces
128
+ * The ONE declared reference price for slippage-bounded orders on both Lighter venues: mid of best bid / best ask from `/api/v1/orderBookOrders`. Replaces
131
129
  * orderBookDetails `last_trade_price` (stale on thin RH stock books). No runtime
132
130
  * substitute: a missing side → PRICE_STALE before anything is sent.
133
131
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Lighter RH venue definition (design §4 "Lighter RH", §10.1, §10.3, §10.8).
2
+ * Lighter RH venue definition.
3
3
  * Same engine/adapter as Lighter; USDG collateral on the Robinhood chain.
4
- * Master key = OWS wallet only (no env / raw-PK tier); referral off (§10.3).
4
+ * Master key = OWS wallet only (no env / raw-PK tier); referral off.
5
5
  */
6
6
  import type { VenueDefinition } from "../venue.js";
7
7
  export declare const lighterRhVenue: VenueDefinition;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Lighter RH venue definition (design §4 "Lighter RH", §10.1, §10.3, §10.8).
2
+ * Lighter RH venue definition.
3
3
  * Same engine/adapter as Lighter; USDG collateral on the Robinhood chain.
4
- * Master key = OWS wallet only (no env / raw-PK tier); referral off (§10.3).
4
+ * Master key = OWS wallet only (no env / raw-PK tier); referral off.
5
5
  */
6
6
  import { LIGHTER_RH_CAPABILITIES, LIGHTER_RH_NETWORKS, LIGHTER_RH_RATE_LIMIT } from "./lighter-family.js";
7
7
  import { BUILDER_FEE_CAPABILITIES } from "../builder-fee.js";
@@ -22,18 +22,19 @@ export const lighterRhVenue = {
22
22
  agentKeyKind: "lighter-l2",
23
23
  secretStorage: { kind: "perp-keystore", dir: "lighter-rh-agents" },
24
24
  networks: LIGHTER_RH_NETWORKS,
25
- // "Lighter RH is the same API/engine as Lighter" → Lighter's basis/interval (§10.1; live-data check pending).
25
+ // "Lighter RH is the same API/engine as Lighter" → Lighter's basis/interval (live-data check pending).
26
26
  fundingRateBasis: { kind: "perHours", hours: 8 },
27
27
  settlementIntervalHours: 1,
28
28
  fundingVerified: true,
29
29
  roles: ["marketData", "account", "trading"],
30
+ gatedRoles: null,
30
31
  capabilities: LIGHTER_RH_CAPABILITIES,
31
- // Applied by the rate limiter (§10.9: new venues + lighter-rh).
32
+ // Applied by the rate limiter (new venues + lighter-rh).
32
33
  rateLimit: LIGHTER_RH_RATE_LIMIT,
33
34
  restrictedRegions: [],
34
35
  symbolIdentity: "baseTicker",
35
36
  publicData,
36
- // §12: per account (account_trading_mode, read by LighterSpotAdapter.init): Unified (1) shares
37
+ // per account (account_trading_mode, read by LighterSpotAdapter.init): Unified (1) shares
37
38
  // the collateral between spot and perp (no transfer); Classic (0) = separate spot balance +
38
39
  // self-transfer of the venue collateral.
39
40
  spot: {
@@ -54,5 +55,6 @@ export const lighterRhVenue = {
54
55
  },
55
56
  maxSlippageBps: 5000,
56
57
  builderFee: BUILDER_FEE_CAPABILITIES["lighter-rh"],
58
+ apiStatus: { kind: "official" },
57
59
  create: async (ctx) => (await import("./create-helpers.js")).createLighterFamily("lighter-rh", ctx),
58
60
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Lighter (main) venue definition (design §10.1, §10.8, §10.13 #4).
2
+ * Lighter (main) venue definition.
3
3
  * Shares LighterAdapter and constants with lighter-rh (./lighter-family.ts).
4
4
  */
5
5
  import type { VenueDefinition } from "../venue.js";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Lighter (main) venue definition (design §10.1, §10.8, §10.13 #4).
2
+ * Lighter (main) venue definition.
3
3
  * Shares LighterAdapter and constants with lighter-rh (./lighter-family.ts).
4
4
  */
5
5
  import { LIGHTER_CAPABILITIES, LIGHTER_NETWORKS, LIGHTER_RATE_LIMIT } from "./lighter-family.js";
@@ -25,13 +25,14 @@ export const lighterVenue = {
25
25
  settlementIntervalHours: 1,
26
26
  fundingVerified: true,
27
27
  roles: ["marketData", "account", "trading"],
28
+ gatedRoles: null,
28
29
  capabilities: LIGHTER_CAPABILITIES,
29
- // Declared only — per §10.9 the limiter is applied to new venues + lighter-rh, not lighter.
30
+ // Declared only — per the limiter is applied to new venues + lighter-rh, not lighter.
30
31
  rateLimit: LIGHTER_RATE_LIMIT,
31
32
  restrictedRegions: [],
32
33
  symbolIdentity: "baseTicker",
33
34
  publicData,
34
- // §12: per account (account_trading_mode, read by LighterSpotAdapter.init): Unified (1) shares
35
+ // per account (account_trading_mode, read by LighterSpotAdapter.init): Unified (1) shares
35
36
  // the collateral between spot and perp (no transfer); Classic (0) = separate spot balance +
36
37
  // self-transfer of the venue collateral.
37
38
  spot: {
@@ -51,5 +52,6 @@ export const lighterVenue = {
51
52
  },
52
53
  maxSlippageBps: 5000,
53
54
  builderFee: BUILDER_FEE_CAPABILITIES["lighter"],
55
+ apiStatus: { kind: "official" },
54
56
  create: async (ctx) => (await import("./create-helpers.js")).createLighterFamily("lighter", ctx),
55
57
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Ondo Perps venue definition (design §4, §10).
2
+ * Ondo Perps venue definition.
3
3
  *
4
4
  * Off-chain matching engine; collateral is USDC plus eligible Ondo Global
5
5
  * Markets tokenized stocks (docs collateral-assets). Hot-path key = HMAC API
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Ondo Perps venue definition (design §4, §10).
2
+ * Ondo Perps venue definition.
3
3
  *
4
4
  * Off-chain matching engine; collateral is USDC plus eligible Ondo Global
5
5
  * Markets tokenized stocks (docs collateral-assets). Hot-path key = HMAC API
@@ -81,10 +81,11 @@ export const ondoVenue = {
81
81
  settlementIntervalHours: 1,
82
82
  fundingVerified: true,
83
83
  roles: ["marketData", "account", "trading"],
84
+ gatedRoles: null,
84
85
  capabilities: {
85
86
  // The venue offers native market orders; the adapter sends every market order
86
87
  // as an IOC LIMIT at the tick-aligned protection price (mark ± resolved
87
- // slippage, design §13.2).
88
+ // slippage).
88
89
  marketOrder: "native",
89
90
  timeInForce: ["GTC", "IOC", "ALO"],
90
91
  // A reduce-only limit order must be IOC: the venue refuses a resting one with HTTP 400
@@ -107,7 +108,7 @@ export const ondoVenue = {
107
108
  restrictedRegions: ["US", "PA"],
108
109
  symbolIdentity: "baseTicker",
109
110
  publicData,
110
- // §12: separate spot wallet + POST /v1/spot/transfers (spot ↔ margin).
111
+ // separate spot wallet + POST /v1/spot/transfers (spot ↔ margin).
111
112
  spot: {
112
113
  accountModel: "separate",
113
114
  quoteAssets: { mainnet: ["USDC"], testnet: ["USDC"] },
@@ -125,6 +126,7 @@ export const ondoVenue = {
125
126
  },
126
127
  maxSlippageBps: 5000,
127
128
  builderFee: BUILDER_FEE_CAPABILITIES["ondo"],
129
+ apiStatus: { kind: "official" },
128
130
  create: async (ctx) => {
129
131
  const adapter = new (await import("../ondo/adapter.js")).OndoAdapter(ondoVenue, ctx);
130
132
  // Builder code: only settings builder.ondo (off by default). Ondo has no approval step.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Pacifica venue definition (design §10.1, §10.8, §10.13 #4).
3
- * Adapter + public-data code are loaded lazily (§10.10).
2
+ * Pacifica venue definition.
3
+ * Adapter + public-data code are loaded lazily.
4
4
  */
5
5
  import type { VenueDefinition } from "../venue.js";
6
6
  /** Pacifica `client_order_id` format: "Full UUID string" (docs.pacifica.fi rest-api orders/create-limit-order). */
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Pacifica venue definition (design §10.1, §10.8, §10.13 #4).
3
- * Adapter + public-data code are loaded lazily (§10.10).
2
+ * Pacifica venue definition.
3
+ * Adapter + public-data code are loaded lazily.
4
4
  */
5
5
  import { BUILDER_FEE_CAPABILITIES } from "../builder-fee.js";
6
6
  const publicData = {
@@ -50,6 +50,7 @@ export const pacificaVenue = {
50
50
  settlementIntervalHours: 1,
51
51
  fundingVerified: true,
52
52
  roles: ["marketData", "account", "trading"],
53
+ gatedRoles: null,
53
54
  capabilities: {
54
55
  marketOrder: "slippageBounded",
55
56
  timeInForce: ["GTC", "IOC", "ALO", "TOB"],
@@ -68,12 +69,12 @@ export const pacificaVenue = {
68
69
  // docs.pacifica.fi "Rate limits": "Pacifica uses a credit-based rate limiting system with a
69
70
  // 60-second rolling window." Tier "Unidentified IP | 125" base credits/60s (valid API Config
70
71
  // Key: 300); "Standard request/action | 1" credit.
71
- // Declared only — per §10.9 the limiter is applied to new venues + lighter-rh.
72
+ // Declared only — per the limiter is applied to new venues + lighter-rh.
72
73
  rateLimit: { capacity: 125, refillPerSec: 125 / 60, weights: null },
73
74
  restrictedRegions: [],
74
75
  symbolIdentity: "baseTicker",
75
76
  publicData,
76
- // §12: spot (SOL-USDC) shares the perp account — USDC is perp margin, no transfer.
77
+ // spot (SOL-USDC) shares the perp account — USDC is perp margin, no transfer.
77
78
  spot: {
78
79
  accountModel: "unified",
79
80
  quoteAssets: { mainnet: ["USDC"], testnet: ["USDC"] },
@@ -91,5 +92,6 @@ export const pacificaVenue = {
91
92
  },
92
93
  maxSlippageBps: 5000,
93
94
  builderFee: BUILDER_FEE_CAPABILITIES["pacifica"],
95
+ apiStatus: { kind: "official" },
94
96
  create: async (ctx) => (await import("./create-helpers.js")).createPacifica(ctx),
95
97
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * QFEX venue definition (design §14.1 as amended by §14.12).
2
+ * QFEX venue definition.
3
3
  *
4
4
  * TradFi perpetuals (equities, indices, commodities; no spot) on a custodial, off-chain
5
5
  * matching engine. All markets are cross-margin, margin asset USDC. Orders go over the Trade
@@ -1,5 +1,5 @@
1
1
  /**
2
- * QFEX venue definition (design §14.1 as amended by §14.12).
2
+ * QFEX venue definition.
3
3
  *
4
4
  * TradFi perpetuals (equities, indices, commodities; no spot) on a custodial, off-chain
5
5
  * matching engine. All markets are cross-margin, margin asset USDC. Orders go over the Trade
@@ -71,12 +71,13 @@ export const qfexVenue = {
71
71
  // hourly × 8760 overstates it. Until both are settled QFEX is not a funding-arb venue.
72
72
  fundingVerified: false,
73
73
  roles: ["marketData", "account", "trading"],
74
+ gatedRoles: null,
74
75
  capabilities: {
75
76
  // The venue offers a native MARKET order (bounded only by the price band — docs /qfex/risk-limits
76
77
  // "Dynamic price bands": 1.65%–10% by product preset and session; "integrations should use
77
78
  // that live value rather than hardcoding a percentage"); the
78
79
  // adapter sends every market order as an IOC LIMIT at the tick-aligned protection price
79
- // (mark ± resolved slippage, design §13.2) — the same declaration as Ondo.
80
+ // (mark ± resolved slippage) — the same declaration as Ondo.
80
81
  marketOrder: "native",
81
82
  // ALO = order_type "ALO" + GTC.
82
83
  timeInForce: ["GTC", "IOC", "FOK", "ALO"],
@@ -123,6 +124,7 @@ export const qfexVenue = {
123
124
  // Widest documented price band (equities at the open: 10%). The order's own band is checked before sending.
124
125
  maxSlippageBps: 1000,
125
126
  builderFee: BUILDER_FEE_CAPABILITIES["qfex"],
127
+ apiStatus: { kind: "official" },
126
128
  create: async (ctx) => {
127
129
  const { QfexAdapter } = await import("../qfex/adapter.js");
128
130
  const adapter = new QfexAdapter(qfexVenue, ctx);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * RISEx release switch (owner decision 2026-10-19: new venues ship in phases).
3
+ *
4
+ * Phase 1 (0.15.0): RISEx is read-only — market data and public-by-address account reads.
5
+ * Phase 2 (a later release): trading. Flip this to `true`; nothing else needs to change.
6
+ *
7
+ * false removes the "trading" role from the RISEx venue definition (risex.ts), so every trading /
8
+ * signer / agent / bot / MCP-write path refuses with CAPABILITY_UNSUPPORTED through the role
9
+ * mechanism (venue.ts roleUnsupported()), and the adapter refuses writes itself as well.
10
+ * The trading code and its tests stay; those tests enable the switch with
11
+ * `vi.mock(".../venues/risex-release.js", () => ({ RISEX_TRADING_ENABLED: true }))`.
12
+ * Kept in its own module so tests can mock it without replacing the venue definition.
13
+ */
14
+ export declare const RISEX_TRADING_ENABLED: boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * RISEx release switch (owner decision 2026-10-19: new venues ship in phases).
3
+ *
4
+ * Phase 1 (0.15.0): RISEx is read-only — market data and public-by-address account reads.
5
+ * Phase 2 (a later release): trading. Flip this to `true`; nothing else needs to change.
6
+ *
7
+ * false removes the "trading" role from the RISEx venue definition (risex.ts), so every trading /
8
+ * signer / agent / bot / MCP-write path refuses with CAPABILITY_UNSUPPORTED through the role
9
+ * mechanism (venue.ts roleUnsupported()), and the adapter refuses writes itself as well.
10
+ * The trading code and its tests stay; those tests enable the switch with
11
+ * `vi.mock(".../venues/risex-release.js", () => ({ RISEX_TRADING_ENABLED: true }))`.
12
+ * Kept in its own module so tests can mock it without replacing the venue definition.
13
+ */
14
+ export const RISEX_TRADING_ENABLED = false;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * RISEx — fully on-chain perps order book on RISE chain (chainId 4153), USDC collateral.
3
+ *
4
+ * Two keys (developer.rise.trade "Integration"): the account (master EVM wallet) signs setup only;
5
+ * a registered session SIGNER signs every order / cancel / leverage / margin action with an EIP-712
6
+ * VerifyWitness permit (the server submits it and pays gas). perp-cli registers the signer with the
7
+ * master and then restricts it ON-CHAIN to the trading permission (no fund movement), and keeps its
8
+ * key in OWS wallet `agent-risex-<master>[-testnet]` (SSOT Rule #3).
9
+ *
10
+ * RELEASE PHASE: trading is implemented but switched OFF in this release (risex-release.ts
11
+ * RISEX_TRADING_ENABLED). RISEx is read-only here — market data and public-by-address account
12
+ * reads; every trading / signer path refuses with CAPABILITY_UNSUPPORTED (RISEX_TRADING_GATE).
13
+ *
14
+ * Deposits and withdrawals are app-only (owner decision 2026-10-13): `funds deposit|withdraw risex`
15
+ * refuse with CAPABILITY_UNSUPPORTED and point to app.rise.trade. Account reads are public by
16
+ * address. TP/SL and builder fees are not implemented yet.
17
+ * Not registered here; the registry module owns registerVenue().
18
+ */
19
+ import type { VenueDefinition } from "../venue.js";
20
+ export declare const RISEX_APP_URL = "https://app.rise.trade";
21
+ /** The uniform deposit / withdraw refusal (owner decision: funds move through the RISEx app only). */
22
+ export declare const RISEX_FUNDS_APP_ONLY: {
23
+ readonly reason: "RISEx deposits and withdrawals are done in the RISEx app; perp-cli does not move RISEx funds";
24
+ readonly remediation: "Deposit / withdraw at https://app.rise.trade (Portfolio → Deposit / Withdraw). perp-cli reads RISEx market data and your account (read-only in this release)";
25
+ };
26
+ /** The uniform refusal for every RISEx trading / signer path while RISEX_TRADING_ENABLED is false. */
27
+ export declare const RISEX_TRADING_GATE: {
28
+ readonly reason: "RISEx trading is planned for a later perp-cli release; in this version RISEx is read-only (market data and account reads)";
29
+ readonly remediation: "Trade RISEx in the RISEx app (https://app.rise.trade). perp-cli shows RISEx market data (perp -e risex market list|prices|funding|book) and account reads (perp -e risex portfolio, perp -e risex account positions)";
30
+ };
31
+ export declare const risexVenue: VenueDefinition;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * RISEx — fully on-chain perps order book on RISE chain (chainId 4153), USDC collateral.
3
+ *
4
+ * Two keys (developer.rise.trade "Integration"): the account (master EVM wallet) signs setup only;
5
+ * a registered session SIGNER signs every order / cancel / leverage / margin action with an EIP-712
6
+ * VerifyWitness permit (the server submits it and pays gas). perp-cli registers the signer with the
7
+ * master and then restricts it ON-CHAIN to the trading permission (no fund movement), and keeps its
8
+ * key in OWS wallet `agent-risex-<master>[-testnet]` (SSOT Rule #3).
9
+ *
10
+ * RELEASE PHASE: trading is implemented but switched OFF in this release (risex-release.ts
11
+ * RISEX_TRADING_ENABLED). RISEx is read-only here — market data and public-by-address account
12
+ * reads; every trading / signer path refuses with CAPABILITY_UNSUPPORTED (RISEX_TRADING_GATE).
13
+ *
14
+ * Deposits and withdrawals are app-only (owner decision 2026-10-13): `funds deposit|withdraw risex`
15
+ * refuse with CAPABILITY_UNSUPPORTED and point to app.rise.trade. Account reads are public by
16
+ * address. TP/SL and builder fees are not implemented yet.
17
+ * Not registered here; the registry module owns registerVenue().
18
+ */
19
+ import { RISEX_TRADING_ENABLED } from "./risex-release.js";
20
+ export const RISEX_APP_URL = "https://app.rise.trade";
21
+ /** The uniform deposit / withdraw refusal (owner decision: funds move through the RISEx app only). */
22
+ export const RISEX_FUNDS_APP_ONLY = {
23
+ reason: "RISEx deposits and withdrawals are done in the RISEx app; perp-cli does not move RISEx funds",
24
+ remediation: `Deposit / withdraw at ${RISEX_APP_URL} (Portfolio → Deposit / Withdraw). perp-cli reads RISEx market data and your account (read-only in this release)`,
25
+ };
26
+ /** The uniform refusal for every RISEx trading / signer path while RISEX_TRADING_ENABLED is false. */
27
+ export const RISEX_TRADING_GATE = {
28
+ reason: "RISEx trading is planned for a later perp-cli release; in this version RISEx is read-only (market data and account reads)",
29
+ remediation: `Trade RISEx in the RISEx app (${RISEX_APP_URL}). perp-cli shows RISEx market data (perp -e risex market list|prices|funding|book) and account reads (perp -e risex portfolio, perp -e risex account positions)`,
30
+ };
31
+ const publicData = {
32
+ async fetchFundingRates(net) {
33
+ return (await import("../risex/public.js")).risexPublicData.fetchFundingRates(net);
34
+ },
35
+ async fetchMarkets(net) {
36
+ return (await import("../risex/public.js")).risexPublicData.fetchMarkets(net);
37
+ },
38
+ };
39
+ export const risexVenue = {
40
+ id: "risex",
41
+ aliases: ["rise"],
42
+ displayName: "RISEx",
43
+ family: "risex",
44
+ masterKeyKind: "evm",
45
+ agentKeyKind: "evm",
46
+ secretStorage: { kind: "ows-wallet", dir: null },
47
+ networks: {
48
+ mainnet: {
49
+ restUrl: "https://api.rise.trade",
50
+ wsUrl: "wss://ws.rise.trade/ws",
51
+ explorerUrl: "https://explorer.risechain.com",
52
+ signingChainId: 4153,
53
+ settlementChain: "rise",
54
+ collateral: ["USDC"],
55
+ collateralAssetIndex: null,
56
+ rpcUrl: "https://rpc.risechain.com",
57
+ depositPins: null,
58
+ },
59
+ testnet: {
60
+ restUrl: "https://api.testnet.rise.trade",
61
+ // ws.testnet.rise.trade answered 525 on 2026-10-13; the API host serves the socket.
62
+ wsUrl: "wss://api.testnet.rise.trade/ws/",
63
+ explorerUrl: null,
64
+ signingChainId: 11155931,
65
+ settlementChain: "rise",
66
+ collateral: ["USDC"],
67
+ collateralAssetIndex: null,
68
+ rpcUrl: "https://testnet.riselabs.xyz",
69
+ depositPins: null,
70
+ },
71
+ },
72
+ // funding_interval = 3600e9 ns on every market; current_funding_rate is a fraction per hour.
73
+ fundingRateBasis: { kind: "perHours", hours: 1 },
74
+ settlementIntervalHours: 1,
75
+ // Verified 2026-10-14: current_funding_rate equals the last settled print in
76
+ // /funding-rate-history, and public /v1/account/funding-payments satisfy
77
+ // payment = position size × index price × rate for that hour, positive = paid. Evidence: raw
78
+ // records of 6 mainnet accounts / 23 markets / 31 hours in
79
+ // src/__tests__/fixtures/risex/funding-payments-evidence.json, checked by risex-evidence.test.ts.
80
+ fundingVerified: true,
81
+ // Phase 1 (0.15.0): read-only. The trading role comes back with RISEX_TRADING_ENABLED (phase 2).
82
+ roles: RISEX_TRADING_ENABLED ? ["marketData", "account", "trading"] : ["marketData", "account"],
83
+ gatedRoles: RISEX_TRADING_ENABLED ? null : { roles: ["trading"], ...RISEX_TRADING_GATE },
84
+ // Describes the implemented trading path; unreachable while the trading role is gated
85
+ // (requireCapabilities() checks the role first).
86
+ capabilities: {
87
+ // Market = order_type Market + IOC with a price_ticks bound (the venue requires FOK/IOC).
88
+ marketOrder: "slippageBounded",
89
+ // ALO = GTC + post_only. GTT is not offered (the ttl_units unit is undocumented).
90
+ timeInForce: ["GTC", "IOC", "FOK", "ALO"],
91
+ reduceOnlyTif: null,
92
+ clientOrderId: true,
93
+ // The response carries block_number (on-chain inclusion); IOC also carries filled_quantity.
94
+ orderAck: "sync",
95
+ tpsl: null,
96
+ amend: null,
97
+ batchPlaceMax: null,
98
+ marginModes: ["cross", "isolated"],
99
+ withdrawAssets: null,
100
+ },
101
+ // Documented 500 requests / 10 s per IP; Cloudflare 200 / 10 s observed — the stricter one.
102
+ rateLimit: { capacity: 200, refillPerSec: 20, weights: null },
103
+ // Not yet reviewed (open question Q-R5).
104
+ restrictedRegions: [],
105
+ symbolIdentity: "baseTicker",
106
+ publicData,
107
+ spot: null,
108
+ // The venue's own match_price_band (2% today) is checked per market before sending.
109
+ maxSlippageBps: 1000,
110
+ builderFee: null,
111
+ apiStatus: { kind: "official" },
112
+ async create(ctx) {
113
+ const { RisexAdapter } = await import("../risex/adapter.js");
114
+ return RisexAdapter.create(risexVenue, ctx);
115
+ },
116
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TxFlow venue definition — MARKET DATA ONLY, through an UNOFFICIAL API.
3
+ *
4
+ * TxFlow publishes no official trading / data API yet (its "Platform API" is "Coming Soon").
5
+ * perp-cli reads the undocumented Hyperliquid-style `POST /info` endpoint and the WebSocket the
6
+ * TxFlow web app itself uses. It may change or be blocked without notice, so:
7
+ * - apiStatus is "unofficial" and every user-facing surface labels it;
8
+ * - funding is unverified (fundingVerified false): the rate is quoted in PERCENT per hour and is a
9
+ * live, moving estimate — kept out of arb ranking unless --include-unverified;
10
+ * - roles are ["marketData"]: every account / trading / funds / agent / builder / bot path
11
+ * refuses with CAPABILITY_UNSUPPORTED before any request (venue.ts roleUnsupported()).
12
+ * There is no TxFlow order, transfer or account code at all.
13
+ * Not registered here; the registry module owns registerVenue().
14
+ */
15
+ import type { VenueDefinition } from "../venue.js";
16
+ export declare const TXFLOW_REST_URL = "https://api.txflow.com";
17
+ export declare const TXFLOW_WS_URL = "wss://api.txflow.com/ws";
18
+ export declare const txflowVenue: VenueDefinition;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * TxFlow venue definition — MARKET DATA ONLY, through an UNOFFICIAL API.
3
+ *
4
+ * TxFlow publishes no official trading / data API yet (its "Platform API" is "Coming Soon").
5
+ * perp-cli reads the undocumented Hyperliquid-style `POST /info` endpoint and the WebSocket the
6
+ * TxFlow web app itself uses. It may change or be blocked without notice, so:
7
+ * - apiStatus is "unofficial" and every user-facing surface labels it;
8
+ * - funding is unverified (fundingVerified false): the rate is quoted in PERCENT per hour and is a
9
+ * live, moving estimate — kept out of arb ranking unless --include-unverified;
10
+ * - roles are ["marketData"]: every account / trading / funds / agent / builder / bot path
11
+ * refuses with CAPABILITY_UNSUPPORTED before any request (venue.ts roleUnsupported()).
12
+ * There is no TxFlow order, transfer or account code at all.
13
+ * Not registered here; the registry module owns registerVenue().
14
+ */
15
+ export const TXFLOW_REST_URL = "https://api.txflow.com";
16
+ export const TXFLOW_WS_URL = "wss://api.txflow.com/ws";
17
+ /** Lazy: public.ts (and `ws`) is only loaded when market data is actually requested. */
18
+ const publicData = {
19
+ async fetchFundingRates(net) {
20
+ return (await import("../txflow/public.js")).txflowPublicData.fetchFundingRates(net);
21
+ },
22
+ async fetchMarkets(net) {
23
+ return (await import("../txflow/public.js")).txflowPublicData.fetchMarkets(net);
24
+ },
25
+ };
26
+ export const txflowVenue = {
27
+ id: "txflow",
28
+ aliases: ["txf"],
29
+ displayName: "TxFlow",
30
+ family: "txflow",
31
+ masterKeyKind: "none",
32
+ agentKeyKind: "none",
33
+ secretStorage: { kind: "none", dir: null },
34
+ networks: {
35
+ mainnet: {
36
+ restUrl: TXFLOW_REST_URL,
37
+ wsUrl: TXFLOW_WS_URL,
38
+ explorerUrl: null,
39
+ signingChainId: null,
40
+ settlementChain: "offchain",
41
+ collateral: ["USDC"],
42
+ collateralAssetIndex: null,
43
+ rpcUrl: null,
44
+ depositPins: null,
45
+ },
46
+ // No public testnet.
47
+ testnet: null,
48
+ },
49
+ // settlementIntervalMs = 3600000 on every market (marketTicker); the rate is percent per hour.
50
+ fundingRateBasis: { kind: "perHours", hours: 1 },
51
+ settlementIntervalHours: 1,
52
+ // Unofficial API; the percent unit is inferred (HL-style 0.00125 %/h baseline on most markets);
53
+ // the published value moves every tick (a live estimate, not a settled print).
54
+ fundingVerified: false,
55
+ roles: ["marketData"],
56
+ gatedRoles: null,
57
+ capabilities: null,
58
+ // No rate-limit headers are published; conservative.
59
+ rateLimit: { capacity: 20, refillPerSec: 2, weights: null },
60
+ restrictedRegions: [],
61
+ symbolIdentity: "baseTicker",
62
+ publicData,
63
+ spot: null,
64
+ // Unused (no trading role); the field is required by the definition shape.
65
+ maxSlippageBps: 1,
66
+ builderFee: null,
67
+ apiStatus: {
68
+ kind: "unofficial",
69
+ note: "undocumented HL-style API used by the app.txflow.com web app; read-only in perp-cli and may change or be blocked without notice",
70
+ docs: "https://docs.txflow.com",
71
+ },
72
+ // A public-only adapter: market data works, every account / trading method refuses.
73
+ async create(ctx) {
74
+ const { TxflowPublicAdapter } = await import("../txflow/adapter.js");
75
+ return new TxflowPublicAdapter(txflowVenue, ctx.network);
76
+ },
77
+ };