use anchor_client::Cluster;
use anchor_lang::prelude::Pubkey;
use jup_lend_sdk::{
    borrow::{get_vault_program, read::get_oracle_price_liquidate},
    ReadKeypair,
};
use std::{str::FromStr, sync::Arc};

#[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 price = get_oracle_price_liquidate(
        Pubkey::from_str_const("6QBKbRU6bgjDxLeP8XwZmrikkRR5v913b7xwLPVoeNQ5"),
        &get_vault_program(cluster, Arc::new(ReadKeypair::new()), Default::default())?,
    )
    .await?;

    dbg!(price);

    Ok(())
}
