Module api

Module api 

Source
Expand description

API endpoint implementations

This module contains implementations for all Koios API endpoints, organized by category. These implementations work across all supported networks (Mainnet, Preprod, Preview, Guild).

  • account - Stake account related endpoints
  • address - Address related endpoints
  • asset - Asset and token related endpoints
  • block - Block related endpoints
  • epoch - Epoch related endpoints
  • governance - Governance related endpoints
  • network - Network related endpoints
  • ogmios - Ogmios v6 integration endpoints
  • pool - Stake pool related endpoints
  • script - Script related endpoints
  • transaction - Transaction related endpoints

§Examples

Fetching account info on Mainnet:

use koios_sdk::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new()?;
    let stake_addresses = vec![
        "stake1ux3g2c9dx2nhhehyrezyxpkstartcqmu9hk63qgfkccw5rqttygt7".to_string()
    ];
    let account_info = client.get_account_info(&stake_addresses).await?;
    println!("Account info: {:?}", account_info);
    Ok(())
}

Fetching account info on Preprod network:

use koios_sdk::{Client, Network};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::builder()
        .network(Network::Preprod)
        .build()?;

    let stake_addresses = vec![
        "stake_test1ux3g2c9dx2nhhehyrezyxpkstartcqmu9hk63qgfkccw5rqttygt7".to_string()
    ];
    let account_info = client.get_account_info(&stake_addresses).await?;
    println!("Account info: {:?}", account_info);
    Ok(())
}

Modules§

account
address
asset
block
epoch
governance
network
ogmios
pool
script
transaction