Skip to main content

Crate tidepool_server

Crate tidepool_server 

Source
Expand description

Tidepool HTTP + WebSocket JSON-RPC server. Wraps the service layer’s async functions behind an axum front-end.

Public surface:

  • run starts the server and blocks until shutdown.
  • ServerConfig holds port, upstream URL, and optional indexed trees.
  • HttpUpstream is the production UpstreamClient impl; consumers building their own servers can import it directly.

Re-exports§

pub use config::ServerConfig;
pub use http::run;
pub use upstream_http::HttpUpstream;
pub use ws::run_ws;

Modules§

config
Server configuration. Shape mirrors the TS ProxyOptions plus server-specific knobs (port, WS URL override).
dispatcher
JSON-RPC method dispatch. The core architectural win: every method we serve maps to a Method enum variant, and the dispatch function does an exhaustive match. Adding a new method = add a variant + a match arm; compiler fails the build if you forget.
http
axum HTTP server: JSON-RPC over POST, CORS, passthrough proxy for anything the dispatcher doesn’t claim.
json_rpc
JSON-RPC 2.0 envelope types. Kept minimal + lenient — Solana’s RPC ecosystem varies slightly between 1.0 / 2.0 implementations and we want to pass through whatever clients send without over- validating.
rest
REST transport. Mirrors the paths helius-sdk hits on api.helius.xyz/v0/... — served from the same base URL as our JSON-RPC endpoint so a user pointing helius-sdk at Tidepool gets every method, on the transport the SDK expects.
upstream_http
Production UpstreamClient impl over reqwest. Plain JSON-RPC POST to the upstream URL.
webhook_runtime
Per-process webhook runtime: registry + background delivery tasks.
ws
WebSocket reverse proxy to Surfpool’s native WS endpoint.

Traits§

UpstreamClient
An abstract Solana RPC client. rpc_call is the catch-all; typed conveniences sit on top of it where we care about ergonomics.