longtrader_proto/lib.rs
1//! Connect-RPC protocol definitions and client for the trading terminal.
2//!
3//! All generated protobuf types — including `longtrader.terminal.v1` — now come
4//! from the single source of truth, [`longtrader_contract`]. This crate adds
5//! only the native (hpx) client and a shared transport helper on top, so there
6//! is exactly one generated code base for the whole workspace (no duplicate
7//! `terminal.v1` codegen).
8
9#![allow(missing_docs)]
10#![allow(missing_debug_implementations)]
11#![allow(clippy::pedantic)]
12#![allow(clippy::use_self)]
13#![allow(elided_lifetimes_in_paths)]
14#![allow(clippy::derive_partial_eq_without_eq)]
15
16/// Single source of truth for every generated protobuf type.
17pub use longtrader_contract::proto;
18
19#[cfg(any(feature = "client-native", feature = "client-wasm"))]
20mod client_core;
21
22/// Native (hpx) client for the terminal services.
23#[cfg(feature = "client-native")]
24pub mod client;
25
26/// WASM-compatible client (gloo-net / web-sys) for the terminal services.
27#[cfg(feature = "client-wasm")]
28pub mod client_wasm;
29
30// Re-export the active client types. When only one of `client-native` /
31// `client-wasm` is enabled, this is a simple re-export. When both are enabled,
32// the caller must disambiguate via `longtrader_proto::client::TerminalClient`
33// or `longtrader_proto::client_wasm::TerminalClient`.
34#[cfg(all(feature = "client-native", not(feature = "client-wasm")))]
35pub use client::{TerminalClient, TerminalClientError};
36#[cfg(all(feature = "client-wasm", not(feature = "client-native")))]
37pub use client_wasm::{TerminalClient, TerminalClientError};
38
39/// Shared Connect-RPC unary transport, reused by every client in the workspace
40/// (the worker's `RemoteAdapter` and this crate's `TerminalClient`) so the
41/// URL construction, bearer auth, status handling and decode logic lives once.
42#[cfg(feature = "client-native")]
43pub mod transport;
44
45/// Canonical service name constants (Connect path `/{service}/{method}`).
46///
47/// The single owner of every Connect service path in the workspace: the
48/// worker's `RemoteAdapter` and both clients derive their paths from these, so
49/// a rename is one edit plus a failing test, not a silent 404.
50pub mod service_name {
51 /// Canonical market data service; the terminal surface never redefined it.
52 pub const MARKET_DATA: &str = "longtrader.market.v1.MarketDataService";
53 /// Canonical trading service.
54 pub const TRADING: &str = "longtrader.trading.v1.TradingService";
55 /// Canonical streaming service (same envelope as `RuntimeService::StreamUpdates`).
56 pub const STREAM: &str = "longtrader.stream.v1.StreamService";
57 /// Terminal-only runtime surface: health, venue listing, update stream.
58 pub const RUNTIME: &str = "longtrader.terminal.v1.RuntimeService";
59 /// Terminal-only strategy surface: lifecycle, actions, strategy events.
60 pub const STRATEGY: &str = "longtrader.terminal.v1.StrategyService";
61 /// Self-describing venue-operation registry.
62 pub const OPS: &str = "longtrader.ops.v1.VenueOpService";
63}
64
65// Backwards-compatible convenience: surface the terminal.v1 types at the crate
66// root exactly as before the contract convergence.
67pub use longtrader_contract::proto::longtrader::terminal::v1::*;