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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! # Monaco SDK
//!
//! Typed Rust client for the [Monaco DEX](https://github.com/Monaco-Research/monaco-core)
//! REST API — auto-generated from the OpenAPI specification via
//! [progenitor](https://docs.rs/progenitor).
//!
//! ## Quick start
//!
//! ```rust,no_run
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = monaco_sdk::Client::new("https://develop.apimonaco.xyz");
//!
//! // Public endpoints (no auth required)
//! let health = client.health_check().await?.into_inner();
//! println!("Status: {:?}", health.status);
//!
//! let pairs = client
//! .list_trading_pairs(None, None, Some(true), None, None, None, None)
//! .await?
//! .into_inner();
//! println!("Trading pairs: {:?}", pairs.trading_pairs);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Authentication
//!
//! Monaco uses noncustodial session-key auth. At login the client generates a
//! random ed25519 keypair locally and registers the public key through the
//! challenge → wallet-sign → verify flow (the wallet signature authorizes the
//! session public key). Every authenticated request is then signed with the
//! session private key and carries `X-Monaco-PublicKey`, `X-Monaco-Timestamp`,
//! and `X-Monaco-Signature` headers over
//! `METHOD\nPATH_WITH_QUERY\nTIMESTAMP_MS\nSHA256_BODY_HEX`.
//!
//! Per-request signing requires a request-signing layer that this generated
//! client does not yet provide; until it lands, sign requests yourself (e.g.
//! a reqwest layer that injects the headers above) when calling authenticated
//! endpoints. The public challenge/verify endpoints work out of the box.
//!
//! ## API coverage
//!
//! The client exposes every operation from the Monaco REST API:
//!
//! | Category | Methods |
//! |----------|---------|
//! | **Market data** | `list_trading_pairs`, `get_trading_pair_by_id`, `get_market_metadata`, `get_candles`, `get_screener`, `get_open_interest` |
//! | **Perp markets** | `get_perp_market_config`, `get_perp_market_summary`, `get_mark_price`, `get_index_price`, `get_funding_state`, `list_funding_history` |
//! | **Orderbook** | `get_orderbook_snapshot` |
//! | **Trades** | `get_trades`, `get_trade_by_id`, `get_user_trades` |
//! | **Orders** | `create_order`, `replace_order`, `cancel_order`, `get_orders`, `get_order_by_id` |
//! | **Conditional orders** | `cancel_conditional_order`, `list_conditional_orders` |
//! | **Batch orders** | `batch_create_orders`, `batch_replace_orders`, `batch_cancel_orders`, `batch_cancel_all`, `batch_cancel_all_by_pair` |
//! | **Accounts** | `get_user_profile`, `get_user_balances`, `get_user_balance_by_asset`, `get_user_movements`, `list_funding_payments`, `get_portfolio_stats`, `get_portfolio_chart` |
//! | **Sub-accounts** | `list_sub_accounts_with_balances`, `create_sub_account_limit`, `get_sub_account_limits`, `update_sub_account_limit`, `delete_sub_account_limit` |
//! | **Margin accounts** | `list_margin_accounts`, `get_margin_account_summary`, `get_margin_account_movements`, `get_available_collateral`, `transfer_collateral_to_margin_account`, `transfer_collateral_from_margin_account`, `transfer_collateral_to_parent_margin_account`, `transfer_collateral_from_parent_margin_account`, `transfer_collateral_to_risk_bucket`, `simulate_order_risk`, `simulate_risk_bucket_order_risk` |
//! | **Positions** | `list_positions`, `get_position`, `close_position`, `get_position_risk`, `add_position_margin`, `reduce_position_margin`, `list_position_history`, `attach_position_tp_sl` |
//! | **Delegated agents** | `upsert_delegated_agent`, `list_delegated_agents`, `list_delegated_agent_owners`, `revoke_delegated_agent`, `create_delegated_session` |
//! | **Applications** | `get_application_config`, `get_application_stats`, `list_application_orders`, `list_application_users`, `list_application_movements`, `list_application_balances` |
//! | **Auth** | `create_challenge`, `verify_signature`, `refresh_session`, `revoke_session`, `authenticate_backend` |
//! | **Fees** | `simulate_fees` |
//! | **Whitelist** | `submit_whitelist` |
//! | **Faucet** | `mint_tokens` |
//! | **Health** | `health_check` |
//!
//! All request/response types live in the [`types`] module.
// The client below is generated verbatim by progenitor from openapi/openapi.yaml
// at build time and `include!`d here (see build.rs). It is not hand-maintained
// and cannot be edited, so the pedantic/nursery lints it trips are suppressed
// crate-wide rather than per-item:
// - default_trait_access / use_self : progenitor's codegen style
// - match_same_arms / items_after_statements : shape of the generated impls
// - must_use_candidate / doc_markdown
// / too_long_first_doc_paragraph : generated builder docs
include!;