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
89
90
91
92
93
94
//! Rust client for the [Fynd](https://fynd.xyz) DEX router.
//!
//! `fynd-client` lets you request swap quotes, build signable transaction payloads, and
//! broadcast signed orders through the Fynd RPC API — all from a single typed interface.
//!
//! For guides, API reference, and setup instructions see **<https://docs.fynd.xyz/>**.
//!
//! # Workflow
//!
//! A complete swap runs in three steps: **quote → approve → sign and execute**.
//! See `examples/swap_erc20.rs` for a full walkthrough, or follow the
//! [quickstart](https://docs.fynd.xyz/get-started/quickstart) to run a local Fynd instance.
//!
//! # Constructing a client
//!
//! Use [`FyndClientBuilder`] to configure and build a [`FyndClient`]:
//!
//! ```rust,no_run
//! # use fynd_client::FyndClientBuilder;
//! # #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = FyndClientBuilder::new(
//! "http://localhost:3000",
//! "https://reth-ethereum.ithaca.xyz/rpc",
//! )
//! .build()
//! .await?;
//! # Ok(()) }
//! ```
//!
//! For quote-only use (no on-chain transactions), skip the RPC connection with
//! [`FyndClientBuilder::build_quote_only`]:
//!
//! ```rust,no_run
//! # use fynd_client::FyndClientBuilder;
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = FyndClientBuilder::new("http://localhost:3000", "http://localhost:3000")
//! .build_quote_only()?;
//! # Ok(()) }
//! ```
//!
//! # Requesting a quote
//!
//! ```rust,no_run
//! # use fynd_client::{FyndClientBuilder, Order, OrderSide, QuoteOptions, QuoteParams};
//! # use alloy::primitives::address;
//! # use bytes::Bytes;
//! # use num_bigint::BigUint;
//! # #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! # let client = FyndClientBuilder::new("http://localhost:3000", "http://localhost:3000")
//! # .build_quote_only()?;
//! // WETH → USDC on mainnet (Vitalik's address as sender).
//! let weth: Bytes = address!("C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2").to_vec().into();
//! let usdc: Bytes = address!("A0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48").to_vec().into();
//! let sender: Bytes = address!("d8dA6BF26964aF9D7eEd9e03E53415D37aA96045").to_vec().into();
//!
//! let quote = client
//! .quote(QuoteParams::new(
//! Order::new(
//! weth,
//! usdc,
//! BigUint::from(1_000_000_000_000_000_000u64), // 1 WETH (18 decimals)
//! OrderSide::Sell,
//! sender,
//! None,
//! ),
//! QuoteOptions::default(),
//! ))
//! .await?;
//!
//! println!("amount out: {}", quote.amount_out());
//! # Ok(()) }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;