1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! HTTP RPC server for the [Fynd](https://fynd.xyz) DEX router.
//!
//! Wraps [fynd-core](fynd_core) with Actix Web to expose swap-routing as a REST service.
//! Use [`FyndRPCBuilder`](builder::FyndRPCBuilder) to assemble and start the server.
//!
//! [`RouteConfigurator`](api::RouteConfigurator) and the handlers put actix-web types in this
//! crate's public API, so an actix-web major bump is a breaking change for `fynd-rpc`; the
//! [`actix_web`] crate is re-exported here so embedders can rely on the same type identity.
//!
//! For documentation and configuration guides see **<https://docs.fynd.xyz/>**.
//! For the full API reference see **<https://docs.fynd.xyz/reference/api>**.
//!
//! ## Endpoints
//!
//! | Endpoint | Description |
//! |---|---|
//! | `POST /v1/quote` | Request an optimal swap route |
//! | `GET /v1/health` | Data freshness and solver readiness |
//! | `GET /v1/info` | Static instance metadata (chain ID, contract addresses) |
//!
//! ## Embedding and overriding endpoints
//!
//! Binaries that embed `fynd-rpc` can replace one endpoint while keeping the rest via
//! [`FyndRPCBuilder::configure_routes`](builder::FyndRPCBuilder::configure_routes). Overrides can
//! only add or shadow routes under `/v1`, and shadowing a default route does not change the
//! OpenAPI spec served at `/docs/`:
//!
//! ```text
//! builder.configure_routes(|scope, _state| {
//! scope.route("/quote", web::post().to(my_quote))
//! });
//! ```
//!
//! See [`FyndRPCBuilder::configure_routes`](builder::FyndRPCBuilder::configure_routes) for a
//! compiling version of this example.
//!
//! A custom handler can reuse the stock request/response plumbing —
//! [`api::handlers::validate_quote_request`], [`api::request_capture::ReplayRequest::capture`]
//! and [`api::handlers::log_quote_outcome`] — and the solving stages
//! [`fynd_core::WorkerPoolRouter::solve`], [`fynd_core::encode_quotes`], and
//! [`fynd_core::finalize_quote`] that the default `/v1/quote` handler is composed of.
/// HTTP endpoint handlers, OpenAPI docs, and shared application state.
/// Server builder and runner.
/// TOML-based worker pool configuration and server defaults.
/// Protocol discovery via the Tycho RPC.
// Re-export parse_chain so tools that depend on fynd-rpc (not fynd-core) can use it.
use Path;
/// Re-exported: [`RouteConfigurator`](api::RouteConfigurator) and the handlers use actix-web
/// types; an actix-web major bump is a breaking change for this crate.
pub use actix_web;
pub use parse_chain;
/// Installs the process-global custom-chain registry from a `chains.yaml` file.
///
/// Call once at startup before resolving any chain name. No-op-safe to omit for built-in chains.