use std::str::FromStr;

use anchor_client::Cluster;
use anchor_lang::prelude::Pubkey;
use jup_lend_sdk::flashloan::instructions::get_flashloan_ix;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let rpc_url =
        dotenv::var("RPC_URL").unwrap_or("https://api.mainnet-beta.solana.com".to_string());
    let cluster = Cluster::from_str(rpc_url.as_str())?;

    let flashloan = get_flashloan_ix(
        10000,
        Pubkey::from_str_const("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),
        Pubkey::new_unique(),
        cluster,
    )
    .await?;

    dbg!(flashloan);

    Ok(())
}
