pub struct SwapRoute {Show 15 fields
pub in_amount: u64,
pub out_amount: u64,
pub slippage_bps: u16,
pub platform_fee: Option<PlatformFee>,
pub steps: Vec<RoutePlanStep>,
pub instructions: Vec<Instruction>,
pub address_lookup_tables: Vec<Pubkey>,
pub context_slot: Option<u64>,
pub time_taken_ns: Option<u64>,
pub expires_at_ms: Option<u64>,
pub expires_after_slot: Option<u64>,
pub compute_units: Option<u64>,
pub compute_units_safe: Option<u64>,
pub transaction: Option<Vec<u8>>,
pub reference_id: Option<String>,
}Expand description
Information about a route for a swap.
Fields§
§in_amount: u64How many input tokens are expected to go through this route.
out_amount: u64How many output tokens are expected to come out of this route.
slippage_bps: u16Amount of slippage encurred, in basis points.
platform_fee: Option<PlatformFee>Platform fee information, if such a fee is charged by the provider.
steps: Vec<RoutePlanStep>Topologically ordered DAG containing the steps that comprise this route.
May be empty if the provider does not provide information about the steps taken, or there are no steps (e.g. RFQ providers).
instructions: Vec<Instruction>Instructions needed to execute the route.
May be empty if the provider does not support the user building their own transactions.
In this case, the transaction to sign should be present in the SwapRoute::transaction
field.
address_lookup_tables: Vec<Pubkey>Address lookup tables necessary to load.
May be empty if the provider does not support the user building their own transactions.
In this case, the transaction to sign should be present in the SwapRoute::transaction
field.
context_slot: Option<u64>Context slot for the route provided.
time_taken_ns: Option<u64>Amount of time taken to generate the quote in seconds, if known.
expires_at_ms: Option<u64>If this route expires by time, the time at which it expires, as a millisecond UNIX timestamp.
expires_after_slot: Option<u64>If this route expires by slot, the last slot at which the route is valid.
compute_units: Option<u64>The number of compute units this transaction is expected to consume, if known.
compute_units_safe: Option<u64>The number of compute units that the server recommends setting for this route. Includes a buffer to allow for fluctuations in compute unit usage from various protocols as well as other instructions the user may wish to add, such as tips.
transaction: Option<Vec<u8>>Raw transaction to be signed by the user. May be returned instead of instructions and ALTs.
reference_id: Option<String>Reference ID for Pyth Express Relay and HashFlow RFQ providers.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SwapRoute
impl<'de> Deserialize<'de> for SwapRoute
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SwapRoute, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SwapRoute, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for SwapRoute
impl Serialize for SwapRoute
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for SwapRoute
Auto Trait Implementations§
impl Freeze for SwapRoute
impl RefUnwindSafe for SwapRoute
impl Send for SwapRoute
impl Sync for SwapRoute
impl Unpin for SwapRoute
impl UnwindSafe for SwapRoute
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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>
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>
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