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
// for use in the `z_listoperationids` RPC
#[derive(Debug, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Status {
    Success,
    Failed,
    Executing,
    Queued,
}

// for use in z_exportkey, z_exportviewingkey
#[derive(Debug, Serialize)]
pub struct ZAddr(String);

impl ZAddr {
    pub fn from(addr_str: &str) -> ZAddr {
        ZAddr { 0: addr_str.to_string() }
    }
}

// for use in z_exportwallet
#[derive(Debug, Serialize)]
pub struct ExportFileName(String);

impl ExportFileName {
    pub fn from(location: &str) -> ExportFileName {
        ExportFileName { 0: location.to_string() }
    }
}

#[derive(Deserialize, Serialize, Debug)]
pub struct OperationIds(Vec<OperationId>);

impl OperationIds {
    pub fn from(vec: Vec<OperationId>) -> OperationIds {
        OperationIds{ 0: vec }
    }
}

#[derive(Deserialize, Serialize, Debug)]
pub struct OperationId(String);

impl OperationId {
    // todo allow garbage in, garbage out? if not, how to check?
    pub fn from(id: &str) -> OperationId {
        OperationId { 0: id.to_string() }
    }
}