pub struct RouteRequest {
pub chain_id: u64,
pub from_address: String,
pub receiver: String,
pub token_in: Vec<String>,
pub token_out: Vec<String>,
pub amount_in: Vec<String>,
pub slippage: String,
pub routing_strategy: Option<RoutingStrategy>,
pub spender: Option<String>,
pub disable_estimate: Option<bool>,
}Expand description
Route request parameters for getting swap routes
Fields§
§chain_id: u64Chain ID
from_address: StringSender/from address
receiver: StringReceiver address
token_in: Vec<String>Input token addresses
token_out: Vec<String>Output token addresses
amount_in: Vec<String>Input amounts (in smallest units)
slippage: StringSlippage tolerance in basis points (as string, e.g., “100” for 1%)
routing_strategy: Option<RoutingStrategy>Routing strategy
spender: Option<String>Spender address (for approvals)
disable_estimate: Option<bool>Disable estimate (for faster quotes)
Implementations§
Source§impl RouteRequest
impl RouteRequest
Sourcepub fn new(
chain_id: u64,
from_address: impl Into<String>,
token_in: impl Into<String>,
token_out: impl Into<String>,
amount_in: impl Into<String>,
slippage_bps: u16,
) -> Self
pub fn new( chain_id: u64, from_address: impl Into<String>, token_in: impl Into<String>, token_out: impl Into<String>, amount_in: impl Into<String>, slippage_bps: u16, ) -> Self
Create a new route request for a simple swap
Sourcepub fn with_receiver(self, receiver: impl Into<String>) -> Self
pub fn with_receiver(self, receiver: impl Into<String>) -> Self
Set a different receiver address
Sourcepub fn with_routing_strategy(self, strategy: RoutingStrategy) -> Self
pub fn with_routing_strategy(self, strategy: RoutingStrategy) -> Self
Set the routing strategy
Sourcepub fn with_spender(self, spender: impl Into<String>) -> Self
pub fn with_spender(self, spender: impl Into<String>) -> Self
Set the spender address
Sourcepub fn with_disable_estimate(self, disable: bool) -> Self
pub fn with_disable_estimate(self, disable: bool) -> Self
Disable estimation for faster quotes
Sourcepub fn with_tokens_in(self, tokens: Vec<String>, amounts: Vec<String>) -> Self
pub fn with_tokens_in(self, tokens: Vec<String>, amounts: Vec<String>) -> Self
Add multiple input tokens (for multi-input swaps)
Sourcepub fn with_tokens_out(self, tokens: Vec<String>) -> Self
pub fn with_tokens_out(self, tokens: Vec<String>) -> Self
Add multiple output tokens (for multi-output swaps)
Trait Implementations§
Source§impl Clone for RouteRequest
impl Clone for RouteRequest
Source§fn clone(&self) -> RouteRequest
fn clone(&self) -> RouteRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RouteRequest
impl Debug for RouteRequest
Auto Trait Implementations§
impl Freeze for RouteRequest
impl RefUnwindSafe for RouteRequest
impl Send for RouteRequest
impl Sync for RouteRequest
impl Unpin for RouteRequest
impl UnwindSafe for RouteRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more