use scemadex_sdk::{
conviction_client, Address, Amount, Constraints, Intent, Objective, Side,
};
fn trade(objective: Objective) -> Intent {
Intent {
input_mint: Address::new("So11111111111111111111111111111111111111112").unwrap(),
output_mint: Address::new("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v").unwrap(),
amount_in: Amount::new(500_000_000, 9),
side: Side::Sell,
objective,
constraints: Constraints {
max_slippage_bps: 100,
deadline_unix: 0,
max_legs: Some(3),
},
}
}
#[tokio::main]
async fn main() -> scemadex_sdk::Result<()> {
let dex = conviction_client();
for objective in [Objective::Price, Objective::Speed, Objective::Stealth] {
let intent = trade(objective);
let (solution, bond) = dex.quote(&intent).await?;
println!(
"{:?}: {} leg(s), conviction {:.2}, bond {} micro-USDC -> {}",
objective,
solution.route.legs.len(),
solution.conviction.0,
bond.amount.0,
solution.rationale,
);
}
Ok(())
}