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
//! Relating to Address functions
use *;
/// Retrieve the public and private parts of a Factoid or Entry Credit address
///stored in the wallet.
///
///# Example
///```
/// use factom::*;
///
///#[tokio::main]
///async fn main() {
/// let client = Factom::new();
/// let priv_key = "Fs3E9gV6DXsYzf7Fqx1fVBQPQXV695eP3k5XbmHEZVRLkMdD9qCK";
/// import::import_addresses(&client, vec![priv_key]).await.unwrap();
/// let my_address = "FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q";
/// let query = address::address(&client, my_address);
/// let response = query.await.unwrap();
/// assert_eq!(response.result.public, my_address);
/// }
/// ```
pub async
///Retrieve all of the Factoid and Entry Credit addresses stored in the wallet.
///
///# Example
///```
/// use factom::*;
///
/// #[tokio::main]
/// async fn main() {
/// let client = Factom::new();
/// let priv_key = "Fs3E9gV6DXsYzf7Fqx1fVBQPQXV695eP3k5XbmHEZVRLkMdD9qCK";
/// import::import_addresses(&client, vec![priv_key]).await.unwrap();
/// let my_address = "FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q";
/// let query = address::all_addresses(&client);
/// let response = query.await.unwrap();
/// // Iterate through all returned addresses for my_address
/// assert!(response
/// .result
/// .addresses
/// .iter()
/// .any(|address| address.public == my_address));
/// }
/// ```
pub async
/// Be careful using this function! Ensure that you have backups of important keys
/// before removing them. Given a factoid or entry-credit address, this command
/// deletes the corresponding key pair from the wallet. Once executed, the user will
/// no longer be able to retrieve the private key or make transactions with the
/// address from this wallet. If the wallet is encrypted, it must be unlocked prior
/// to using this command.
///
/// # Example
/// ```
/// use factom::*;
///
/// #[tokio::main]
/// async fn main() {
/// let client = Factom::new();
/// let new_address = generate::factoid_address(&client)
/// .await
/// .expect("Fetching query");
/// let rm_address = address::remove_address(&client, &new_address.result.public)
/// .await
/// .expect("Fetching query");
/// assert!(&rm_address.result.success);
/// }
/// ```
pub async
/// address function
/// all-addresses function
/// remove-address function