Skip to main content

Crate stakewiz_rs

Crate stakewiz_rs 

Source
Expand description

§stakewiz-rs

Unofficial Rust client for the Stakewiz API — Solana validator analytics, Wiz Score, epoch info, and more.

§Quick Start

use stakewiz_rs::{StakewizClient, QueryParams};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = StakewizClient::new();

    // Get a single validator by vote account
    let v = client.get_validator("GE6atKoWiQ2pt3zL7N13pjNHjdLVys8LinG8qeJLcAiL").await?;
    println!("{} — APY: {:?}%", v.name.unwrap_or_default(), v.apy_estimate);

    // Get all stake accounts for a validator
    let stakes = client.get_validator_stakes("LSTmLs1DENX82ihc7jU134mydiV3NDEPXsRrekAY6Ys").await?;
    println!("Total stake accounts: {}", stakes.len());

    // Get current epoch info
    let epoch = client.get_epoch_info().await?;
    println!("Epoch {} — {:.0}s remaining", epoch.epoch, epoch.remaining_seconds);

    Ok(())
}

Re-exports§

pub use client::StakewizClient;
pub use error::Result;
pub use error::StakewizError;
pub use params::QueryParams;
pub use models::*;

Modules§

client
error
models
params