monero-cpp-library
monero_wallet_model.h
1 
53 #pragma once
54 
55 #include "daemon/monero_daemon_model.h"
56 
57 using namespace std;
58 using namespace monero;
59 
63 namespace monero {
64 
69  uint64_t m_num_blocks_fetched;
70  bool m_received_money;
72  monero_sync_result(const uint64_t num_blocks_fetched, const bool received_money) : m_num_blocks_fetched(num_blocks_fetched), m_received_money(received_money) {}
73  };
74 
79  boost::optional<uint32_t> m_account_index;
80  boost::optional<uint32_t> m_index;
81  boost::optional<string> m_address;
82  boost::optional<string> m_label;
83  boost::optional<uint64_t> m_balance;
84  boost::optional<uint64_t> m_unlocked_balance;
85  boost::optional<uint32_t> m_num_unspent_outputs;
86  boost::optional<bool> m_is_used;
87  boost::optional<uint32_t> m_num_blocks_to_unlock;
88 // BEGIN_KV_SERIALIZE_MAP()
89 // KV_SERIALIZE(m_account_index)
90 // KV_SERIALIZE(index)
91 // KV_SERIALIZE(address)
92 // KV_SERIALIZE(label)
93 // KV_SERIALIZE(balance)
94 // KV_SERIALIZE(m_unlocked_balance)
95 // KV_SERIALIZE(m_num_unspent_outputs)
96 // KV_SERIALIZE(m_is_used)
97 // KV_SERIALIZE(m_num_blocks_to_unlock)
98 // END_KV_SERIALIZE_MAP()
99 
100  boost::property_tree::ptree to_property_tree() const;
101  //void merge(const shared_ptr<monero_subaddress>& self, const shared_ptr<monero_subaddress>& other);
102  };
103 
108  boost::optional<uint32_t> m_index;
109  boost::optional<string> m_primary_address;
110  boost::optional<uint64_t> m_balance;
111  boost::optional<uint64_t> m_unlocked_balance;
112  boost::optional<string> m_tag;
113  vector<monero_subaddress> m_subaddresses;
114 // BEGIN_KV_SERIALIZE_MAP()
115 // KV_SERIALIZE(index)
116 // KV_SERIALIZE(m_primary_address)
117 // KV_SERIALIZE(label)
118 // KV_SERIALIZE(balance)
119 // KV_SERIALIZE(m_unlocked_balance)
120 // KV_SERIALIZE(tag)
121 // KV_SERIALIZE(subaddresses)
122 // END_KV_SERIALIZE_MAP()
123 
124  boost::property_tree::ptree to_property_tree() const;
125  };
126 
127  // forward declarations
128  struct monero_tx_wallet;
129  struct monero_tx_query;
130 
135  boost::optional<string> m_address;
136  boost::optional<uint64_t> m_amount;
137 
138  monero_destination() {}
139  monero_destination(const string& address, uint64_t amount) : m_address(address), m_amount(amount) {}
140  shared_ptr<monero_destination> copy(const shared_ptr<monero_destination>& src, const shared_ptr<monero_destination>& tgt) const;
141  boost::property_tree::ptree to_property_tree() const;
142  };
143 
148  shared_ptr<monero_tx_wallet> m_tx;
149  boost::optional<uint64_t> m_amount;
150  boost::optional<uint32_t> m_account_index;
151  boost::optional<uint32_t> m_num_suggested_confirmations;
152 
153  virtual boost::optional<bool> is_incoming() const = 0; // derived class must implement
154  shared_ptr<monero_transfer> copy(const shared_ptr<monero_transfer>& src, const shared_ptr<monero_transfer>& tgt) const;
155  boost::optional<bool> is_outgoing() const {
156  if (is_incoming() == boost::none) return boost::none;
157  return !(*is_incoming());
158  }
159  boost::property_tree::ptree to_property_tree() const;
160  void merge(const shared_ptr<monero_transfer>& self, const shared_ptr<monero_transfer>& other);
161  };
162 
167  boost::optional<uint32_t> m_subaddress_index;
168  boost::optional<string> m_address;
169 
170  shared_ptr<monero_incoming_transfer> copy(const shared_ptr<monero_transfer>& src, const shared_ptr<monero_transfer>& tgt) const;
171  shared_ptr<monero_incoming_transfer> copy(const shared_ptr<monero_incoming_transfer>& src, const shared_ptr<monero_incoming_transfer>& tgt) const;
172  boost::optional<bool> is_incoming() const;
173  boost::property_tree::ptree to_property_tree() const;
174  void merge(const shared_ptr<monero_transfer>& self, const shared_ptr<monero_transfer>& other);
175  void merge(const shared_ptr<monero_incoming_transfer>& self, const shared_ptr<monero_incoming_transfer>& other);
176  };
177 
182  vector<uint32_t> m_subaddress_indices;
183  vector<string> m_addresses;
184  vector<shared_ptr<monero_destination>> m_destinations;
185 
186  shared_ptr<monero_outgoing_transfer> copy(const shared_ptr<monero_transfer>& src, const shared_ptr<monero_transfer>& tgt) const;
187  shared_ptr<monero_outgoing_transfer> copy(const shared_ptr<monero_outgoing_transfer>& src, const shared_ptr<monero_outgoing_transfer>& tgt) const;
188  boost::optional<bool> is_incoming() const;
189  boost::property_tree::ptree to_property_tree() const;
190  void merge(const shared_ptr<monero_transfer>& self, const shared_ptr<monero_transfer>& other);
191  void merge(const shared_ptr<monero_outgoing_transfer>& self, const shared_ptr<monero_outgoing_transfer>& other);
192  };
193 
200  boost::optional<bool> m_is_incoming;
201  boost::optional<string> m_address;
202  vector<string> m_addresses;
203  boost::optional<uint32_t> m_subaddress_index;
204  vector<uint32_t> m_subaddress_indices;
205  vector<shared_ptr<monero_destination>> m_destinations;
206  boost::optional<bool> m_has_destinations;
207  boost::optional<shared_ptr<monero_tx_query>> m_tx_query;
208 
209  shared_ptr<monero_transfer_query> copy(const shared_ptr<monero_transfer>& src, const shared_ptr<monero_transfer>& tgt) const;
210  shared_ptr<monero_transfer_query> copy(const shared_ptr<monero_transfer_query>& src, const shared_ptr<monero_transfer_query>& tgt) const;
211  boost::optional<bool> is_incoming() const;
212  boost::property_tree::ptree to_property_tree() const;
213  bool meets_criteria(monero_transfer* transfer) const;
214  };
215 
220  boost::optional<uint32_t> m_account_index;
221  boost::optional<uint32_t> m_subaddress_index;
222  boost::optional<bool> m_is_spent;
223  boost::optional<bool> m_is_unlocked;
224  boost::optional<bool> m_is_frozen;
225 
226  shared_ptr<monero_output_wallet> copy(const shared_ptr<monero_output>& src, const shared_ptr<monero_output>& tgt) const;
227  shared_ptr<monero_output_wallet> copy(const shared_ptr<monero_output_wallet>& src, const shared_ptr<monero_output_wallet>& tgt) const;
228  boost::property_tree::ptree to_property_tree() const;
229  void merge(const shared_ptr<monero_output>& self, const shared_ptr<monero_output>& other);
230  void merge(const shared_ptr<monero_output_wallet>& self, const shared_ptr<monero_output_wallet>& other);
231  };
232 
240  vector<uint32_t> m_subaddress_indices;
241  boost::optional<shared_ptr<monero_tx_query>> m_tx_query;
242 
243  // TODO: necessary to override all super classes?
244  shared_ptr<monero_output_query> copy(const shared_ptr<monero_output>& src, const shared_ptr<monero_output>& tgt) const;
245  shared_ptr<monero_output_query> copy(const shared_ptr<monero_output_wallet>& src, const shared_ptr<monero_output_wallet>& tgt) const;
246  shared_ptr<monero_output_query> copy(const shared_ptr<monero_output_query>& src, const shared_ptr<monero_output_query>& tgt) const;
247  boost::property_tree::ptree to_property_tree() const;
248  bool meets_criteria(monero_output_wallet* output) const;
249  };
250 
254  struct monero_tx_wallet : public monero_tx {
255  vector<shared_ptr<monero_incoming_transfer>> m_incoming_transfers;
256  boost::optional<shared_ptr<monero_outgoing_transfer>> m_outgoing_transfer;
257  boost::optional<string> m_note;
258 
259  shared_ptr<monero_tx_wallet> copy(const shared_ptr<monero_tx>& src, const shared_ptr<monero_tx>& tgt) const;
260  shared_ptr<monero_tx_wallet> copy(const shared_ptr<monero_tx_wallet>& src, const shared_ptr<monero_tx_wallet>& tgt) const;
261  bool is_incoming() const;
262  bool is_outgoing() const;
263  boost::property_tree::ptree to_property_tree() const;
264  void merge(const shared_ptr<monero_tx>& self, const shared_ptr<monero_tx>& other);
265  void merge(const shared_ptr<monero_tx_wallet>& self, const shared_ptr<monero_tx_wallet>& other);
266  };
267 
274  boost::optional<bool> m_is_outgoing;
275  boost::optional<bool> m_is_incoming;
276  vector<string> m_tx_ids;
277  boost::optional<bool> m_has_payment_id;
278  vector<string> m_payment_ids;
279  boost::optional<uint64_t> m_height;
280  boost::optional<uint64_t> m_min_height;
281  boost::optional<uint64_t> m_max_height;
282  boost::optional<uint64_t> m_include_outputs;
283  boost::optional<shared_ptr<monero_transfer_query>> m_transfer_query;
284  boost::optional<shared_ptr<monero_output_query>> m_output_query;
285 
286  // TODO: necessary to override all super classes?
287  shared_ptr<monero_tx_query> copy(const shared_ptr<monero_tx>& src, const shared_ptr<monero_tx>& tgt) const;
288  shared_ptr<monero_tx_query> copy(const shared_ptr<monero_tx_wallet>& src, const shared_ptr<monero_tx_wallet>& tgt) const;
289  shared_ptr<monero_tx_query> copy(const shared_ptr<monero_tx_query>& src, const shared_ptr<monero_tx_query>& tgt) const;
290  boost::property_tree::ptree to_property_tree() const;
291  bool meets_criteria(monero_tx_wallet* tx) const;
292  };
293 
298  string m_standard_address;
299  string m_payment_id;
300  string m_integrated_address;
301 
302  boost::property_tree::ptree to_property_tree() const;
303  };
304 
308  enum monero_send_priority : uint8_t {
309  DEFAULT = 0,
310  UNIMPORTANT,
311  NORMAL,
312  ELEVATED
313  };
314 
319  vector<shared_ptr<monero_destination>> m_destinations;
320  boost::optional<string> m_payment_id;
321  boost::optional<monero_send_priority> m_priority;
322  boost::optional<uint32_t> m_mixin;
323  boost::optional<uint32_t> m_ring_size;
324  boost::optional<uint64_t> m_fee;
325  boost::optional<uint32_t> m_account_index;
326  vector<uint32_t> m_subaddress_indices;
327  boost::optional<uint64_t> m_unlock_time;
328  boost::optional<bool> m_can_split;
329  boost::optional<bool> m_do_not_relay;
330  boost::optional<string> m_note;
331  boost::optional<string> m_recipient_name;
332  boost::optional<uint64_t> m_below_amount;
333  boost::optional<bool> m_sweep_each_subaddress;
334  boost::optional<string> m_key_image;
335 
336  boost::property_tree::ptree to_property_tree() const;
337  };
338 
343  boost::optional<uint64_t> m_height;
344  boost::optional<uint64_t> m_spent_amount;
345  boost::optional<uint64_t> m_unspent_amount;
346 
347  boost::property_tree::ptree to_property_tree() const;
348  };
349 
354  bool m_is_good;
355 
356  boost::property_tree::ptree to_property_tree() const;
357  };
358 
362  struct monero_check_tx : public monero_check {
363  boost::optional<bool> m_in_tx_pool;
364  boost::optional<uint64_t> m_num_confirmations;
365  boost::optional<uint64_t> m_received_amount;
366 
367  boost::property_tree::ptree to_property_tree() const;
368  };
369 
374  boost::optional<uint64_t> m_total_amount;
375  boost::optional<uint64_t> m_unconfirmed_spent_amount;
376 
377  boost::property_tree::ptree to_property_tree() const;
378  };
379 }
Definition: monero_daemon.cpp:58
Definition: monero_wallet_model.h:134
Definition: monero_wallet_model.h:297
Definition: monero_wallet_model.h:166
Definition: monero_wallet_model.h:273
Definition: monero_daemon_model.h:68
Definition: monero_daemon_model.h:218
Definition: monero_daemon_model.h:156
Definition: monero_wallet_model.h:254
monero_send_priority
Definition: monero_wallet_model.h:308
Definition: monero_wallet_model.h:373
Definition: monero_wallet_model.h:181
Definition: monero_wallet_model.h:68
Definition: monero_wallet_model.h:362
Definition: monero_wallet_model.h:239
Definition: monero_wallet_model.h:318
Definition: monero_wallet_model.h:107
Definition: monero_wallet_model.h:78
Definition: monero_wallet_model.h:219
Definition: monero_wallet_model.h:199
Definition: monero_wallet_model.h:342
Definition: monero_wallet_model.h:353
Definition: monero_wallet_model.h:147