kora_lib/
jup.rs

1use jup_ag::{Quote, QuoteConfig};
2
3use crate::constant::NATIVE_SOL;
4
5pub async fn get_quote(starting_mint: String, amount_to_swap: u64) -> Result<Quote, jup_ag::Error> {
6    let sol = NATIVE_SOL.parse().unwrap();
7    let input = starting_mint.parse().unwrap();
8
9    let quote = jup_ag::quote(
10        input,
11        sol,
12        amount_to_swap,
13        QuoteConfig {
14            only_direct_routes: false,
15            as_legacy_transaction: None,
16            slippage_bps: Some(10),
17            ..Default::default()
18        },
19    )
20    .await?;
21
22    Ok(quote)
23}