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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright 2024 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.
//! Connect to and build on the Autonomi network.
//!
//! # Example
//!
//! ```no_run
//! use autonomi::{Bytes, Client, Wallet};
//! use autonomi::client::payment::PaymentOption;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = Client::init().await?;
//!
//! // Default wallet of testnet.
//! let key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
//! let wallet = Wallet::new_from_private_key(Default::default(), key)?;
//! let payment = PaymentOption::Wallet(wallet);
//!
//! // Put and fetch data.
//! let (cost, data_addr) = client.data_put_public(Bytes::from("Hello, World"), payment.clone()).await?;
//! let _data_fetched = client.data_get_public(&data_addr).await?;
//!
//! // Put and fetch directory from local file system.
//! let (cost, dir_addr) = client.dir_upload_public("files/to/upload".into(), payment).await?;
//! client.dir_download_public(&dir_addr, "files/downloaded".into()).await?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Data types
//!
//! This API gives access to the four fundamental types on the network: [`Chunk`], [`Pointer`], [`Scratchpad`] and [`GraphEntry`].
//!
//! When we upload data, it's split into chunks using self-encryption, yielding
//! a 'datamap' allowing us to reconstruct the data again. Any two people that
//! upload the exact same data will get the same datamap, as all chunks are
//! content-addressed and self-encryption is deterministic.
//!
//! # Features
//!
//! - `loud`: Print debug information to stdout
// docs.rs generation will enable unstable `doc_cfg` feature
// Allow expect/panic and wrong_self_convention temporarily
extern crate tracing;
// The Network data types
pub use chunk;
pub use graph;
pub use pointer;
pub use scratchpad;
// The high-level data types
pub use data;
pub use files;
pub use register;
pub use vault;
// Re-exports of the evm types
pub use EvmNetwork as Network;
pub use EvmWallet as Wallet;
pub use QuoteHash;
pub use RewardsAddress;
pub use ;
pub use ;
pub use ;
// Re-exports of address related types
pub use AddressParseError;
pub use XorName;
// Re-exports protocol version
pub use version;
// Re-exports of the bls types
pub use ;
// Place this under 'Re-exports' in the docs.
pub use Bytes;
// Place this under 'Re-exports' in the docs.
pub use Multiaddr;
// private helper modules
pub
pub use ;