Skip to main content

Crate fynd_client

Crate fynd_client 

Source
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.

§Constructing a client

Use FyndClientBuilder to configure and build a FyndClient:

let client = FyndClientBuilder::new(
    "https://rpc.fynd.exchange",
    "https://mainnet.infura.io/v3/YOUR_KEY",
)
.build()
.await?;

§Minimal quote example

let weth: Bytes = Bytes::copy_from_slice(&[0xC0; 20]); // placeholder
let usdc: Bytes = Bytes::copy_from_slice(&[0xA0; 20]); // placeholder
let sender: Bytes = Bytes::copy_from_slice(&[0xd8; 20]); // placeholder

let order = Order::new(
    weth,
    usdc,
    BigUint::from(1_000_000_000_000_000_000u64), // 1 WETH (18 decimals)
    OrderSide::Sell,
    sender,
    None,
);

let quote = client
    .quote(QuoteParams::new(order, QuoteOptions::default()))
    .await?;

println!("amount out: {}", quote.amount_out());

Structs§

ApprovalParams
Parameters for FyndClient::approval.
ApprovalPayload
An unsigned EIP-1559 approve(spender, amount) transaction.
BlockInfo
Ethereum block at which a quote was computed.
ClientFeeParams
Client fee configuration for the Tycho Router.
EncodingOptions
Options that instruct the server to return ABI-encoded calldata in the quote response.
ExecutionOptions
Options controlling the behaviour of FyndClient::execute_swap.
FeeBreakdown
Breakdown of fees applied to the swap output by the on-chain FeeCalculator.
FyndClient
The main entry point for interacting with the Fynd DEX router.
FyndClientBuilder
Builder for FyndClient.
FyndPayload
A ready-to-sign EIP-1559 transaction produced by the Fynd execution path.
HealthStatus
Health information from the Fynd RPC server’s /v1/health endpoint.
InstanceInfo
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.
PermitDetails
Per-token details for a Permit2 single-token authorization.
PermitSingle
A single Permit2 authorization, covering one token for one spender.
Quote
The solver’s response for a single order.
QuoteOptions
Optional parameters that tune solving behaviour for a QuoteParams request.
QuoteParams
All inputs needed to call FyndClient::quote.
RetryConfig
Controls how FyndClient::quote retries transient failures.
Route
An ordered sequence of swaps that together execute a complete token swap.
SettledOrder
The result of a successfully mined or simulated swap transaction.
SignedApproval
An ApprovalPayload paired with its cryptographic signature.
SignedSwap
A SwapPayload paired with its cryptographic signature.
SigningHints
Optional hints to override auto-resolved transaction parameters.
StorageOverrides
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 EncodingOptions was set.

Enums§

BackendKind
Which backend solver produced a given order quote.
ErrorCode
A structured error code returned by the Fynd RPC API.
ExecutionReceipt
A future that resolves once the swap transaction is mined and settled.
FyndError
Errors that can be returned by FyndClient methods.
OrderSide
The direction of a swap order.
QuoteStatus
High-level status of a single-order quote returned by the solver.
SwapPayload
A payload that needs to be signed before a swap can be executed.
TxReceipt
A future that resolves once a submitted transaction is mined.
UserTransferType
Token transfer method used when building an on-chain swap transaction.