elrond_rust/
lib.rs

1//! The `elrond_rust` library can generate new accounts/wallets and create and sign transactions on the Elrond network. 
2//! Its dependencies are written in pure Rust to allow easy WASM generation in the future. 
3//!
4//! ### Example interaction:
5//!
6//! ```
7//! use elrond_rust::{Client, Account, UnsignedTransaction, Network}  
8//! // initialize new client
9//! let client = Client::new();
10//! // load account from private/secret key
11//! let private_key = "a4b36a5d97176618b5a7fcc9228d2fd98ee2f14ddd3d6462ae03e40eb487d15b";
12//! let account = Account::from_string(private_key).unwrap();
13//! // look up the current account nonce to use for the tx
14//! let nonce = client.get_address_nonce(&account.address).unwrap();
15//! // create a new transaction to send 1 eGLD to some address
16//! let tx = UnsignedTransaction::new(
17//!     nonce, // current nonce
18//!     "1", // amount of eGLD
19//!     "erd16jats393r8rnut88yhvu5wvxxje57qzlj3tqk7n6jnf7f6cxs4uqfeh65k", // reciever
20//!     &account.address.to_string(), // the account
21//!     Network::MainNet
22//! ).unwrap();
23//! // sign the transaction
24//! let signed_tx = tx.sign(&account).unwrap();
25//! // submit the transaction to the network
26//! client.post_signed_transaction(signed_tx)
27//! ```
28//!
29//! See the source code and tests for more examples.
30
31mod transaction;
32mod account;
33mod errors;
34mod rest;
35
36pub use transaction::{ElrondCurrencyAmount, Network, UnsignedTransaction, SignedTransaction};
37pub use account::{Account, ElrondAddress};
38pub use rest::Client;
39pub use errors::{ElrondClientError, Result};