monaco_sdk/lib.rs
1//! # Monaco SDK
2//!
3//! Typed Rust client for the [Monaco DEX](https://github.com/Monaco-Research/monaco-core)
4//! REST API — auto-generated from the OpenAPI specification via
5//! [progenitor](https://docs.rs/progenitor).
6//!
7//! ## Quick start
8//!
9//! ```rust,no_run
10//! #[tokio::main]
11//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
12//! let client = monaco_sdk::Client::new("https://develop.apimonaco.xyz");
13//!
14//! // Public endpoints (no auth required)
15//! let health = client.health_check().await?.into_inner();
16//! println!("Status: {:?}", health.status);
17//!
18//! let pairs = client
19//! .list_trading_pairs(None, Some(true), None, None, None, None)
20//! .await?
21//! .into_inner();
22//! println!("Trading pairs: {:?}", pairs.trading_pairs);
23//!
24//! Ok(())
25//! }
26//! ```
27//!
28//! ## Authentication
29//!
30//! Authenticated endpoints require a Bearer token obtained through the
31//! challenge → sign → verify flow. Pass it via a custom `reqwest::Client`:
32//!
33//! ```rust,no_run
34//! use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
35//!
36//! let mut headers = HeaderMap::new();
37//! headers.insert(
38//! AUTHORIZATION,
39//! HeaderValue::from_str("Bearer <your-jwt>").unwrap(),
40//! );
41//! let http = reqwest::ClientBuilder::new()
42//! .default_headers(headers)
43//! .build()
44//! .unwrap();
45//! let client = monaco_sdk::Client::new_with_client("https://develop.apimonaco.xyz", http);
46//! ```
47//!
48//! ## API coverage
49//!
50//! The client exposes every operation from the Monaco REST API:
51//!
52//! | Category | Methods |
53//! |----------|---------|
54//! | **Market data** | `list_trading_pairs`, `get_trading_pair_by_id`, `get_market_metadata`, `get_candles` |
55//! | **Orderbook** | `get_orderbook_snapshot` |
56//! | **Trades** | `get_trades` |
57//! | **Orders** | `create_order`, `replace_order`, `cancel_order`, `get_orders`, `get_order_by_id` |
58//! | **Batch orders** | `batch_create_orders`, `batch_replace_orders`, `batch_cancel_orders`, `batch_cancel_all`, `batch_cancel_all_by_pair` |
59//! | **Accounts** | `get_user_profile`, `get_user_balances`, `get_user_balance_by_asset`, `get_user_movements` |
60//! | **Sub-accounts** | `list_sub_accounts_with_balances`, `create_sub_account_limit`, `get_sub_account_limits`, `update_sub_account_limit`, `delete_sub_account_limit` |
61//! | **Auth** | `create_challenge`, `verify_signature`, `refresh_token`, `revoke_session`, `authenticate_backend` |
62//! | **Fees** | `simulate_fees` |
63//! | **Whitelist** | `submit_whitelist` |
64//! | **Faucet** | `mint_tokens` |
65//! | **Health** | `health_check` |
66//!
67//! All request/response types live in the [`types`] module.
68
69include!(concat!(env!("OUT_DIR"), "/api.rs"));