55 #include "monero_wallet_model.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;
90 virtual void on_sync_progress(uint64_t height, uint64_t start_height, uint64_t end_height,
double percent_done,
const string& message) {}
139 static bool wallet_exists(
const string& path);
159 static monero_wallet* create_wallet_random(
const string& path,
const string& password);
172 static monero_wallet* create_wallet_from_mnemonic(
const string& path,
const string& password,
const monero_network_type network_type,
const string& mnemonic);
188 static monero_wallet* 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);
189 static monero_wallet* 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);
190 static monero_wallet* 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);
202 uint64_t get_height()
const;
209 uint64_t get_restore_height()
const;
216 void set_restore_height(uint64_t restore_height);
223 uint64_t get_daemon_height()
const;
230 uint64_t get_daemon_max_peer_height()
const;
239 void set_daemon_connection(
const string& uri,
const string& username =
"",
const string& password =
"");
253 shared_ptr<monero_rpc_connection> get_daemon_connection()
const;
260 bool is_connected()
const;
267 bool is_daemon_synced()
const;
274 bool is_synced()
const;
281 string get_path()
const;
295 string get_seed()
const;
302 string get_mnemonic()
const;
309 string get_language()
const;
316 vector<string> get_languages()
const;
323 string get_public_view_key()
const;
330 string get_private_view_key()
const;
337 string get_public_spend_key()
const;
344 string get_private_spend_key()
const;
351 string get_primary_address()
const;
360 string get_address(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const;
378 monero_integrated_address get_integrated_address(
const string& standard_address =
"",
const string& payment_id =
"")
const;
405 set<monero_wallet_listener*> get_listeners();
442 void start_syncing();
456 void rescan_blockchain();
470 uint64_t get_balance()
const;
478 uint64_t get_balance(uint32_t account_idx)
const;
487 uint64_t get_balance(uint32_t account_idx, uint32_t subaddress_idx)
const;
494 uint64_t get_unlocked_balance()
const;
502 uint64_t get_unlocked_balance(uint32_t account_idx)
const;
511 uint64_t get_unlocked_balance(uint32_t account_idx, uint32_t subaddress_idx)
const;
518 vector<monero_account> get_accounts()
const;
526 vector<monero_account> get_accounts(
bool include_subaddresses)
const;
534 vector<monero_account> get_accounts(
const string& tag)
const;
543 vector<monero_account> get_accounts(
bool include_subaddresses,
const string& tag)
const;
560 monero_account get_account(
const uint32_t account_idx,
bool include_subaddresses)
const;
576 vector<monero_subaddress> get_subaddresses(
const uint32_t account_idx)
const;
585 vector<monero_subaddress> get_subaddresses(
const uint32_t account_idx,
const vector<uint32_t>& subaddress_indices)
const;
594 monero_subaddress getSubaddress(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const;
603 monero_subaddress create_subaddress(uint32_t account_idx,
const string& label =
"");
619 vector<shared_ptr<monero_tx_wallet>> get_txs()
const;
641 vector<shared_ptr<monero_tx_wallet>> get_txs(
const monero_tx_query& request)
const;
721 vector<shared_ptr<monero_output_wallet>> get_outputs(
const monero_output_query& request)
const;
728 string get_outputs_hex()
const;
736 int import_outputs_hex(
const string& outputs_hex);
743 vector<shared_ptr<monero_key_image>> get_key_images()
const;
751 shared_ptr<monero_key_image_import_result> import_key_images(
const vector<shared_ptr<monero_key_image>>& key_images);
778 shared_ptr<monero_tx_wallet> create_tx(uint32_t account_index,
string address, uint64_t amount);
790 shared_ptr<monero_tx_wallet> create_tx(
int account_index,
string address, uint64_t amount,
monero_send_priority priority);
807 string relay_tx(
const string& tx_metadata);
823 vector<string> relay_txs(
const vector<string>& tx_metadatas);
831 vector<string> relay_txs(
const vector<shared_ptr<monero_tx_wallet>>& txs);
851 shared_ptr<monero_tx_wallet> send(uint32_t account_index,
string address, uint64_t amount);
863 shared_ptr<monero_tx_wallet> send(uint32_t account_index,
string address, uint64_t amount,
monero_send_priority priority);
1007 vector<shared_ptr<monero_tx_wallet>> sweep_dust(
bool do_not_relay =
false);
1015 string get_tx_note(
const string& tx_id)
const;
1023 vector<string> get_tx_notes(
const vector<string>& tx_ids)
const;
1031 void set_tx_note(
const string& tx_id,
const string& note);
1039 void set_tx_notes(
const vector<string>& tx_ids,
const vector<string>& notes);
1047 string sign(
const string& msg)
const;
1057 bool verify(
const string& msg,
const string& address,
const string& signature)
const;
1065 string get_tx_key(
const string& tx_id)
const;
1075 shared_ptr<monero_check_tx> check_tx_key(
const string& tx_id,
const string& txKey,
const string& address)
const;
1094 string get_tx_proof(
const string& tx_id,
const string& address,
const string& message)
const;
1105 shared_ptr<monero_check_tx> check_tx_proof(
const string& tx_id,
const string& address,
const string& message,
const string& signature)
const;
1122 string get_spend_proof(
const string& tx_id,
const string& message)
const;
1132 bool check_spend_proof(
const string& tx_id,
const string& message,
const string& signature)
const;
1140 string get_reserve_proof_wallet(
const string& message)
const;
1150 string get_reserve_proof_account(uint32_t account_idx, uint64_t amount,
const string& message)
const;
1160 shared_ptr<monero_check_reserve> check_reserve_proof(
const string& address,
const string& message,
const string& signature)
const;
1247 shared_ptr<monero_send_request> parse_payment_uri(
const string& uri)
const;
1255 void set_attribute(
const string& key,
const string& val);
1263 string get_attribute(
const string& key)
const;
1272 void start_mining(boost::optional<uint64_t> num_threads, boost::optional<bool> background_mining, boost::optional<bool> ignore_battery);
1284 uint64_t wait_for_next_block();
1297 void move_to(
string path,
string password);
1308 unique_ptr<tools::wallet2> m_w2;
1309 unique_ptr<wallet2_listener> m_w2_listener;
1310 set<monero_wallet_listener*> m_listeners;
1313 vector<monero_subaddress> get_subaddresses_aux(uint32_t account_idx,
const vector<uint32_t>& subaddress_indices,
const vector<tools::wallet2::transfer_details>& transfers)
const;
1316 mutable std::atomic<bool> m_is_synced;
1317 mutable std::atomic<bool> m_is_connected;
1318 boost::condition_variable m_sync_cv;
1319 boost::mutex m_sync_mutex;
1320 std::atomic<bool> m_rescan_on_sync;
1321 std::atomic<bool> m_syncing_enabled;
1322 std::atomic<int> m_syncing_interval;
1323 boost::thread m_syncing_thread;
1324 boost::mutex m_syncing_mutex;
1325 std::atomic<bool> m_syncing_thread_done;
1326 void sync_thread_func();
1327 monero_sync_result lock_and_sync(boost::optional<uint64_t> start_height = boost::none);
Definition: monero_daemon.cpp:58
Definition: monero_wallet.h:129
Definition: monero_wallet_model.h:297
virtual void on_output_spent(const monero_output_wallet &output)
Definition: monero_wallet.h:118
Definition: monero_wallet.h:96
Definition: monero_wallet.h:78
Definition: monero_wallet_model.h:273
Definition: monero_wallet_model.h:254
monero_send_priority
Definition: monero_wallet_model.h:308
Definition: monero_wallet_model.h:68
virtual void on_output_received(const monero_output_wallet &output)
Definition: monero_wallet.h:111
Definition: monero_wallet_model.h:239
Definition: monero_wallet_model.h:318
virtual void on_new_block(uint64_t height)
Definition: monero_wallet.h:104
Definition: monero_wallet_model.h:107
Definition: monero_daemon_model.h:99
Definition: monero_wallet_model.h:78
virtual void on_sync_progress(uint64_t height, uint64_t start_height, uint64_t end_height, double percent_done, const string &message)
Definition: monero_wallet.h:90
Definition: monero_wallet_model.h:219
Definition: monero_wallet_model.h:199
monero_network_type
Definition: monero_daemon_model.h:88
Definition: monero_wallet.cpp:657