algo_rust_sdk

Crates.ioalgo_rust_sdk
lib.rsalgo_rust_sdk
version1.0.3
sourcesrc
created_at2020-12-31 23:41:52.100685
updated_at2021-01-02 02:54:45.324632
descriptionThis is the Rust implementation of the Algorand SDK originally developed by mraof and maintained by KBryan
homepagehttps://developer.algorand.org/
repositoryhttps://github.com/KBryan/algorand_rust_sdk
max_upload_size
id329910
size265,554
Kwamé Bryan (KBryan)

documentation

README

rust algorand sdk

Documentation

This is the current Rust version implementation of the Algorand SDK
General Algorand documentation is available at https://developer.algorand.org/

Please look at the examples for Rust Algorand usage.
You can also find Algorand Rust documentation at https://docs.rs/algo_rust_sdk/1.0.2/algo_rust_sdk/

Quickstart

This quick start guide assumes the user has the Algorand Sandbox 2.0 installed.
and have algo_rust_sdk = "1.0.3" added to your Cargo.toml file.

use std::error::Error;

use algo_rust_sdk::AlgodClient;

fn main() -> Result<(), Box<dyn Error>> {
    let algod_address = "http://localhost:4001";
    let algod_token="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

    let algod_client = AlgodClient::new(algod_address, algod_token);

    // Print algod status
    let node_status = algod_client.status()?;
    println!("algod last round: {}", node_status.last_round);
    println!(
        "algod time since last round: {}",
        node_status.time_since_last_round
    );
    println!("algod catchup: {}", node_status.catchup_time);
    println!("algod latest version: {}", node_status.last_version);

    // Fetch block information
    let last_block = algod_client.block(node_status.last_round)?;
    println!("{:#?}", last_block);

    Ok(())
}

Commit count: 40

cargo fmt