55 #include "monero_wallet.h" 56 #include "wallet/wallet2.h" 58 #include <boost/thread/mutex.hpp> 59 #include <boost/thread/thread.hpp> 60 #include <boost/thread/condition_variable.hpp> 63 using namespace crypto;
91 static bool wallet_exists(
const string& path);
139 static monero_wallet_core* create_wallet_from_keys(
const string& path,
const string& password,
const monero_network_type network_type,
const string& address,
const string& view_key,
const string& spend_key,
const monero_rpc_connection& daemon_connection, uint64_t restore_height,
const string& language);
146 static vector<string> get_mnemonic_languages();
158 void set_daemon_connection(
const string& uri,
const string& username =
"",
const string& password =
"");
160 shared_ptr<monero_rpc_connection> get_daemon_connection()
const;
161 bool is_connected()
const;
162 bool is_daemon_synced()
const;
163 bool is_daemon_trusted()
const;
164 bool is_synced()
const;
166 string get_path()
const;
168 string get_mnemonic()
const;
169 string get_mnemonic_language()
const;
170 string get_public_view_key()
const;
171 string get_private_view_key()
const;
172 string get_public_spend_key()
const;
173 string get_private_spend_key()
const;
174 string get_address(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const;
176 monero_integrated_address get_integrated_address(
const string& standard_address =
"",
const string& payment_id =
"")
const;
178 uint64_t get_height()
const;
179 uint64_t get_restore_height()
const;
180 void set_restore_height(uint64_t restore_height);
181 uint64_t get_daemon_height()
const;
182 uint64_t get_daemon_max_peer_height()
const;
185 set<monero_wallet_listener*> get_listeners();
190 void start_syncing();
193 void rescan_blockchain();
194 uint64_t get_balance()
const;
195 uint64_t get_balance(uint32_t account_idx)
const;
196 uint64_t get_balance(uint32_t account_idx, uint32_t subaddress_idx)
const;
197 uint64_t get_unlocked_balance()
const;
198 uint64_t get_unlocked_balance(uint32_t account_idx)
const;
199 uint64_t get_unlocked_balance(uint32_t account_idx, uint32_t subaddress_idx)
const;
200 vector<monero_account> get_accounts(
bool include_subaddresses,
const string& tag)
const;
201 monero_account get_account(
const uint32_t account_idx,
bool include_subaddresses)
const;
203 vector<monero_subaddress> get_subaddresses(
const uint32_t account_idx,
const vector<uint32_t>& subaddress_indices)
const;
204 monero_subaddress create_subaddress(uint32_t account_idx,
const string& label =
"");
205 vector<shared_ptr<monero_tx_wallet>> get_txs()
const;
206 vector<shared_ptr<monero_tx_wallet>> get_txs(
const monero_tx_query& query)
const;
208 vector<shared_ptr<monero_output_wallet>> get_outputs(
const monero_output_query& query)
const;
209 string get_outputs_hex()
const;
210 int import_outputs_hex(
const string& outputs_hex);
211 vector<shared_ptr<monero_key_image>> get_key_images()
const;
212 shared_ptr<monero_key_image_import_result> import_key_images(
const vector<shared_ptr<monero_key_image>>& key_images);
214 monero_tx_set create_tx(uint32_t account_index,
string address, uint64_t amount);
217 string relay_tx(
const string& tx_metadata);
219 vector<string> relay_txs(
const vector<string>& tx_metadatas);
220 vector<string> relay_txs(
const vector<shared_ptr<monero_tx_wallet>>& txs);
222 monero_tx_set send(uint32_t account_index,
string address, uint64_t amount);
229 string sign(
const string& msg)
const;
230 bool verify(
const string& msg,
const string& address,
const string& signature)
const;
231 string get_tx_key(
const string& tx_hash)
const;
232 shared_ptr<monero_check_tx> check_tx_key(
const string& tx_hash,
const string& txKey,
const string& address)
const;
233 string get_tx_proof(
const string& tx_hash,
const string& address,
const string& message)
const;
234 shared_ptr<monero_check_tx> check_tx_proof(
const string& tx_hash,
const string& address,
const string& message,
const string& signature)
const;
235 string get_spend_proof(
const string& tx_hash,
const string& message)
const;
236 bool check_spend_proof(
const string& tx_hash,
const string& message,
const string& signature)
const;
237 string get_reserve_proof_wallet(
const string& message)
const;
238 string get_reserve_proof_account(uint32_t account_idx, uint64_t amount,
const string& message)
const;
239 shared_ptr<monero_check_reserve> check_reserve_proof(
const string& address,
const string& message,
const string& signature)
const;
240 string get_tx_note(
const string& tx_hash)
const;
241 vector<string> get_tx_notes(
const vector<string>& tx_hashes)
const;
242 void set_tx_note(
const string& tx_hash,
const string& note);
243 void set_tx_notes(
const vector<string>& tx_hashes,
const vector<string>& notes);
244 vector<monero_address_book_entry> get_address_book_entries(
const vector<uint64_t>& indices)
const;
245 uint64_t add_address_book_entry(
const string& address,
const string& description,
const string& payment_id =
"");
246 void edit_address_book_entry(uint64_t index,
bool set_address,
const string& address,
bool set_description,
const string& description,
bool set_payment_id =
false,
const string& payment_id =
"");
247 void delete_address_book_entry(uint64_t index);
249 shared_ptr<monero_send_request> parse_payment_uri(
const string& uri)
const;
250 bool get_attribute(
const string& key,
string& value)
const;
251 void set_attribute(
const string& key,
const string& val);
252 void start_mining(boost::optional<uint64_t> num_threads, boost::optional<bool> background_mining, boost::optional<bool> ignore_battery);
254 uint64_t wait_for_next_block();
255 bool is_multisig_import_needed()
const;
257 string prepare_multisig();
260 string get_multisig_hex();
261 int import_multisig_hex(
const vector<string>& multisig_hexes);
263 vector<string> submit_multisig_tx_hex(
const string& signed_multisig_tx_hex);
265 void move_to(
string path,
string password);
266 void close(
bool save =
false);
272 unique_ptr<tools::wallet2> m_w2;
273 unique_ptr<wallet2_listener> m_w2_listener;
274 set<monero_wallet_listener*> m_listeners;
277 vector<monero_subaddress> get_subaddresses_aux(uint32_t account_idx,
const vector<uint32_t>& subaddress_indices,
const vector<tools::wallet2::transfer_details>& transfers)
const;
281 mutable std::atomic<bool> m_is_synced;
282 mutable std::atomic<bool> m_is_connected;
283 boost::condition_variable m_sync_cv;
284 boost::mutex m_sync_mutex;
285 std::atomic<bool> m_rescan_on_sync;
286 std::atomic<bool> m_syncing_enabled;
287 std::atomic<int> m_syncing_interval;
288 boost::thread m_syncing_thread;
289 boost::mutex m_syncing_mutex;
290 std::atomic<bool> m_syncing_thread_done;
291 void sync_thread_func();
292 monero_sync_result lock_and_sync(boost::optional<uint64_t> start_height = boost::none);
Definition: monero_wallet_model.h:407
Definition: monero_daemon.cpp:58
Definition: monero_wallet.h:123
Definition: monero_wallet_model.h:318
Definition: monero_wallet.h:90
Definition: monero_wallet.h:72
Definition: monero_wallet_model.h:421
Definition: monero_wallet_model.h:274
Definition: monero_wallet_model.h:431
Definition: monero_daemon_model.h:101
Definition: monero_wallet_model.h:246
monero_send_priority
Definition: monero_wallet_model.h:329
Definition: monero_wallet_model.h:68
Definition: monero_wallet_model.h:304
Definition: monero_wallet_model.h:225
Definition: monero_wallet_model.h:339
Definition: monero_wallet_model.h:97
Definition: monero_daemon_model.h:113
Definition: monero_wallet_model.h:80
Definition: monero_wallet_model.h:183
monero_network_type
Definition: monero_daemon_model.h:92
Definition: monero_wallet_core.h:81
Definition: monero_wallet_core.cpp:657