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_daemon_trusted()
const;
281 bool is_synced()
const;
288 string get_path()
const;
302 string get_seed()
const;
309 string get_mnemonic()
const;
316 string get_language()
const;
323 vector<string> get_languages()
const;
330 string get_public_view_key()
const;
337 string get_private_view_key()
const;
344 string get_public_spend_key()
const;
351 string get_private_spend_key()
const;
358 string get_primary_address()
const;
367 string get_address(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const;
385 monero_integrated_address get_integrated_address(
const string& standard_address =
"",
const string& payment_id =
"")
const;
412 set<monero_wallet_listener*> get_listeners();
449 void start_syncing();
474 void rescan_blockchain();
488 uint64_t get_balance()
const;
496 uint64_t get_balance(uint32_t account_idx)
const;
505 uint64_t get_balance(uint32_t account_idx, uint32_t subaddress_idx)
const;
512 uint64_t get_unlocked_balance()
const;
520 uint64_t get_unlocked_balance(uint32_t account_idx)
const;
529 uint64_t get_unlocked_balance(uint32_t account_idx, uint32_t subaddress_idx)
const;
536 vector<monero_account> get_accounts()
const;
544 vector<monero_account> get_accounts(
bool include_subaddresses)
const;
552 vector<monero_account> get_accounts(
const string& tag)
const;
561 vector<monero_account> get_accounts(
bool include_subaddresses,
const string& tag)
const;
578 monero_account get_account(
const uint32_t account_idx,
bool include_subaddresses)
const;
594 vector<monero_subaddress> get_subaddresses(
const uint32_t account_idx)
const;
603 vector<monero_subaddress> get_subaddresses(
const uint32_t account_idx,
const vector<uint32_t>& subaddress_indices)
const;
612 monero_subaddress getSubaddress(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const;
621 monero_subaddress create_subaddress(uint32_t account_idx,
const string& label =
"");
637 vector<shared_ptr<monero_tx_wallet>> get_txs()
const;
659 vector<shared_ptr<monero_tx_wallet>> get_txs(
const monero_tx_query& request)
const;
739 vector<shared_ptr<monero_output_wallet>> get_outputs(
const monero_output_query& request)
const;
746 string get_outputs_hex()
const;
754 int import_outputs_hex(
const string& outputs_hex);
761 vector<shared_ptr<monero_key_image>> get_key_images()
const;
769 shared_ptr<monero_key_image_import_result> import_key_images(
const vector<shared_ptr<monero_key_image>>& key_images);
796 monero_tx_set create_tx(uint32_t account_index,
string address, uint64_t amount);
825 string relay_tx(
const string& tx_metadata);
841 vector<string> relay_txs(
const vector<string>& tx_metadatas);
849 vector<string> relay_txs(
const vector<shared_ptr<monero_tx_wallet>>& txs);
869 monero_tx_set send(uint32_t account_index,
string address, uint64_t amount);
1008 string sign(
const string& msg)
const;
1018 bool verify(
const string& msg,
const string& address,
const string& signature)
const;
1026 string get_tx_key(
const string& tx_id)
const;
1036 shared_ptr<monero_check_tx> check_tx_key(
const string& tx_id,
const string& txKey,
const string& address)
const;
1055 string get_tx_proof(
const string& tx_id,
const string& address,
const string& message)
const;
1066 shared_ptr<monero_check_tx> check_tx_proof(
const string& tx_id,
const string& address,
const string& message,
const string& signature)
const;
1083 string get_spend_proof(
const string& tx_id,
const string& message)
const;
1093 bool check_spend_proof(
const string& tx_id,
const string& message,
const string& signature)
const;
1101 string get_reserve_proof_wallet(
const string& message)
const;
1111 string get_reserve_proof_account(uint32_t account_idx, uint64_t amount,
const string& message)
const;
1121 shared_ptr<monero_check_reserve> check_reserve_proof(
const string& address,
const string& message,
const string& signature)
const;
1129 string get_tx_note(
const string& tx_id)
const;
1137 vector<string> get_tx_notes(
const vector<string>& tx_ids)
const;
1145 void set_tx_note(
const string& tx_id,
const string& note);
1153 void set_tx_notes(
const vector<string>& tx_ids,
const vector<string>& notes);
1240 shared_ptr<monero_send_request> parse_payment_uri(
const string& uri)
const;
1248 string get_attribute(
const string& key)
const;
1256 void set_attribute(
const string& key,
const string& val);
1265 void start_mining(boost::optional<uint64_t> num_threads, boost::optional<bool> background_mining, boost::optional<bool> ignore_battery);
1277 uint64_t wait_for_next_block();
1284 bool is_multisig_import_needed()
const;
1301 string prepare_multisig();
1322 string finalize_multisig(
const vector<string>& multisig_hexes,
const string& password);
1340 string get_multisig_hex();
1352 int import_multisig_hex(
const vector<string>& multisig_hexes);
1368 vector<string> submit_multisig_tx_hex(
const string& signed_multisig_tx_hex);
1381 void move_to(
string path,
string password);
1388 void close(
bool save =
false);
1394 unique_ptr<tools::wallet2> m_w2;
1395 unique_ptr<wallet2_listener> m_w2_listener;
1396 set<monero_wallet_listener*> m_listeners;
1399 vector<monero_subaddress> get_subaddresses_aux(uint32_t account_idx,
const vector<uint32_t>& subaddress_indices,
const vector<tools::wallet2::transfer_details>& transfers)
const;
1403 mutable std::atomic<bool> m_is_synced;
1404 mutable std::atomic<bool> m_is_connected;
1405 boost::condition_variable m_sync_cv;
1406 boost::mutex m_sync_mutex;
1407 std::atomic<bool> m_rescan_on_sync;
1408 std::atomic<bool> m_syncing_enabled;
1409 std::atomic<int> m_syncing_interval;
1410 boost::thread m_syncing_thread;
1411 boost::mutex m_syncing_mutex;
1412 std::atomic<bool> m_syncing_thread_done;
1413 void sync_thread_func();
1414 monero_sync_result lock_and_sync(boost::optional<uint64_t> start_height = boost::none);
Definition: monero_wallet_model.h:406
Definition: monero_daemon.cpp:58
Definition: monero_wallet.h:129
Definition: monero_wallet_model.h:317
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:420
Definition: monero_wallet_model.h:276
Definition: monero_wallet_model.h:430
Definition: monero_wallet_model.h:256
monero_send_priority
Definition: monero_wallet_model.h:328
Definition: monero_wallet_model.h:68
Definition: monero_wallet_model.h:305
virtual void on_output_received(const monero_output_wallet &output)
Definition: monero_wallet.h:111
Definition: monero_wallet_model.h:240
Definition: monero_wallet_model.h:338
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:220
Definition: monero_wallet_model.h:200
monero_network_type
Definition: monero_daemon_model.h:88
Definition: monero_wallet.cpp:670