koios-sdk 0.1.1

A Rust SDK for the Koios Cardano API
Documentation
use koios_sdk::{
    types::{EpochNo, IncludeNextEpoch},
    Client,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a new client with default configuration
    let client = Client::new()?;

    // Get the current tip of the blockchain
    let tip = client.get_tip().await?;

    // Print the result
    println!("Current tip: {:?}", tip);

    // Get the current tip of the blockchain
    let epoch = client
        .get_epoch_info(Some(EpochNo::new("320")), Some(IncludeNextEpoch::new(true)))
        .await?;

    // Print the result
    println!("Epoch: {:?}", epoch);

    let stake_addresses =
        vec!["stake1ux3g2c9dx2nhhehyrezyxpkstartcqmu9hk63qgfkccw5rqttygt7".to_string()];
    let epoch_no = Some("320".to_string());
    let rewards = client
        .get_account_rewards(&stake_addresses, epoch_no)
        .await?;
    println!("Account rewards: {:?}", rewards);

    Ok(())
}