Rust client for the Fynd 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.
Constructing a client
Use [FyndClientBuilder] to configure and build a [FyndClient]:
# use fynd_client::{FyndClient, FyndClientBuilder};
# #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = FyndClientBuilder::new(
"https://rpc.fynd.exchange",
"https://mainnet.infura.io/v3/YOUR_KEY",
)
.build()
.await?;
# Ok(()) }
Minimal quote example
# use fynd_client::{FyndClientBuilder, Order, OrderSide, QuoteOptions, QuoteParams};
# use bytes::Bytes;
# use num_bigint::BigUint;
# #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> {
# let client = FyndClientBuilder::new("https://rpc.fynd.exchange", "https://example.com")
# .build().await?;
let weth: Bytes = Bytes::copy_from_slice(&[0xC0; 20]); let usdc: Bytes = Bytes::copy_from_slice(&[0xA0; 20]); let sender: Bytes = Bytes::copy_from_slice(&[0xd8; 20]);
let order = Order::new(
weth,
usdc,
BigUint::from(1_000_000_000_000_000_000u64), OrderSide::Sell,
sender,
None,
);
let quote = client
.quote(QuoteParams::new(order, QuoteOptions::default()))
.await?;
println!("amount out: {}", quote.amount_out());
# Ok(()) }