perp-cli 0.12.17 → 0.14.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 (361) hide show
  1. package/README.md +247 -27
  2. package/dist/_stderr-filter.js +0 -1
  3. package/dist/agent-wallet/lighter-keystore.d.ts +11 -0
  4. package/dist/agent-wallet/lighter-keystore.js +92 -10
  5. package/dist/agent-wallet/passphrase.d.ts +1 -1
  6. package/dist/agent-wallet/passphrase.js +16 -3
  7. package/dist/agent-wallet/store.d.ts +37 -4
  8. package/dist/agent-wallet/store.js +132 -0
  9. package/dist/agent-wallet/venue-keystore.d.ts +14 -0
  10. package/dist/agent-wallet/venue-keystore.js +121 -0
  11. package/dist/api/public/hyperliquid.js +4 -4
  12. package/dist/api/public/lighter.js +5 -5
  13. package/dist/api/public/pacifica.d.ts +0 -1
  14. package/dist/api/public/pacifica.js +4 -13
  15. package/dist/api/public/urls.d.ts +9 -1
  16. package/dist/api/public/urls.js +35 -13
  17. package/dist/arb/file-lock.d.ts +11 -0
  18. package/dist/arb/file-lock.js +74 -0
  19. package/dist/arb/index.d.ts +2 -2
  20. package/dist/arb/index.js +2 -2
  21. package/dist/arb/pending-entry.d.ts +32 -0
  22. package/dist/arb/pending-entry.js +77 -0
  23. package/dist/arb/sizing.d.ts +6 -13
  24. package/dist/arb/sizing.js +12 -51
  25. package/dist/arb/state.d.ts +45 -12
  26. package/dist/arb/state.js +214 -42
  27. package/dist/arb/utils.d.ts +20 -6
  28. package/dist/arb/utils.js +43 -39
  29. package/dist/bot/conditions.d.ts +4 -4
  30. package/dist/bot/conditions.js +11 -6
  31. package/dist/bot/config.d.ts +17 -1
  32. package/dist/bot/config.js +48 -12
  33. package/dist/bot/engine.d.ts +61 -2
  34. package/dist/bot/engine.js +610 -144
  35. package/dist/bot/fill-size.d.ts +7 -0
  36. package/dist/bot/fill-size.js +18 -0
  37. package/dist/bot/index.d.ts +1 -1
  38. package/dist/bot/index.js +1 -1
  39. package/dist/bot/perp-order.d.ts +99 -0
  40. package/dist/bot/perp-order.js +299 -0
  41. package/dist/bot/presets.d.ts +7 -0
  42. package/dist/bot/presets.js +17 -0
  43. package/dist/bot/quarantine.d.ts +75 -0
  44. package/dist/bot/quarantine.js +190 -0
  45. package/dist/bot/quote-rules.d.ts +23 -0
  46. package/dist/bot/quote-rules.js +69 -0
  47. package/dist/bot/strategies/avellaneda-mm.d.ts +32 -2
  48. package/dist/bot/strategies/avellaneda-mm.js +72 -70
  49. package/dist/bot/strategies/basis-arb.js +2 -0
  50. package/dist/bot/strategies/dca-strategy.d.ts +2 -0
  51. package/dist/bot/strategies/dca-strategy.js +5 -0
  52. package/dist/bot/strategies/funding-arb-strategy.d.ts +43 -3
  53. package/dist/bot/strategies/funding-arb-strategy.js +571 -380
  54. package/dist/bot/strategies/funding-arb-utils.d.ts +48 -23
  55. package/dist/bot/strategies/funding-arb-utils.js +159 -195
  56. package/dist/bot/strategies/funding-arb-v2.d.ts +32 -0
  57. package/dist/bot/strategies/funding-arb-v2.js +258 -47
  58. package/dist/bot/strategies/funding-auto.js +215 -194
  59. package/dist/bot/strategies/spot-perp-arb-strategy.d.ts +14 -0
  60. package/dist/bot/strategies/spot-perp-arb-strategy.js +217 -50
  61. package/dist/bot/strategies/spot-perp-executor.d.ts +73 -19
  62. package/dist/bot/strategies/spot-perp-executor.js +319 -120
  63. package/dist/bot/strategies/spot-perp-state.d.ts +43 -0
  64. package/dist/bot/strategies/spot-perp-state.js +70 -0
  65. package/dist/bot/strategy-types.d.ts +6 -0
  66. package/dist/bot/tui/BotDashboard.d.ts +7 -2
  67. package/dist/bot/tui/BotDashboard.js +6 -3
  68. package/dist/bridge-engine.d.ts +120 -19
  69. package/dist/bridge-engine.js +710 -422
  70. package/dist/bridge-signers.d.ts +54 -0
  71. package/dist/bridge-signers.js +161 -0
  72. package/dist/cache.d.ts +4 -1
  73. package/dist/cache.js +11 -0
  74. package/dist/cli-flags.d.ts +50 -0
  75. package/dist/cli-flags.js +104 -0
  76. package/dist/cli-program.d.ts +35 -0
  77. package/dist/cli-program.js +286 -0
  78. package/dist/cli-spec.js +1 -1
  79. package/dist/client-id-tracker.js +11 -2
  80. package/dist/commands/account.d.ts +7 -1
  81. package/dist/commands/account.js +70 -92
  82. package/dist/commands/agent-import.d.ts +114 -0
  83. package/dist/commands/agent-import.js +794 -0
  84. package/dist/commands/agent.d.ts +232 -2
  85. package/dist/commands/agent.js +1858 -955
  86. package/dist/commands/alerts.d.ts +1 -0
  87. package/dist/commands/alerts.js +31 -28
  88. package/dist/commands/arb/index.d.ts +60 -1
  89. package/dist/commands/arb/index.js +381 -384
  90. package/dist/commands/arb-auto.d.ts +132 -4
  91. package/dist/commands/arb-auto.js +1474 -967
  92. package/dist/commands/arb.d.ts +3 -1
  93. package/dist/commands/arb.js +62 -30
  94. package/dist/commands/bot.js +127 -47
  95. package/dist/commands/bridge.d.ts +2 -1
  96. package/dist/commands/bridge.js +339 -192
  97. package/dist/commands/builder.d.ts +55 -0
  98. package/dist/commands/builder.js +387 -0
  99. package/dist/commands/funds-onchain.d.ts +32 -0
  100. package/dist/commands/funds-onchain.js +286 -0
  101. package/dist/commands/funds.d.ts +25 -0
  102. package/dist/commands/funds.js +939 -245
  103. package/dist/commands/history.js +72 -45
  104. package/dist/commands/init.d.ts +107 -15
  105. package/dist/commands/init.js +1116 -249
  106. package/dist/commands/jobs.d.ts +2 -1
  107. package/dist/commands/jobs.js +77 -15
  108. package/dist/commands/manage.js +136 -91
  109. package/dist/commands/market.d.ts +4 -1
  110. package/dist/commands/market.js +35 -32
  111. package/dist/commands/outcome.d.ts +10 -0
  112. package/dist/commands/outcome.js +396 -0
  113. package/dist/commands/plan.js +52 -12
  114. package/dist/commands/portfolio.d.ts +1 -0
  115. package/dist/commands/portfolio.js +60 -72
  116. package/dist/commands/rebalance.d.ts +2 -1
  117. package/dist/commands/rebalance.js +33 -43
  118. package/dist/commands/risk.js +46 -19
  119. package/dist/commands/settings.d.ts +1 -0
  120. package/dist/commands/settings.js +246 -51
  121. package/dist/commands/trade.d.ts +50 -0
  122. package/dist/commands/trade.js +1943 -695
  123. package/dist/commands/wallet.d.ts +30 -1
  124. package/dist/commands/wallet.js +316 -337
  125. package/dist/config.d.ts +60 -9
  126. package/dist/config.js +252 -82
  127. package/dist/constants.d.ts +29 -4
  128. package/dist/constants.js +62 -20
  129. package/dist/dashboard/server.d.ts +2 -0
  130. package/dist/dashboard/server.js +9 -6
  131. package/dist/dashboard/ui.js +6 -4
  132. package/dist/dashboard/ws-feeds.js +20 -8
  133. package/dist/dex-asset-map.js +5 -3
  134. package/dist/errors.d.ts +122 -0
  135. package/dist/errors.js +194 -0
  136. package/dist/event-stream.js +75 -19
  137. package/dist/evm-master-tx.d.ts +59 -0
  138. package/dist/evm-master-tx.js +154 -0
  139. package/dist/exchanges/adapter-network.d.ts +10 -0
  140. package/dist/exchanges/adapter-network.js +10 -0
  141. package/dist/exchanges/arcus/adapter.d.ts +196 -0
  142. package/dist/exchanges/arcus/adapter.js +1092 -0
  143. package/dist/exchanges/arcus/agent.d.ts +55 -0
  144. package/dist/exchanges/arcus/agent.js +188 -0
  145. package/dist/exchanges/arcus/client.d.ts +63 -0
  146. package/dist/exchanges/arcus/client.js +285 -0
  147. package/dist/exchanges/arcus/public.d.ts +65 -0
  148. package/dist/exchanges/arcus/public.js +138 -0
  149. package/dist/exchanges/arcus/signing.d.ts +176 -0
  150. package/dist/exchanges/arcus/signing.js +288 -0
  151. package/dist/exchanges/arcus/spot-chain.d.ts +60 -0
  152. package/dist/exchanges/arcus/spot-chain.js +241 -0
  153. package/dist/exchanges/arcus/spot-router.d.ts +177 -0
  154. package/dist/exchanges/arcus/spot-router.js +183 -0
  155. package/dist/exchanges/arcus/spot.d.ts +109 -0
  156. package/dist/exchanges/arcus/spot.js +645 -0
  157. package/dist/exchanges/aster-funds.d.ts +127 -0
  158. package/dist/exchanges/aster-funds.js +252 -0
  159. package/dist/exchanges/aster-nonce.d.ts +2 -0
  160. package/dist/exchanges/aster-nonce.js +107 -0
  161. package/dist/exchanges/aster-spot.d.ts +117 -0
  162. package/dist/exchanges/aster-spot.js +686 -0
  163. package/dist/exchanges/aster-typed-data.d.ts +133 -7
  164. package/dist/exchanges/aster-typed-data.js +121 -7
  165. package/dist/exchanges/aster.d.ts +219 -6
  166. package/dist/exchanges/aster.js +1023 -153
  167. package/dist/exchanges/builder-fee.d.ts +254 -0
  168. package/dist/exchanges/builder-fee.js +421 -0
  169. package/dist/exchanges/canonical-symbols.d.ts +32 -0
  170. package/dist/exchanges/canonical-symbols.js +96 -0
  171. package/dist/exchanges/capabilities.d.ts +7 -1
  172. package/dist/exchanges/capabilities.js +7 -0
  173. package/dist/exchanges/hl-signing.d.ts +165 -0
  174. package/dist/exchanges/hl-signing.js +158 -0
  175. package/dist/exchanges/hyperliquid-outcome.d.ts +211 -0
  176. package/dist/exchanges/hyperliquid-outcome.js +646 -0
  177. package/dist/exchanges/hyperliquid-spot.d.ts +44 -5
  178. package/dist/exchanges/hyperliquid-spot.js +308 -117
  179. package/dist/exchanges/hyperliquid.d.ts +462 -57
  180. package/dist/exchanges/hyperliquid.js +1575 -449
  181. package/dist/exchanges/index.d.ts +6 -0
  182. package/dist/exchanges/index.js +4 -0
  183. package/dist/exchanges/interface.d.ts +63 -10
  184. package/dist/exchanges/interface.js +18 -3
  185. package/dist/exchanges/ioc-outcome.d.ts +44 -0
  186. package/dist/exchanges/ioc-outcome.js +57 -0
  187. package/dist/exchanges/legacy-trading-v2.d.ts +39 -0
  188. package/dist/exchanges/legacy-trading-v2.js +940 -0
  189. package/dist/exchanges/lighter-public.d.ts +43 -0
  190. package/dist/exchanges/lighter-public.js +276 -0
  191. package/dist/exchanges/lighter-rh-deposit.d.ts +62 -0
  192. package/dist/exchanges/lighter-rh-deposit.js +185 -0
  193. package/dist/exchanges/lighter-signer.d.ts +123 -0
  194. package/dist/exchanges/lighter-signer.js +215 -0
  195. package/dist/exchanges/lighter-spot.d.ts +91 -13
  196. package/dist/exchanges/lighter-spot.js +595 -233
  197. package/dist/exchanges/lighter.d.ts +611 -39
  198. package/dist/exchanges/lighter.js +1890 -649
  199. package/dist/exchanges/ondo/adapter.d.ts +166 -0
  200. package/dist/exchanges/ondo/adapter.js +835 -0
  201. package/dist/exchanges/ondo/agent.d.ts +31 -0
  202. package/dist/exchanges/ondo/agent.js +101 -0
  203. package/dist/exchanges/ondo/client.d.ts +60 -0
  204. package/dist/exchanges/ondo/client.js +297 -0
  205. package/dist/exchanges/ondo/funds.d.ts +122 -0
  206. package/dist/exchanges/ondo/funds.js +290 -0
  207. package/dist/exchanges/ondo/public.d.ts +95 -0
  208. package/dist/exchanges/ondo/public.js +214 -0
  209. package/dist/exchanges/ondo/spot.d.ts +127 -0
  210. package/dist/exchanges/ondo/spot.js +392 -0
  211. package/dist/exchanges/outcome-interface.d.ts +140 -0
  212. package/dist/exchanges/outcome-interface.js +16 -0
  213. package/dist/exchanges/pacifica-spot.d.ts +83 -0
  214. package/dist/exchanges/pacifica-spot.js +324 -0
  215. package/dist/exchanges/pacifica-typed-data.d.ts +30 -13
  216. package/dist/exchanges/pacifica-typed-data.js +57 -9
  217. package/dist/exchanges/pacifica.d.ts +288 -4
  218. package/dist/exchanges/pacifica.js +1013 -76
  219. package/dist/exchanges/precision.d.ts +47 -0
  220. package/dist/exchanges/precision.js +209 -0
  221. package/dist/exchanges/qfex/adapter.d.ts +341 -0
  222. package/dist/exchanges/qfex/adapter.js +1383 -0
  223. package/dist/exchanges/qfex/agent.d.ts +58 -0
  224. package/dist/exchanges/qfex/agent.js +188 -0
  225. package/dist/exchanges/qfex/client.d.ts +54 -0
  226. package/dist/exchanges/qfex/client.js +138 -0
  227. package/dist/exchanges/qfex/errors.d.ts +70 -0
  228. package/dist/exchanges/qfex/errors.js +236 -0
  229. package/dist/exchanges/qfex/public.d.ts +122 -0
  230. package/dist/exchanges/qfex/public.js +268 -0
  231. package/dist/exchanges/qfex/signing.d.ts +160 -0
  232. package/dist/exchanges/qfex/signing.js +283 -0
  233. package/dist/exchanges/qfex/ws-transport.d.ts +294 -0
  234. package/dist/exchanges/qfex/ws-transport.js +798 -0
  235. package/dist/exchanges/rate-limiter.d.ts +12 -0
  236. package/dist/exchanges/rate-limiter.js +64 -0
  237. package/dist/exchanges/registry.d.ts +14 -2
  238. package/dist/exchanges/registry.js +20 -32
  239. package/dist/exchanges/slippage.d.ts +37 -0
  240. package/dist/exchanges/slippage.js +70 -0
  241. package/dist/exchanges/spot-factory.d.ts +166 -0
  242. package/dist/exchanges/spot-factory.js +431 -0
  243. package/dist/exchanges/spot-interface.d.ts +98 -4
  244. package/dist/exchanges/spot-interface.js +27 -1
  245. package/dist/exchanges/spot-result.d.ts +79 -0
  246. package/dist/exchanges/spot-result.js +273 -0
  247. package/dist/exchanges/trading-v2.d.ts +117 -0
  248. package/dist/exchanges/trading-v2.js +301 -0
  249. package/dist/exchanges/venue-types.d.ts +231 -0
  250. package/dist/exchanges/venue-types.js +87 -0
  251. package/dist/exchanges/venue.d.ts +211 -0
  252. package/dist/exchanges/venue.js +132 -0
  253. package/dist/exchanges/venues/arcus.d.ts +8 -0
  254. package/dist/exchanges/venues/arcus.js +109 -0
  255. package/dist/exchanges/venues/aster.d.ts +49 -0
  256. package/dist/exchanges/venues/aster.js +176 -0
  257. package/dist/exchanges/venues/create-helpers.d.ts +18 -0
  258. package/dist/exchanges/venues/create-helpers.js +199 -0
  259. package/dist/exchanges/venues/hyperliquid.d.ts +23 -0
  260. package/dist/exchanges/venues/hyperliquid.js +126 -0
  261. package/dist/exchanges/venues/index.d.ts +16 -0
  262. package/dist/exchanges/venues/index.js +26 -0
  263. package/dist/exchanges/venues/lighter-family.d.ts +92 -0
  264. package/dist/exchanges/venues/lighter-family.js +166 -0
  265. package/dist/exchanges/venues/lighter-rh.d.ts +7 -0
  266. package/dist/exchanges/venues/lighter-rh.js +58 -0
  267. package/dist/exchanges/venues/lighter.d.ts +6 -0
  268. package/dist/exchanges/venues/lighter.js +55 -0
  269. package/dist/exchanges/venues/ondo.d.ts +34 -0
  270. package/dist/exchanges/venues/ondo.js +140 -0
  271. package/dist/exchanges/venues/pacifica.d.ts +8 -0
  272. package/dist/exchanges/venues/pacifica.js +95 -0
  273. package/dist/exchanges/venues/qfex.d.ts +28 -0
  274. package/dist/exchanges/venues/qfex.js +132 -0
  275. package/dist/execution-log.js +10 -2
  276. package/dist/funding/legacy-public.d.ts +31 -0
  277. package/dist/funding/legacy-public.js +369 -0
  278. package/dist/funding/normalize.d.ts +28 -16
  279. package/dist/funding/normalize.js +61 -29
  280. package/dist/funding/rates.d.ts +46 -11
  281. package/dist/funding/rates.js +228 -277
  282. package/dist/guardrail/perp-guardrail.js +0 -0
  283. package/dist/index.js +156 -684
  284. package/dist/jobs.d.ts +84 -6
  285. package/dist/jobs.js +239 -41
  286. package/dist/landing.d.ts +7 -2
  287. package/dist/landing.js +19 -3
  288. package/dist/mcp-server.d.ts +14 -4
  289. package/dist/mcp-server.js +820 -402
  290. package/dist/mcp-trade-guard.d.ts +16 -0
  291. package/dist/mcp-trade-guard.js +59 -0
  292. package/dist/pacifica/client.d.ts +41 -10
  293. package/dist/pacifica/client.js +167 -63
  294. package/dist/pacifica/constants.d.ts +0 -1
  295. package/dist/pacifica/constants.js +0 -5
  296. package/dist/pacifica/deposit.d.ts +30 -3
  297. package/dist/pacifica/deposit.js +119 -2
  298. package/dist/pacifica/faucet.d.ts +29 -0
  299. package/dist/pacifica/faucet.js +100 -0
  300. package/dist/pacifica/sign-tx.d.ts +15 -0
  301. package/dist/pacifica/sign-tx.js +41 -0
  302. package/dist/pacifica/types/account.d.ts +28 -4
  303. package/dist/pacifica/types/lake.d.ts +20 -5
  304. package/dist/pacifica/types/lake.js +4 -0
  305. package/dist/pacifica/types/market.d.ts +5 -0
  306. package/dist/pacifica/types/order.d.ts +4 -1
  307. package/dist/pacifica/types/position.d.ts +9 -1
  308. package/dist/plan-executor.d.ts +10 -5
  309. package/dist/plan-executor.js +165 -54
  310. package/dist/position-history.js +13 -0
  311. package/dist/rebalance.d.ts +26 -2
  312. package/dist/rebalance.js +86 -7
  313. package/dist/relay-swap.d.ts +232 -0
  314. package/dist/relay-swap.js +630 -0
  315. package/dist/risk.js +5 -1
  316. package/dist/secret-env.d.ts +15 -0
  317. package/dist/secret-env.js +36 -0
  318. package/dist/settings.d.ts +169 -6
  319. package/dist/settings.js +219 -38
  320. package/dist/signer/ows-evm.d.ts +13 -0
  321. package/dist/signer/ows-evm.js +22 -0
  322. package/dist/smart-order.d.ts +9 -0
  323. package/dist/smart-order.js +53 -8
  324. package/dist/strategies/dca.d.ts +6 -2
  325. package/dist/strategies/dca.js +66 -26
  326. package/dist/strategies/funding-arb.d.ts +11 -1
  327. package/dist/strategies/funding-arb.js +202 -89
  328. package/dist/strategies/grid.d.ts +31 -0
  329. package/dist/strategies/grid.js +89 -11
  330. package/dist/strategies/pending-stop.d.ts +8 -0
  331. package/dist/strategies/pending-stop.js +12 -0
  332. package/dist/strategies/split-order.d.ts +45 -17
  333. package/dist/strategies/split-order.js +157 -91
  334. package/dist/strategies/trailing-stop.d.ts +2 -1
  335. package/dist/strategies/trailing-stop.js +52 -6
  336. package/dist/strategies/twap.d.ts +6 -1
  337. package/dist/strategies/twap.js +39 -11
  338. package/dist/trade-validator.d.ts +22 -0
  339. package/dist/trade-validator.js +119 -15
  340. package/dist/utils/numeric.d.ts +46 -0
  341. package/dist/utils/numeric.js +79 -0
  342. package/dist/utils.d.ts +19 -0
  343. package/dist/utils.js +96 -19
  344. package/dist/withdraw-gate.d.ts +49 -0
  345. package/dist/withdraw-gate.js +131 -0
  346. package/package.json +15 -6
  347. package/skills/perp-cli/SKILL.md +142 -55
  348. package/skills/perp-cli/references/agent-operations.md +110 -56
  349. package/skills/perp-cli/references/commands.md +266 -71
  350. package/skills/perp-cli/references/strategies.md +34 -31
  351. package/skills/perp-cli/scripts/arb-monitor.sh +10 -5
  352. package/skills/perp-cli/scripts/funding-analysis.sh +14 -9
  353. package/skills/perp-cli/scripts/preflight.sh +21 -14
  354. package/skills/perp-cli/scripts/spot-perp-scan.sh +12 -7
  355. package/skills/perp-cli/scripts/validate-arb.sh +31 -15
  356. package/vendor/lighter-signer/SHA256SUMS +2 -0
  357. package/vendor/lighter-signer/VERSION +8 -0
  358. package/vendor/lighter-signer/lighter-signer.wasm +0 -0
  359. package/vendor/lighter-signer/wasm_exec.js +575 -0
  360. package/dist/bot/strategies/funding-arb-v2-strategy.d.ts +0 -42
  361. package/dist/bot/strategies/funding-arb-v2-strategy.js +0 -864
@@ -0,0 +1,92 @@
1
+ /**
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
+ *
5
+ * Both venues run the same API/engine and the same LighterAdapter class; they
6
+ * differ only in the values below. This module has no runtime imports so venue
7
+ * definitions and public-data paths can use it without loading the WASM SDK.
8
+ */
9
+ import type { RateLimitPolicy, VenueCapabilities, VenueNetworkConfig } from "../venue.js";
10
+ export type LighterVenueId = "lighter" | "lighter-rh";
11
+ /**
12
+ * Lighter (main). REST hosts are the values LighterAdapter used before
13
+ * 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).
16
+ * explorerUrl is the explorer API host; callers append `/api/...`
17
+ * (lighter-spot.ts uses `${explorerUrl}/api/markets`). The testnet explorer host
18
+ * is the one lighter-ts-sdk documented (`https://testnet.explorer.elliot.ai/api`).
19
+ */
20
+ export declare const LIGHTER_NETWORKS: {
21
+ mainnet: VenueNetworkConfig;
22
+ testnet: VenueNetworkConfig;
23
+ };
24
+ /**
25
+ * Lighter RH (apidocs.rh.lighter.xyz). Chain ids 466324 / 300 per get-started.md.
26
+ * Collateral asset id 3, 6 decimals on both networks — but a different token:
27
+ * mainnet asset 3 is USDG, testnet asset 3 is USDC (live GET
28
+ * api.rh-testnet.lighter.xyz/api/v1/assetDetails, 2026-10-02: ids 1 ETH, 2 LIT,
29
+ * 3 USDC l1_decimals 6 / decimals 6; no USDG listed).
30
+ * explorerUrl is the explorer **API** host (`https://explorerapi.rh.lighter.xyz/api/`,
31
+ * rate-limits.md); no UI explorer URL is documented.
32
+ * Testnet WS is not documented → null (a WS upgrade on
33
+ * wss://api.rh-testnet.lighter.xyz/stream answered 101 on 2026-09-30).
34
+ * Testnet explorer is not documented → null.
35
+ * rpcUrl (mainnet): Robinhood Chain RPC — the L1 the RH contract lives on
36
+ * (GET /api/v1/layer1BasicInfo l1_providers chainId 4663; eth_chainId 0x1237 verified
37
+ * 2026-10-02; same RPC as the Arcus venue). Testnet: the RH testnet L1 (chainId 123456
38
+ * per layer1BasicInfo) has no documented RPC → null.
39
+ */
40
+ export declare const LIGHTER_RH_NETWORKS: {
41
+ mainnet: VenueNetworkConfig;
42
+ testnet: VenueNetworkConfig;
43
+ };
44
+ export declare function lighterFamilyNetworks(venue: LighterVenueId): {
45
+ mainnet: VenueNetworkConfig;
46
+ testnet: VenueNetworkConfig;
47
+ };
48
+ /**
49
+ * §10.8 + §10.13 #4 + §13.3. timeInForce lists the CLI inputs the adapter accepts:
50
+ * GTC is mapped to GTT (28-day expiry, LIGHTER_GTT_EXPIRY_MS) by LighterAdapter.limitOrder;
51
+ * 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
53
+ * in LIGHTER_CLIENT_ORDER_INDEX_MAX / lighterClientOrderIndex() (lighter.ts).
54
+ */
55
+ export declare const LIGHTER_CAPABILITIES: VenueCapabilities;
56
+ /**
57
+ * GTC/GTT (and post-only) resting-order lifetime on both Lighter venues: orderExpiry -1 is
58
+ * 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).
60
+ */
61
+ export declare const LIGHTER_GTT_EXPIRY_MS: number;
62
+ /**
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
65
+ * orderBookDetails `last_trade_price` (stale on thin RH stock books). No runtime
66
+ * substitute: a missing side → PRICE_STALE before anything is sent.
67
+ */
68
+ export declare const LIGHTER_REFERENCE_PRICE_SOURCE: "orderBookOrders.mid";
69
+ /** Largest Lighter clientOrderIndex: 48-bit (2^48 − 1). 0 is the venue's "nil" index → 1 is the minimum. */
70
+ export declare const LIGHTER_CLIENT_ORDER_INDEX_MAX: number;
71
+ export declare const LIGHTER_RH_CAPABILITIES: VenueCapabilities;
72
+ /**
73
+ * Standard-account REST limit: 60 requests per rolling minute, unweighted
74
+ * (rate-limits.md). The account tier cannot be determined from here, so the
75
+ * standard policy is used.
76
+ *
77
+ * Not modeled: on Premium/Plus accounts the limit is 24,000 *weighted*
78
+ * requests/min (`trades`/`recentTrades` weight 600, `sendTx`/`nextNonce` 6,
79
+ * others 300). The docs also apply `24000 / weight` when it is lower than 60, so
80
+ * even standard accounts get only 40/min on `trades`/`recentTrades` and 8/min on
81
+ * the 3000-weight endpoints. A 429 from those surfaces as RATE_LIMITED.
82
+ */
83
+ export declare const LIGHTER_RH_RATE_LIMIT: RateLimitPolicy;
84
+ /**
85
+ * Lighter main: same engine and the same standard-account tier (60 req/min).
86
+ * Taken from the RH docs ("same API/engine"); the main-venue figure is not
87
+ * separately verified here.
88
+ */
89
+ export declare const LIGHTER_RATE_LIMIT: RateLimitPolicy;
90
+ export declare function lighterFamilyRateLimit(venue: LighterVenueId): RateLimitPolicy;
91
+ /** API key indexes Lighter RH reserves for its desktop/mobile interfaces (api-keys.md; valid range 0–254). */
92
+ export declare const LIGHTER_RH_RESERVED_KEY_INDEXES: readonly number[];
@@ -0,0 +1,166 @@
1
+ /**
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
+ *
5
+ * Both venues run the same API/engine and the same LighterAdapter class; they
6
+ * differ only in the values below. This module has no runtime imports so venue
7
+ * definitions and public-data paths can use it without loading the WASM SDK.
8
+ */
9
+ /**
10
+ * Lighter (main). REST hosts are the values LighterAdapter used before
11
+ * 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).
14
+ * explorerUrl is the explorer API host; callers append `/api/...`
15
+ * (lighter-spot.ts uses `${explorerUrl}/api/markets`). The testnet explorer host
16
+ * is the one lighter-ts-sdk documented (`https://testnet.explorer.elliot.ai/api`).
17
+ */
18
+ export const LIGHTER_NETWORKS = {
19
+ mainnet: {
20
+ restUrl: "https://mainnet.zklighter.elliot.ai",
21
+ wsUrl: "wss://mainnet.zklighter.elliot.ai/stream",
22
+ explorerUrl: "https://explorer.elliot.ai",
23
+ signingChainId: 304,
24
+ settlementChain: "ethereum",
25
+ collateral: ["USDC"],
26
+ collateralAssetIndex: 3,
27
+ rpcUrl: null,
28
+ depositPins: null,
29
+ },
30
+ testnet: {
31
+ restUrl: "https://testnet.zklighter.elliot.ai",
32
+ wsUrl: null,
33
+ explorerUrl: "https://testnet.explorer.elliot.ai",
34
+ signingChainId: 300,
35
+ settlementChain: "ethereum",
36
+ collateral: ["USDC"],
37
+ collateralAssetIndex: 3,
38
+ rpcUrl: null,
39
+ depositPins: null,
40
+ },
41
+ };
42
+ /**
43
+ * Lighter RH (apidocs.rh.lighter.xyz). Chain ids 466324 / 300 per get-started.md.
44
+ * Collateral asset id 3, 6 decimals on both networks — but a different token:
45
+ * mainnet asset 3 is USDG, testnet asset 3 is USDC (live GET
46
+ * api.rh-testnet.lighter.xyz/api/v1/assetDetails, 2026-10-02: ids 1 ETH, 2 LIT,
47
+ * 3 USDC l1_decimals 6 / decimals 6; no USDG listed).
48
+ * explorerUrl is the explorer **API** host (`https://explorerapi.rh.lighter.xyz/api/`,
49
+ * rate-limits.md); no UI explorer URL is documented.
50
+ * Testnet WS is not documented → null (a WS upgrade on
51
+ * wss://api.rh-testnet.lighter.xyz/stream answered 101 on 2026-09-30).
52
+ * Testnet explorer is not documented → null.
53
+ * rpcUrl (mainnet): Robinhood Chain RPC — the L1 the RH contract lives on
54
+ * (GET /api/v1/layer1BasicInfo l1_providers chainId 4663; eth_chainId 0x1237 verified
55
+ * 2026-10-02; same RPC as the Arcus venue). Testnet: the RH testnet L1 (chainId 123456
56
+ * per layer1BasicInfo) has no documented RPC → null.
57
+ */
58
+ export const LIGHTER_RH_NETWORKS = {
59
+ mainnet: {
60
+ restUrl: "https://api.rh.lighter.xyz",
61
+ wsUrl: "wss://api.rh.lighter.xyz/stream",
62
+ explorerUrl: "https://explorerapi.rh.lighter.xyz",
63
+ signingChainId: 466324,
64
+ settlementChain: "robinhood",
65
+ collateral: ["USDG"],
66
+ collateralAssetIndex: 3,
67
+ rpcUrl: "https://rpc.mainnet.chain.robinhood.com",
68
+ // Verified 2026-10-02: contract + chainId 4663 on apidocs.lighter.xyz/docs/lighter-rh and
69
+ // apidocs.rh.lighter.xyz "Deposits, Transfers, and Withdrawals"; USDG token on Paxos'
70
+ // USDG mainnet list (Robinhood Mainnet); both equal GET /api/v1/layer1BasicInfo + assetDetails.
71
+ depositPins: {
72
+ chainId: 4663,
73
+ contract: "0x94bAB9693Ba2f6358507eFfcbd372b0660AFfF9d",
74
+ token: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
75
+ sources: [
76
+ "https://apidocs.lighter.xyz/docs/lighter-rh",
77
+ "https://apidocs.rh.lighter.xyz/docs/deposits-transfers-and-withdrawals",
78
+ "https://docs.paxos.com/guides/stablecoin/usdg/mainnet",
79
+ ],
80
+ },
81
+ },
82
+ testnet: {
83
+ restUrl: "https://api.rh-testnet.lighter.xyz",
84
+ wsUrl: null,
85
+ explorerUrl: null,
86
+ signingChainId: 300,
87
+ settlementChain: "robinhood",
88
+ collateral: ["USDC"],
89
+ collateralAssetIndex: 3,
90
+ rpcUrl: null,
91
+ depositPins: null,
92
+ },
93
+ };
94
+ export function lighterFamilyNetworks(venue) {
95
+ switch (venue) {
96
+ case "lighter": return LIGHTER_NETWORKS;
97
+ case "lighter-rh": return LIGHTER_RH_NETWORKS;
98
+ }
99
+ }
100
+ /**
101
+ * §10.8 + §10.13 #4 + §13.3. timeInForce lists the CLI inputs the adapter accepts:
102
+ * GTC is mapped to GTT (28-day expiry, LIGHTER_GTT_EXPIRY_MS) by LighterAdapter.limitOrder;
103
+ * 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
105
+ * in LIGHTER_CLIENT_ORDER_INDEX_MAX / lighterClientOrderIndex() (lighter.ts).
106
+ */
107
+ export const LIGHTER_CAPABILITIES = {
108
+ marketOrder: "slippageBounded",
109
+ // ALO → time-in-force 2 = POST_ONLY (apidocs trading.md; signed by the official lighter-go
110
+ // v1.0.9 WASM). Testnet confirmation that a crossing post-only is cancelled
111
+ // (canceled-post-only) is still pending (design §11).
112
+ timeInForce: ["GTC", "GTT", "IOC", "ALO"],
113
+ reduceOnlyTif: null,
114
+ clientOrderId: true,
115
+ orderAck: "async",
116
+ tpsl: "separateOrders",
117
+ amend: "native",
118
+ batchPlaceMax: null,
119
+ marginModes: ["cross", "isolated"],
120
+ withdrawAssets: ["USDC"],
121
+ };
122
+ /**
123
+ * GTC/GTT (and post-only) resting-order lifetime on both Lighter venues: orderExpiry -1 is
124
+ * 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).
126
+ */
127
+ export const LIGHTER_GTT_EXPIRY_MS = 28 * 24 * 60 * 60 * 1000;
128
+ /**
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
131
+ * orderBookDetails `last_trade_price` (stale on thin RH stock books). No runtime
132
+ * substitute: a missing side → PRICE_STALE before anything is sent.
133
+ */
134
+ export const LIGHTER_REFERENCE_PRICE_SOURCE = "orderBookOrders.mid";
135
+ /** Largest Lighter clientOrderIndex: 48-bit (2^48 − 1). 0 is the venue's "nil" index → 1 is the minimum. */
136
+ export const LIGHTER_CLIENT_ORDER_INDEX_MAX = 2 ** 48 - 1;
137
+ export const LIGHTER_RH_CAPABILITIES = {
138
+ ...LIGHTER_CAPABILITIES,
139
+ withdrawAssets: ["USDG"],
140
+ };
141
+ /**
142
+ * Standard-account REST limit: 60 requests per rolling minute, unweighted
143
+ * (rate-limits.md). The account tier cannot be determined from here, so the
144
+ * standard policy is used.
145
+ *
146
+ * Not modeled: on Premium/Plus accounts the limit is 24,000 *weighted*
147
+ * requests/min (`trades`/`recentTrades` weight 600, `sendTx`/`nextNonce` 6,
148
+ * others 300). The docs also apply `24000 / weight` when it is lower than 60, so
149
+ * even standard accounts get only 40/min on `trades`/`recentTrades` and 8/min on
150
+ * the 3000-weight endpoints. A 429 from those surfaces as RATE_LIMITED.
151
+ */
152
+ export const LIGHTER_RH_RATE_LIMIT = { capacity: 60, refillPerSec: 1, weights: null };
153
+ /**
154
+ * Lighter main: same engine and the same standard-account tier (60 req/min).
155
+ * Taken from the RH docs ("same API/engine"); the main-venue figure is not
156
+ * separately verified here.
157
+ */
158
+ export const LIGHTER_RATE_LIMIT = { capacity: 60, refillPerSec: 1, weights: null };
159
+ export function lighterFamilyRateLimit(venue) {
160
+ switch (venue) {
161
+ case "lighter": return LIGHTER_RATE_LIMIT;
162
+ case "lighter-rh": return LIGHTER_RH_RATE_LIMIT;
163
+ }
164
+ }
165
+ /** API key indexes Lighter RH reserves for its desktop/mobile interfaces (api-keys.md; valid range 0–254). */
166
+ export const LIGHTER_RH_RESERVED_KEY_INDEXES = [0, 1, 2, 3, 157];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Lighter RH venue definition (design §4 "Lighter RH", §10.1, §10.3, §10.8).
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).
5
+ */
6
+ import type { VenueDefinition } from "../venue.js";
7
+ export declare const lighterRhVenue: VenueDefinition;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Lighter RH venue definition (design §4 "Lighter RH", §10.1, §10.3, §10.8).
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).
5
+ */
6
+ import { LIGHTER_RH_CAPABILITIES, LIGHTER_RH_NETWORKS, LIGHTER_RH_RATE_LIMIT } from "./lighter-family.js";
7
+ import { BUILDER_FEE_CAPABILITIES } from "../builder-fee.js";
8
+ const publicData = {
9
+ async fetchFundingRates(net) {
10
+ return (await import("../lighter-public.js")).lighterPublicData("lighter-rh").fetchFundingRates(net);
11
+ },
12
+ async fetchMarkets(net) {
13
+ return (await import("../lighter-public.js")).lighterPublicData("lighter-rh").fetchMarkets(net);
14
+ },
15
+ };
16
+ export const lighterRhVenue = {
17
+ id: "lighter-rh",
18
+ aliases: ["lrh", "rh"],
19
+ displayName: "Lighter RH",
20
+ family: "lighter",
21
+ masterKeyKind: "evm",
22
+ agentKeyKind: "lighter-l2",
23
+ secretStorage: { kind: "perp-keystore", dir: "lighter-rh-agents" },
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).
26
+ fundingRateBasis: { kind: "perHours", hours: 8 },
27
+ settlementIntervalHours: 1,
28
+ fundingVerified: true,
29
+ roles: ["marketData", "account", "trading"],
30
+ capabilities: LIGHTER_RH_CAPABILITIES,
31
+ // Applied by the rate limiter (§10.9: new venues + lighter-rh).
32
+ rateLimit: LIGHTER_RH_RATE_LIMIT,
33
+ restrictedRegions: [],
34
+ symbolIdentity: "baseTicker",
35
+ publicData,
36
+ // §12: per account (account_trading_mode, read by LighterSpotAdapter.init): Unified (1) shares
37
+ // the collateral between spot and perp (no transfer); Classic (0) = separate spot balance +
38
+ // self-transfer of the venue collateral.
39
+ spot: {
40
+ accountModel: "runtime",
41
+ // Spot quote = the network's collateral (USDG mainnet, USDC testnet).
42
+ quoteAssets: { mainnet: LIGHTER_RH_NETWORKS.mainnet.collateral, testnet: LIGHTER_RH_NETWORKS.testnet.collateral },
43
+ capabilities: { limitOrder: true, orderbook: true, cancel: true, transfer: true },
44
+ async createSpot(perp) {
45
+ const [{ LighterAdapter }, { LighterSpotAdapter }] = await Promise.all([
46
+ import("../lighter.js"), import("../lighter-spot.js"),
47
+ ]);
48
+ if (!(perp instanceof LighterAdapter))
49
+ throw new Error(`lighter-rh spot needs a LighterAdapter (got ${perp.name})`);
50
+ const spot = new LighterSpotAdapter(perp);
51
+ await spot.init();
52
+ return spot;
53
+ },
54
+ },
55
+ maxSlippageBps: 5000,
56
+ builderFee: BUILDER_FEE_CAPABILITIES["lighter-rh"],
57
+ create: async (ctx) => (await import("./create-helpers.js")).createLighterFamily("lighter-rh", ctx),
58
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Lighter (main) venue definition (design §10.1, §10.8, §10.13 #4).
3
+ * Shares LighterAdapter and constants with lighter-rh (./lighter-family.ts).
4
+ */
5
+ import type { VenueDefinition } from "../venue.js";
6
+ export declare const lighterVenue: VenueDefinition;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Lighter (main) venue definition (design §10.1, §10.8, §10.13 #4).
3
+ * Shares LighterAdapter and constants with lighter-rh (./lighter-family.ts).
4
+ */
5
+ import { LIGHTER_CAPABILITIES, LIGHTER_NETWORKS, LIGHTER_RATE_LIMIT } from "./lighter-family.js";
6
+ import { BUILDER_FEE_CAPABILITIES } from "../builder-fee.js";
7
+ const publicData = {
8
+ async fetchFundingRates(net) {
9
+ return (await import("../lighter-public.js")).lighterPublicData("lighter").fetchFundingRates(net);
10
+ },
11
+ async fetchMarkets(net) {
12
+ return (await import("../lighter-public.js")).lighterPublicData("lighter").fetchMarkets(net);
13
+ },
14
+ };
15
+ export const lighterVenue = {
16
+ id: "lighter",
17
+ aliases: ["lt"],
18
+ displayName: "Lighter",
19
+ family: "lighter",
20
+ masterKeyKind: "evm",
21
+ agentKeyKind: "lighter-l2",
22
+ secretStorage: { kind: "perp-keystore", dir: "lighter-agents" },
23
+ networks: LIGHTER_NETWORKS,
24
+ fundingRateBasis: { kind: "perHours", hours: 8 },
25
+ settlementIntervalHours: 1,
26
+ fundingVerified: true,
27
+ roles: ["marketData", "account", "trading"],
28
+ capabilities: LIGHTER_CAPABILITIES,
29
+ // Declared only — per §10.9 the limiter is applied to new venues + lighter-rh, not lighter.
30
+ rateLimit: LIGHTER_RATE_LIMIT,
31
+ restrictedRegions: [],
32
+ symbolIdentity: "baseTicker",
33
+ publicData,
34
+ // §12: per account (account_trading_mode, read by LighterSpotAdapter.init): Unified (1) shares
35
+ // the collateral between spot and perp (no transfer); Classic (0) = separate spot balance +
36
+ // self-transfer of the venue collateral.
37
+ spot: {
38
+ accountModel: "runtime",
39
+ quoteAssets: { mainnet: LIGHTER_NETWORKS.mainnet.collateral, testnet: LIGHTER_NETWORKS.testnet.collateral },
40
+ capabilities: { limitOrder: true, orderbook: true, cancel: true, transfer: true },
41
+ async createSpot(perp) {
42
+ const [{ LighterAdapter }, { LighterSpotAdapter }] = await Promise.all([
43
+ import("../lighter.js"), import("../lighter-spot.js"),
44
+ ]);
45
+ if (!(perp instanceof LighterAdapter))
46
+ throw new Error(`lighter spot needs a LighterAdapter (got ${perp.name})`);
47
+ const spot = new LighterSpotAdapter(perp);
48
+ await spot.init();
49
+ return spot;
50
+ },
51
+ },
52
+ maxSlippageBps: 5000,
53
+ builderFee: BUILDER_FEE_CAPABILITIES["lighter"],
54
+ create: async (ctx) => (await import("./create-helpers.js")).createLighterFamily("lighter", ctx),
55
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Ondo Perps venue definition (design §4, §10).
3
+ *
4
+ * Off-chain matching engine; collateral is USDC plus eligible Ondo Global
5
+ * Markets tokenized stocks (docs collateral-assets). Hot-path key = HMAC API
6
+ * key stored in ~/.perp/ondo-agents/<keyId>.json (SSOT Rule #3).
7
+ * Not registered here; the registry module owns registerVenue().
8
+ */
9
+ import type { VenueDefinition } from "../venue.js";
10
+ /**
11
+ * Chain Ondo Perps withdrawals are paid out on (POST /v1/withdraw `network`).
12
+ * The venue settles off-chain (settlementChain "offchain"); USDC leaves on Ethereum.
13
+ */
14
+ export declare const ONDO_WITHDRAW_NETWORK = "ethereum";
15
+ /** Chains the CLI funds an Ondo Perps account from (`funds deposit ondo --chain`). */
16
+ export type OndoDepositChain = "arbitrum" | "ethereum";
17
+ export interface OndoDepositChainPins {
18
+ chainId: number;
19
+ label: string;
20
+ /** Public JSON-RPC of the chain (no env override). */
21
+ rpcUrl: string;
22
+ /** Native USDC (Circle) on that chain — the only asset the CLI sends. */
23
+ usdc: string;
24
+ sources: readonly string[];
25
+ }
26
+ /**
27
+ * PINNED USDC token addresses for Ondo Perps funding (mainnet). Funding is a plain ERC-20
28
+ * transfer of USDC to the account's own funding address (docs.ondoperps.xyz/funding-ondo-perps:
29
+ * "USDC is supported on Ethereum and Arbitrum"; api-reference/integration_guide "Deposit USDC").
30
+ * The network names equal the `network` values of POST /v1/wallet/deposit_address/list
31
+ * (live 2026-10-05: "ethereum" | "arbitrum" | "avalanche"). Decimals are read on-chain.
32
+ */
33
+ export declare const ONDO_DEPOSIT_CHAINS: Readonly<Record<OndoDepositChain, OndoDepositChainPins>>;
34
+ export declare const ondoVenue: VenueDefinition;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Ondo Perps venue definition (design §4, §10).
3
+ *
4
+ * Off-chain matching engine; collateral is USDC plus eligible Ondo Global
5
+ * Markets tokenized stocks (docs collateral-assets). Hot-path key = HMAC API
6
+ * key stored in ~/.perp/ondo-agents/<keyId>.json (SSOT Rule #3).
7
+ * Not registered here; the registry module owns registerVenue().
8
+ */
9
+ import { BUILDER_FEE_CAPABILITIES } from "../builder-fee.js";
10
+ /** Lazy: public.ts is only loaded when market data is actually requested. */
11
+ const publicData = {
12
+ async fetchFundingRates(net) {
13
+ return (await import("../ondo/public.js")).ondoPublicData.fetchFundingRates(net);
14
+ },
15
+ async fetchMarkets(net) {
16
+ return (await import("../ondo/public.js")).ondoPublicData.fetchMarkets(net);
17
+ },
18
+ };
19
+ /**
20
+ * Chain Ondo Perps withdrawals are paid out on (POST /v1/withdraw `network`).
21
+ * The venue settles off-chain (settlementChain "offchain"); USDC leaves on Ethereum.
22
+ */
23
+ export const ONDO_WITHDRAW_NETWORK = "ethereum";
24
+ /**
25
+ * PINNED USDC token addresses for Ondo Perps funding (mainnet). Funding is a plain ERC-20
26
+ * transfer of USDC to the account's own funding address (docs.ondoperps.xyz/funding-ondo-perps:
27
+ * "USDC is supported on Ethereum and Arbitrum"; api-reference/integration_guide "Deposit USDC").
28
+ * The network names equal the `network` values of POST /v1/wallet/deposit_address/list
29
+ * (live 2026-10-05: "ethereum" | "arbitrum" | "avalanche"). Decimals are read on-chain.
30
+ */
31
+ export const ONDO_DEPOSIT_CHAINS = {
32
+ arbitrum: {
33
+ chainId: 42161,
34
+ label: "Arbitrum",
35
+ rpcUrl: "https://arb1.arbitrum.io/rpc",
36
+ usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
37
+ sources: ["https://developers.circle.com/stablecoins/usdc-contract-addresses", "https://docs.ondoperps.xyz/funding-ondo-perps"],
38
+ },
39
+ ethereum: {
40
+ chainId: 1,
41
+ label: "Ethereum",
42
+ rpcUrl: "https://ethereum-rpc.publicnode.com",
43
+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
44
+ sources: ["https://developers.circle.com/stablecoins/usdc-contract-addresses", "https://docs.ondoperps.xyz/funding-ondo-perps"],
45
+ },
46
+ };
47
+ /** Collateral accepted for margin (docs collateral-assets, 2026-09-30). */
48
+ const ONDO_COLLATERAL = [
49
+ "USDC",
50
+ "SPYon", "QQQon", "NVDAon", "GOOGLon", "TSLAon", "MUon", "SNDKon",
51
+ "DRAMon", "SPCXon", "CRCLon", "SLVon", "GLDon",
52
+ ];
53
+ export const ondoVenue = {
54
+ id: "ondo",
55
+ aliases: ["ondo-perps"],
56
+ displayName: "Ondo Perps",
57
+ family: "ondo",
58
+ masterKeyKind: "evm",
59
+ agentKeyKind: "hmac",
60
+ secretStorage: { kind: "perp-keystore", dir: "ondo-agents" },
61
+ networks: {
62
+ mainnet: {
63
+ restUrl: "https://api.ondoperps.xyz",
64
+ wsUrl: "wss://api.ondoperps.xyz/ws",
65
+ explorerUrl: null,
66
+ signingChainId: null,
67
+ settlementChain: "offchain",
68
+ collateral: ONDO_COLLATERAL,
69
+ collateralAssetIndex: null,
70
+ rpcUrl: null,
71
+ depositPins: null,
72
+ },
73
+ testnet: {
74
+ restUrl: "https://api.ondoperps-sandbox.xyz",
75
+ wsUrl: "wss://api.ondoperps-sandbox.xyz/ws",
76
+ explorerUrl: null,
77
+ signingChainId: null,
78
+ settlementChain: "offchain",
79
+ collateral: ONDO_COLLATERAL,
80
+ collateralAssetIndex: null,
81
+ rpcUrl: null,
82
+ depositPins: null,
83
+ },
84
+ },
85
+ fundingRateBasis: { kind: "perHours", hours: 1 },
86
+ settlementIntervalHours: 1,
87
+ fundingVerified: true,
88
+ roles: ["marketData", "account", "trading"],
89
+ capabilities: {
90
+ // The venue offers native market orders; the adapter sends every market order
91
+ // as an IOC LIMIT at the tick-aligned protection price (mark ± resolved
92
+ // slippage, design §13.2).
93
+ marketOrder: "native",
94
+ timeInForce: ["GTC", "IOC", "ALO"],
95
+ // A reduce-only limit order must be IOC: the venue refuses a resting one with HTTP 400
96
+ // `reduce_only_invalid_tif` "reduce only order can only be IOC" (live mainnet 2026-10-05).
97
+ // docs.ondoperps.xyz/api-reference/rest-spec.json lists the errorCode `reduce_only_invalid_tif`
98
+ // on POST /v1/perps/orders; the rule itself is not spelled out in the prose docs.
99
+ reduceOnlyTif: ["IOC"],
100
+ clientOrderId: true,
101
+ orderAck: "sync",
102
+ tpsl: "attached",
103
+ amend: "cancelReplace",
104
+ batchPlaceMax: 20,
105
+ marginModes: ["cross"],
106
+ withdrawAssets: ["USDC"],
107
+ },
108
+ rateLimit: { capacity: 1, refillPerSec: 1, weights: null },
109
+ // Docs (account-set-up, about): "outside the U.S., Panama and other prohibited
110
+ // jurisdictions". The remaining prohibited list is only in the Terms of Service.
111
+ restrictedRegions: ["US", "PA"],
112
+ symbolIdentity: "baseTicker",
113
+ publicData,
114
+ // §12: separate spot wallet + POST /v1/spot/transfers (spot ↔ margin).
115
+ spot: {
116
+ accountModel: "separate",
117
+ quoteAssets: { mainnet: ["USDC"], testnet: ["USDC"] },
118
+ capabilities: { limitOrder: true, orderbook: true, cancel: true, transfer: true },
119
+ async createSpot(perp) {
120
+ const [{ OndoAdapter }, { OndoSpotAdapter }] = await Promise.all([
121
+ import("../ondo/adapter.js"), import("../ondo/spot.js"),
122
+ ]);
123
+ if (!(perp instanceof OndoAdapter))
124
+ throw new Error(`ondo spot needs an OndoAdapter (got ${perp.name})`);
125
+ const spot = new OndoSpotAdapter(perp);
126
+ await spot.init();
127
+ return spot;
128
+ },
129
+ },
130
+ maxSlippageBps: 5000,
131
+ builderFee: BUILDER_FEE_CAPABILITIES["ondo"],
132
+ create: async (ctx) => {
133
+ const adapter = new (await import("../ondo/adapter.js")).OndoAdapter(ondoVenue, ctx);
134
+ // Builder code: only settings builder.ondo (off by default). Ondo has no approval step.
135
+ const { loadSettings } = await import("../../settings.js");
136
+ const { resolveBuilderGate } = await import("../builder-fee.js");
137
+ adapter.builderFee = resolveBuilderGate("ondo", ctx, loadSettings().builder, null, () => "");
138
+ return adapter;
139
+ },
140
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pacifica venue definition (design §10.1, §10.8, §10.13 #4).
3
+ * Adapter + public-data code are loaded lazily (§10.10).
4
+ */
5
+ import type { VenueDefinition } from "../venue.js";
6
+ /** Pacifica `client_order_id` format: "Full UUID string" (docs.pacifica.fi rest-api orders/create-limit-order). */
7
+ export declare const PACIFICA_UUID_RE: RegExp;
8
+ export declare const pacificaVenue: VenueDefinition;