algonaut 0.5.0

A Rusty sdk for the Algorand blockchain.
Documentation
use algonaut::algod::v2::Algod;
use algonaut::transaction::TxnBuilder;
use algonaut::transaction::account::Account;
use algonaut::transaction::builder::OptInApplication;
use dotenv::dotenv;
use std::env;
use std::error::Error;
#[macro_use]
extern crate log;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    dotenv().ok();
    env_logger::init();

    info!("creating algod client");
    let algod = Algod::new(&env::var("ALGOD_URL")?, &env::var("ALGOD_TOKEN")?)?;

    info!("creating account for alice");
    let alice = Account::from_mnemonic(&env::var("ALICE_MNEMONIC")?)?;

    info!("retrieving suggested params");
    let params = algod.txn_params().await?;

    info!("building OptInApplication transaction");
    let t = TxnBuilder::with(
        &params,
        // TODO set a correct app-id here
        OptInApplication::new(alice.address(), 11)
            .app_arguments(vec![vec![1, 0], vec![255]])
            .build(),
    )
    .build()?;

    info!("signing transaction");
    let signed_t = alice.sign_transaction(t)?;

    info!("broadcasting transaction");
    let send_response = algod.send_txn(&signed_t).await?;
    info!("response: {:?}", send_response);

    Ok(())
}