Skip to main content

k256_sdk/types/
quote.rs

1//! Quote types.
2
3use serde::{Deserialize, Serialize};
4
5/// Swap quote from K256.
6#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7pub struct Quote {
8    /// Input token mint address
9    pub input_mint: String,
10    /// Output token mint address
11    pub output_mint: String,
12    /// Input amount in base units
13    pub in_amount: u64,
14    /// Output amount in base units
15    pub out_amount: u64,
16    /// Price impact percentage
17    pub price_impact_pct: f64,
18    /// Solana slot of the quote
19    pub slot: u64,
20    /// Unix timestamp in milliseconds
21    pub timestamp_ms: u64,
22    /// List of route steps
23    pub route_plan: Vec<serde_json::Value>,
24    /// Minimum output (or max input for exactOut)
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub other_amount_threshold: Option<u64>,
27    /// "ExactIn" or "ExactOut"
28    #[serde(default = "default_swap_mode")]
29    pub swap_mode: String,
30}
31
32fn default_swap_mode() -> String {
33    "ExactIn".to_string()
34}