Skip to main content

SwapQuoteResponse

Struct SwapQuoteResponse 

Source
pub struct SwapQuoteResponse {
    pub caip2: String,
    pub destination_caip2: Option<String>,
    pub est_output_amount: String,
    pub estimated_fees: Vec<FeeLineItem>,
    pub estimated_gas: Option<Gas>,
    pub expires_at: Option<f64>,
    pub gas_estimate: String,
    pub input_amount: String,
    pub input_token: String,
    pub minimum_output_amount: String,
    pub output_token: String,
}
Expand description

Pricing data for a token swap.

JSON schema
{
 "title": "SwapQuoteResponse",
 "description": "Pricing data for a token swap.",
 "examples": [
   {
     "caip2": "eip155:1",
     "est_output_amount": "2000000000",
     "gas_estimate": "150000",
     "input_amount": "1000000000000000000",
     "input_token": "native",
     "minimum_output_amount": "1980000000",
     "output_token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
   }
 ],
 "type": "object",
 "required": [
   "caip2",
   "est_output_amount",
   "gas_estimate",
   "input_amount",
   "input_token",
   "minimum_output_amount",
   "output_token"
 ],
 "properties": {
   "caip2": {
     "description": "Chain identifier.",
     "type": "string"
   },
   "destination_caip2": {
     "description": "Destination chain CAIP-2 identifier for cross-chain
swaps. Only present for cross-chain swaps.",
     "type": "string"
   },
   "est_output_amount": {
     "description": "Estimated amount of output token in base units.",
     "type": "string"
   },
   "estimated_fees": {
     "description": "Estimated fees for the swap. Only present for
cross-chain swaps.",
     "type": "array",
     "items": {
       "$ref": "#/components/schemas/FeeLineItem"
     }
   },
   "estimated_gas": {
     "allOf": [
       {
         "$ref": "#/components/schemas/Gas"
       },
       {
         "description": "Estimated gas cost with full token metadata.
Only present for cross-chain swaps."
       }
     ]
   },
   "expires_at": {
     "description": "Quote expiry as Unix timestamp (seconds). Only
present for cross-chain quotes.",
     "type": "number"
   },
   "gas_estimate": {
     "description": "Estimated gas cost in base units of the native token. @deprecated For cross-chain swaps, use estimated_gas instead.",
     "type": "string"
   },
   "input_amount": {
     "description": "Amount of input token in base units.",
     "type": "string"
   },
   "input_token": {
     "description": "Token address being sold.",
     "type": "string"
   },
   "minimum_output_amount": {
     "description": "Minimum output amount accounting for slippage, in
base units.",
     "type": "string"
   },
   "output_token": {
     "description": "Token address being bought.",
     "type": "string"
   }
 },
 "x-stainless-model": "swaps.swap_quote_response"
}

Fields§

§caip2: String

Chain identifier.

§destination_caip2: Option<String>

Destination chain CAIP-2 identifier for cross-chain swaps. Only present for cross-chain swaps.

§est_output_amount: String

Estimated amount of output token in base units.

§estimated_fees: Vec<FeeLineItem>

Estimated fees for the swap. Only present for cross-chain swaps.

§estimated_gas: Option<Gas>§expires_at: Option<f64>§gas_estimate: String

Estimated gas cost in base units of the native token. @deprecated For cross-chain swaps, use estimated_gas instead.

§input_amount: String

Amount of input token in base units.

§input_token: String

Token address being sold.

§minimum_output_amount: String

Minimum output amount accounting for slippage, in base units.

§output_token: String

Token address being bought.

Trait Implementations§

Source§

impl Clone for SwapQuoteResponse

Source§

fn clone(&self) -> SwapQuoteResponse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SwapQuoteResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SwapQuoteResponse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&SwapQuoteResponse> for SwapQuoteResponse

Source§

fn from(value: &SwapQuoteResponse) -> Self

Converts to this type from the input type.
Source§

impl Serialize for SwapQuoteResponse

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more