1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! This library provides pretty much anything you could need to work with
//! Iota. The documentation is a work in progress, but if you need any help
//! I can usually be found on the Iota discord rust or development chats.
//!
//! Heres a quick example of how to send a transaction (Note that trytes is being
//! used as a seed here...don't do that)
//!```
//! extern crate iota_lib_rs;
//!
//! use iota_lib_rs::iota_api;
//! use iota_lib_rs::iota_api::SendTransferOptions;
//! use iota_lib_rs::utils::trytes_converter;
//! use iota_lib_rs::model::*;
//!
//! fn main() {
//!     let trytes = "HELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDD";
//!     let message = trytes_converter::to_trytes("Hello World").unwrap();
//!     let mut transfer = Transfer::default();
//!     *transfer.value_mut() = 0;
//!     *transfer.address_mut() = trytes.to_string();
//!     *transfer.message_mut() = message;
//!     let api = iota_api::API::new("https://field.carriota.com");
//!     let options = SendTransferOptions{
//!         seed: trytes.to_string(),
//!         depth: 3,
//!         min_weight_magnitude: 14,
//!         local_pow: true,
//!         threads: None,
//!         inputs: None,
//!         reference: None,
//!         remainder_address: None,
//!         security: None,
//!         hmac_key: None,
//!     };    
//!     // This line is commented out because travis CI can't handle it,
//!     // but you should uncomment it
//!     let tx = api.send_transfers(&transfer, options).unwrap();
//!     println!("{:?}", tx);
//! }
//!```
#![allow(dead_code)]
#![feature(rust_2018_preview)]
#![feature(rust_2018_idioms)]

#[macro_use]
extern crate crunchy;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
#[macro_use]
extern crate lazy_static;

extern crate chrono;
extern crate crossbeam;
extern crate num_cpus;
extern crate rand;
extern crate regex;
extern crate reqwest;

/// Provides all crypto algorithms and data structures used by Iota
pub mod crypto;
/// Provides helper functions that make interacting with IRI easier
pub mod iota_api;
/// Provides methods to call IRI APIs
pub mod iri_api;
/// Provides the various struces used by Iota
pub mod model;
/// Provides multi-sig functionality
pub mod multisig;
/// Provides many useful helper functions that are used throughout
/// the library
pub mod utils;

use std::result;

/// This is the result type used throughout the library
pub type Result<T> = result::Result<T, failure::Error>;