use solana_address::Address;
use crate::route_plan::RoutePlan;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SwapMode {
ExactIn,
ExactOut,
}
impl SwapMode {
pub const fn as_str(self) -> &'static str {
match self {
Self::ExactIn => "ExactIn",
Self::ExactOut => "ExactOut",
}
}
pub fn parse(raw: &str) -> Self {
match raw == Self::ExactOut.as_str() {
true => Self::ExactOut,
false => Self::ExactIn,
}
}
}
#[derive(Debug, Clone)]
pub struct LegRecord {
pub original_signature: String,
pub input_mint: Address,
pub output_mint: Address,
pub amount: u64,
pub swap_mode: SwapMode,
pub failed: bool,
pub original_failed: bool,
pub realized_output_amount: Option<u64>,
pub original_realized_output_amount: Option<u64>,
pub route_plan: Option<RoutePlan>,
pub original_route_plan: Option<RoutePlan>,
pub realized_route_plan: Option<RoutePlan>,
}