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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
use crate::util::*;
use monero::{cryptonote::hash::Hash as CryptoNoteHash, util::address::PaymentId};
use serde::{Deserialize, Serialize};
macro_rules! hash_type {
($name:ident, $len:expr) => {
::fixed_hash::construct_fixed_hash! {
#[derive(::serde::Serialize, ::serde::Deserialize)]
pub struct $name($len);
}
hash_type_impl!($name);
};
}
hash_type!(BlockHash, 32);
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Status {
OK,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(tag = "status")]
pub enum MoneroResult<T> {
OK(T),
}
impl<T> MoneroResult<T> {
pub fn into_inner(self) -> T {
match self {
MoneroResult::OK(v) => v,
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AddressInfo {
pub locked_funds: String,
pub total_received: String,
pub total_sent: String,
pub scanned_height: u64,
pub scanned_block_height: u64,
pub start_height: u64,
pub transaction_height: u64,
pub blockchain_height: u64,
pub spent_outputs: Vec<SpendObject>,
pub rates: Option<Rates>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[allow(non_snake_case)]
pub struct Rates {
pub AUD: Option<f32>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SpendObject {
pub amount: String,
pub key_image: HashString<CryptoNoteHash>,
pub tx_pub_key: HashString<CryptoNoteHash>,
pub out_index: u16,
pub mixin: u32,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AddressTxs {
pub total_received: String,
pub scanned_height: u64,
pub scanned_block_height: u64,
pub start_height: u64,
pub blockchain_height: u64,
pub transactions: Vec<Transaction>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Transaction {
pub id: u64,
pub hash: HashString<CryptoNoteHash>,
pub timestamp: String,
pub total_received: String,
pub total_sent: String,
pub unlock_time: u64,
pub height: Option<u64>,
pub spent_outputs: Vec<SpendObject>,
pub payment_id: Option<HashString<PaymentId>>,
pub coinbase: u8,
pub mempool: u8,
pub mixin: u32,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AmountOuts {
pub amount_outs: Vec<RandomOutput>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct RandomOutputs {
pub amount: String,
pub outputs: Vec<RandomOutput>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct RandomOutput {
pub global_index: u64,
pub public_key: HashString<CryptoNoteHash>,
pub rct: HashString<CryptoNoteHash>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UnspentOuts {
pub per_kb_fee: u64,
pub fee_mask: u64,
pub amount: String,
pub outputs: Vec<Output>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Output {
pub tx_id: u64,
pub amount: String,
pub index: u16,
pub global_index: u64,
pub rct: String,
pub tx_hash: HashString<CryptoNoteHash>,
pub tx_prefix_hash: String,
pub public_key: HashString<CryptoNoteHash>,
pub tx_pub_key: HashString<CryptoNoteHash>,
pub spend_key_images: Vec<HashString<CryptoNoteHash>>,
pub timestamp: String,
pub height: u64,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ImportResponse {
pub payment_address: Option<monero::Address>,
pub payment_id: Option<HashString<PaymentId>>,
pub import_fee: Option<String>,
pub new_request: u8,
pub request_fulfilled: u8,
pub status: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct LoginResponse {
pub new_address: u8,
pub generated_locally: u8,
pub start_height: Option<u64>,
}