Giter VIP home page Giter VIP logo

algonaut's Introduction

Rust algonaut

Crate Docs GitHub license Continuous integration

Rust algonaut is a rusty SDK for Algorand. Please, be aware that this crate is a work in progress.

use algonaut::algod::v2::Algod;
use algonaut_core::MicroAlgos;
use algonaut_transaction::Pay;
use algonaut_transaction::{account::Account, TxnBuilder};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let algod = Algod::new(
        "http://localhost:4001",
        "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    )?;

    // an account with some funds
    let from_account = Account::from_mnemonic("fire enlist diesel stamp nuclear chunk student stumble call snow flock brush example slab guide choice option recall south kangaroo hundred matrix school above zero")?;

    let to_address = "2FMLYJHYQWRHMFKRHKTKX5UNB5DGO65U57O3YVLWUJWKRE4YYJYC2CWWBY".parse()?;

    // algod has a convenient method that retrieves basic information for a transaction
    let params = algod.suggested_transaction_params().await?;

    // we are ready to build the transaction
    let t = TxnBuilder::with(
        &params,
        Pay::new(from_account.address(), to_address, MicroAlgos(123_456)).build(),
    )
    .build()?;

    // we need to sign the transaction to prove that we own the sender address
    let signed_t = from_account.sign_transaction(t)?;

    // broadcast the transaction to the network
    let send_response = algod.broadcast_signed_transaction(&signed_t).await?;

    println!("Transaction ID: {}", send_response.tx_id);

    Ok(())
}

Crates

  • algonaut_client contains clients for algod, kmd, and indexer RPC APIs.
  • algonaut_core defines core structures for Algorand like: Address, Round, MicroAlgos, etc.
  • algonaut_crypto contains crypto utilities such as: ed25519 and mnemonics.
  • algonaut_encoding implements encoding utility functions such as serde visitors.
  • algonaut_transaction support developers in building all kinds of Algorand transactions.
  • algonaut_abi Application Binary Interface (ABI) to invoke smart contract methods with a standarized interface.

External utilities

Integration examples

Changelog

Read the changelog for more details.

Contribute

Do you want to help with the development? Please find out how by reading our contributions guidelines.

Acknowledgements

This crate is based on the work of @mraof.

License

Ferris Algonaut

Licensed under MIT license. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be licensed as above, without any additional terms or conditions.

Ferris Algonaut is licensed under a Creative Commons Attribution 4.0 International License.
Rust algonaut's logo is based on Font Awesome's icon and licensed under a Creative Commons Attribution 4.0 International License.

algonaut's People

Contributors

agodnic avatar alterionx avatar dependabot[bot] avatar epequeno avatar ivnsch avatar jacobious52 avatar lakshya-sky avatar lucasvanmol avatar manuelmauro avatar mraof avatar pidelport avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.