Expand description
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.
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 to run a local Fynd instance.
§Constructing a client
Use FyndClientBuilder to configure and build a FyndClient:
let client = FyndClientBuilder::new(
"http://localhost:3000",
"https://reth-ethereum.ithaca.xyz/rpc",
)
.build()
.await?;For quote-only use (no on-chain transactions), skip the RPC connection with
FyndClientBuilder::build_quote_only:
let client = FyndClientBuilder::new("http://localhost:3000", "http://localhost:3000")
.build_quote_only()?;§Requesting a quote
// 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());Structs§
- Approval
Params - Parameters for
FyndClient::approval. - Approval
Payload - An unsigned EIP-1559
approve(spender, amount)transaction. - Block
Info - Ethereum block at which a quote was computed.
- Client
FeeParams - Client fee configuration for the Tycho Router.
- Encoding
Options - Options that instruct the server to return ABI-encoded calldata in the quote response.
- Execution
Options - Options controlling the behaviour of
FyndClient::execute_swap. - FeeBreakdown
- Breakdown of fees applied to the swap output by the on-chain FeeCalculator.
- Fynd
Client - The main entry point for interacting with the Fynd DEX router.
- Fynd
Client Builder - Builder for
FyndClient. - Fynd
Payload - A ready-to-sign EIP-1559 transaction produced by the Fynd execution path.
- Health
Status - Health information from the Fynd RPC server’s
/v1/healthendpoint. - Instance
Info - Static metadata about this Fynd instance, returned by
GET /v1/info. - MinedTx
- The result of a successfully mined transaction (non-swap).
- Order
- A single swap intent submitted to the Fynd solver.
- Permit
Details - Per-token details for a Permit2 single-token authorization.
- Permit
Single - A single Permit2 authorization, covering one token for one spender.
- Quote
- The solver’s response for a single order.
- Quote
Options - Optional parameters that tune solving behaviour for a
QuoteParamsrequest. - Quote
Params - All inputs needed to call
FyndClient::quote. - Retry
Config - Controls how
FyndClient::quoteretries transient failures. - Route
- An ordered sequence of swaps that together execute a complete token swap.
- Settled
Order - The result of a successfully mined or simulated swap transaction.
- Signed
Approval - An
ApprovalPayloadpaired with its cryptographic signature. - Signed
Swap - A
SwapPayloadpaired with its cryptographic signature. - Signing
Hints - Optional hints to override auto-resolved transaction parameters.
- Storage
Overrides - Per-account EVM storage slot overrides for dry-run simulations.
- Swap
- A single atomic swap on one liquidity pool within a
Route. - Transaction
- An encoded EVM transaction returned by the server when
EncodingOptionswas set.
Enums§
- Allowance
Check - Controls whether
FyndClient::approvalchecks the current on-chain allowance before building an approval transaction. - Backend
Kind - Which backend solver produced a given order quote.
- Error
Code - A structured error code returned by the Fynd RPC API.
- Execution
Receipt - A future that resolves once the swap transaction is mined and settled.
- Fynd
Error - Errors that can be returned by
FyndClientmethods. - Order
Side - The direction of a swap order.
- Quote
Status - High-level status of a single-order quote returned by the solver.
- Swap
Payload - A payload that needs to be signed before a swap can be executed.
- TxReceipt
- A future that resolves once a submitted transaction is mined.
- User
Transfer Type - Token transfer method used when building an on-chain swap transaction.