pub struct QuoteParams<'a> { /* private fields */ }Expand description
Parameters for requesting a swap quote from a pool.
Contains the tokens to swap between, the input amount, and whether the simulation should return a modified state to reflect the swap execution.
Implementations§
Source§impl<'a> QuoteParams<'a>
impl<'a> QuoteParams<'a>
Source§impl<'a> QuoteParams<'a>
impl<'a> QuoteParams<'a>
Sourcepub fn fixed_in(
token_in: &'a TokenAddress,
token_out: &'a TokenAddress,
amount: BigUint,
) -> SimulationResult<Self>
pub fn fixed_in( token_in: &'a TokenAddress, token_out: &'a TokenAddress, amount: BigUint, ) -> SimulationResult<Self>
Creates new fixed input parameters with default settings (no state modification).
§Arguments
token_in- The token to selltoken_out- The token to buyamount- The amount of input token to sell
Sourcepub fn fixed_out(
token_in: &'a TokenAddress,
token_out: &'a TokenAddress,
amount: BigUint,
) -> SimulationResult<Self>
pub fn fixed_out( token_in: &'a TokenAddress, token_out: &'a TokenAddress, amount: BigUint, ) -> SimulationResult<Self>
Creates new fixed output parameters with default settings (no state modification).
§Arguments
token_in- The token to selltoken_out- The token to buyamount- The amount of output token to buy
pub fn amount(&self) -> &QuoteAmount
Sourcepub fn with_new_state(self) -> Self
pub fn with_new_state(self) -> Self
Configures the quote to modify the state during simulation.
When enabled, the quote simulation will return an updated state as if the swap was actually executed.
Sourcepub fn token_in(&self) -> &TokenAddress
pub fn token_in(&self) -> &TokenAddress
Returns the input token address.
Sourcepub fn token_out(&self) -> &TokenAddress
pub fn token_out(&self) -> &TokenAddress
Returns the output token address.
Sourcepub fn should_return_new_state(&self) -> bool
pub fn should_return_new_state(&self) -> bool
Returns whether the simulation should return the post-swap state.
Trait Implementations§
Source§impl<'a> Clone for QuoteParams<'a>
impl<'a> Clone for QuoteParams<'a>
Source§fn clone(&self) -> QuoteParams<'a>
fn clone(&self) -> QuoteParams<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for QuoteParams<'a>
impl<'a> RefUnwindSafe for QuoteParams<'a>
impl<'a> Send for QuoteParams<'a>
impl<'a> Sync for QuoteParams<'a>
impl<'a> Unpin for QuoteParams<'a>
impl<'a> UnsafeUnpin for QuoteParams<'a>
impl<'a> UnwindSafe for QuoteParams<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more