55#include <boost/optional.hpp>
56#include <boost/thread/mutex.hpp>
57#include <boost/thread/recursive_mutex.hpp>
58#include <boost/thread/thread.hpp>
59#include <boost/thread/condition_variable.hpp>
63#include "monero_wallet.h"
64#include "wallet/wallet2.h"
116 static monero_wallet_full*
open_wallet_data(
const std::string& password,
const monero_network_type,
const std::string& keys_data,
const std::string& cache_data,
const std::shared_ptr<monero_rpc_connection>& daemon_connection = std::make_shared<monero_rpc_connection>(), std::unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory =
nullptr,
bool regtest =
false);
145 void set_daemon_connection(
const std::string& uri,
const std::string& username =
"",
const std::string& password =
"",
const std::string& proxy_uri =
"",
const boost::optional<bool>& is_trusted = boost::none)
override;
146 void set_daemon_connection(
const std::shared_ptr<monero_rpc_connection>& connection,
const boost::optional<bool>& is_trusted = boost::none)
override;
153 std::string
get_path()
const override;
155 std::string
get_seed()
const override;
161 std::string
get_address(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const override;
170 uint64_t
get_height_by_date(uint16_t year, uint8_t month, uint8_t day)
const override;
181 void scan_txs(
const std::vector<std::string>& tx_hashes)
override;
185 uint64_t
get_balance(uint32_t account_idx)
const override;
186 uint64_t
get_balance(uint32_t account_idx, uint32_t subaddress_idx)
const override;
190 std::vector<monero_account>
get_accounts(
bool include_subaddresses,
const std::string& tag)
const override;
193 std::vector<monero_subaddress>
get_subaddresses(
const uint32_t account_idx,
const std::vector<uint32_t>& subaddress_indices)
const override;
195 void set_subaddress_label(uint32_t account_idx, uint32_t subaddress_idx,
const std::string& label =
"")
override;
196 std::vector<std::shared_ptr<monero_tx_wallet>>
get_txs()
const override;
202 std::shared_ptr<monero_key_image_export_result>
export_key_images(
bool all =
false)
const override;
203 std::shared_ptr<monero_key_image_import_result>
import_key_images(
const std::vector<std::shared_ptr<monero_key_image>>& key_images, uint64_t offset = 0)
override;
205 void thaw_output(
const std::string& key_image)
override;
211 std::vector<std::shared_ptr<monero_tx_wallet>>
sweep_dust(
bool relay =
false)
override;
212 std::vector<std::string>
relay_txs(
const std::vector<std::string>& tx_metadatas)
override;
215 std::vector<std::string>
submit_txs(
const std::string& signed_tx_hex)
override;
218 std::string
get_tx_key(
const std::string& tx_hash)
const override;
219 std::shared_ptr<monero_check_tx>
check_tx_key(
const std::string& tx_hash,
const std::string& txKey,
const std::string& address)
const override;
220 std::string
get_tx_proof(
const std::string& tx_hash,
const std::string& address,
const std::string& message)
const override;
221 std::shared_ptr<monero_check_tx>
check_tx_proof(
const std::string& tx_hash,
const std::string& address,
const std::string& message,
const std::string& signature)
const override;
222 std::string
get_spend_proof(
const std::string& tx_hash,
const std::string& message)
const override;
223 bool check_spend_proof(
const std::string& tx_hash,
const std::string& message,
const std::string& signature)
const override;
226 std::shared_ptr<monero_check_reserve>
check_reserve_proof(
const std::string& address,
const std::string& message,
const std::string& signature)
const override;
227 std::string
get_tx_note(
const std::string& tx_hash)
const override;
228 std::vector<std::string>
get_tx_notes(
const std::vector<std::string>& tx_hashes)
const override;
229 void set_tx_note(
const std::string& tx_hash,
const std::string& note)
override;
230 void set_tx_notes(
const std::vector<std::string>& tx_hashes,
const std::vector<std::string>& notes)
override;
231 std::vector<monero_address_book_entry>
get_address_book_entries(
const std::vector<uint64_t>& indices)
const override;
233 void edit_address_book_entry(uint64_t index,
bool set_address,
const std::string& address,
bool set_description,
const std::string& description)
override;
236 std::shared_ptr<monero_tx_config>
parse_payment_uri(
const std::string& uri)
const override;
237 bool get_attribute(
const std::string& key, std::string& value)
const override;
238 void set_attribute(
const std::string& key,
const std::string& val)
override;
239 void start_mining(boost::optional<uint64_t> num_threads, boost::optional<bool> background_mining, boost::optional<bool> ignore_battery)
override;
245 std::string
make_multisig(
const std::vector<std::string>& multisig_hexes,
int threshold,
const std::string& password)
override;
248 int import_multisig_hex(
const std::vector<std::string>& multisig_hexes,
const bool refresh_after_import =
true)
override;
251 void change_password(
const std::string& old_password,
const std::string& new_password)
override;
252 void move_to(
const std::string& path,
const std::string& password)
override;
253 void save()
override;
267 std::string get_cache_file_buffer()
const;
272 std::unique_ptr<tools::wallet2> m_w2;
280 mutable boost::mutex m_daemon_connection_mutex;
281 std::string m_daemon_proxy_uri;
282 bool m_daemon_ssl_verify =
true;
283 void set_daemon_connection(
const std::string& uri,
const std::string& username,
const std::string& password,
const std::string& proxy_uri,
const boost::optional<bool>& is_trusted,
bool ssl_verify);
284 std::unique_ptr<wallet2_listener> m_w2_listener;
285 std::set<monero_wallet_listener*> m_listeners;
286 boost::recursive_mutex m_listeners_mutex;
288 std::atomic<bool> m_is_closed;
294 std::vector<monero_subaddress> get_subaddresses_aux(uint32_t account_idx,
const std::vector<uint32_t>& subaddress_indices,
const std::vector<tools::wallet2::transfer_details>& transfers)
const;
295 std::vector<std::shared_ptr<monero_tx_wallet>> get_txs_aux(
const monero_tx_query& query,
int max_attempts = 5)
const;
296 std::vector<std::shared_ptr<monero_transfer>> get_transfers_aux(
const monero_transfer_query& query)
const;
297 std::vector<std::shared_ptr<monero_output_wallet>> get_outputs_aux(
const monero_output_query& query)
const;
298 std::vector<std::shared_ptr<monero_tx_wallet>> sweep_account(
const monero_tx_config& config);
300 void assert_not_closed()
const;
303 struct sync_op_lock {
305 sync_op_lock(
const sync_op_lock&) =
delete;
311 mutable std::atomic<bool> m_is_synced;
312 boost::condition_variable m_sync_cv;
313 mutable boost::mutex m_sync_mutex;
314 mutable std::atomic<uint32_t> m_num_sync_pauses;
315 std::atomic<bool> m_background_syncing;
316 std::atomic<bool> m_interrupt_sync;
317 std::atomic<bool> m_sync_in_progress;
318 std::atomic<bool> m_rescan_on_sync;
319 std::atomic<bool> m_syncing_enabled;
320 std::atomic<bool> m_sync_loop_running;
321 std::atomic<int> m_syncing_interval;
322 boost::thread m_syncing_thread;
323 boost::mutex m_syncing_mutex;
324 void run_sync_loop();
325 monero_sync_result lock_and_sync(boost::optional<uint64_t> start_height = boost::none,
bool background =
false);
326 monero_sync_result sync_aux(boost::optional<uint64_t> start_height, boost::unique_lock<boost::mutex>& lock);
Definition monero_wallet_full.h:81
void start_mining(boost::optional< uint64_t > num_threads, boost::optional< bool > background_mining, boost::optional< bool > ignore_battery) override
Definition monero_wallet_full.cpp:3332
std::string get_seed() const override
Definition monero_wallet_full.cpp:1320
std::vector< std::shared_ptr< monero_output_wallet > > get_outputs(const monero_output_query &query) const override
Definition monero_wallet_full.cpp:1903
std::shared_ptr< monero_rpc_connection > get_daemon_connection() const override
Definition monero_wallet_full.cpp:1259
static bool wallet_exists(const std::string &path)
Definition monero_wallet_full.cpp:963
std::string get_tx_note(const std::string &tx_hash) const override
Definition monero_wallet_full.cpp:3179
monero_version get_version() const override
Definition monero_wallet_full.cpp:1302
uint64_t get_restore_height() const override
Definition monero_wallet_full.cpp:1449
std::string get_private_view_key() const override
Definition monero_wallet_full.cpp:1347
std::string prepare_multisig() override
Definition monero_wallet_full.cpp:3419
std::string get_public_view_key() const override
Definition monero_wallet_full.cpp:1341
std::vector< monero_address_book_entry > get_address_book_entries(const std::vector< uint64_t > &indices) const override
Definition monero_wallet_full.cpp:3218
monero_account get_account(const uint32_t account_idx, bool include_subaddresses) const override
Definition monero_wallet_full.cpp:1674
std::vector< std::shared_ptr< monero_tx_wallet > > sweep_dust(bool relay=false) override
Definition monero_wallet_full.cpp:2541
void set_attribute(const std::string &key, const std::string &val) override
Definition monero_wallet_full.cpp:3327
void set_tx_notes(const std::vector< std::string > &tx_hashes, const std::vector< std::string > ¬es) override
Definition monero_wallet_full.cpp:3209
void stop_syncing() override
Definition monero_wallet_full.cpp:1565
std::string get_path() const override
Definition monero_wallet_full.cpp:1310
std::vector< monero_subaddress > get_subaddresses(const uint32_t account_idx, const std::vector< uint32_t > &subaddress_indices) const override
Definition monero_wallet_full.cpp:1710
void set_tx_note(const std::string &tx_hash, const std::string ¬e) override
Definition monero_wallet_full.cpp:3198
static monero_wallet_full * open_wallet(const std::string &path, const std::string &password, const monero_network_type network_type, bool regtest=false)
Definition monero_wallet_full.cpp:971
monero_multisig_sign_result sign_multisig_tx_hex(const std::string &multisig_tx_hex) override
Definition monero_wallet_full.cpp:3498
void freeze_output(const std::string &key_image) override
Definition monero_wallet_full.cpp:1997
std::vector< std::string > relay_txs(const std::vector< std::string > &tx_metadatas) override
Definition monero_wallet_full.cpp:2644
int import_multisig_hex(const std::vector< std::string > &multisig_hexes, const bool refresh_after_import=true) override
Definition monero_wallet_full.cpp:3468
monero_subaddress create_subaddress(uint32_t account_idx, const std::string &label="") override
Definition monero_wallet_full.cpp:1721
std::shared_ptr< monero_key_image_export_result > export_key_images(bool all=false) const override
Definition monero_wallet_full.cpp:1948
void rescan_blockchain() override
Definition monero_wallet_full.cpp:1601
bool is_view_only() const override
Definition monero_wallet_full.h:144
static std::vector< std::string > get_seed_languages()
Definition monero_wallet_full.cpp:1206
void rescan_spent() override
Definition monero_wallet_full.cpp:1592
std::string sign_message(const std::string &msg, monero_message_signature_type signature_type, uint32_t account_idx=0, uint32_t subaddress_idx=0) const override
Definition monero_wallet_full.cpp:2937
static monero_wallet_full * create_wallet(const monero_wallet_config &config, std::unique_ptr< epee::net_utils::http::http_client_factory > http_client_factory=nullptr)
Definition monero_wallet_full.cpp:1005
std::string get_tx_key(const std::string &tx_hash) const override
Definition monero_wallet_full.cpp:2978
void thaw_output(const std::string &key_image) override
Definition monero_wallet_full.cpp:2006
uint64_t get_unlocked_balance() const override
Definition monero_wallet_full.cpp:1630
monero_subaddress get_address_index(const std::string &address) const override
Definition monero_wallet_full.cpp:1373
std::vector< std::string > submit_txs(const std::string &signed_tx_hex) override
Definition monero_wallet_full.cpp:2909
std::shared_ptr< monero_key_image_import_result > import_key_images(const std::vector< std::shared_ptr< monero_key_image > > &key_images, uint64_t offset=0) override
Definition monero_wallet_full.cpp:1966
std::vector< std::shared_ptr< monero_tx_wallet > > create_txs(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2029
std::shared_ptr< monero_tx_config > parse_payment_uri(const std::string &uri) const override
Definition monero_wallet_full.cpp:3316
std::shared_ptr< monero_check_reserve > check_reserve_proof(const std::string &address, const std::string &message, const std::string &signature) const override
Definition monero_wallet_full.cpp:3157
std::vector< std::string > submit_multisig_tx_hex(const std::string &signed_multisig_tx_hex) override
Definition monero_wallet_full.cpp:3544
std::string get_spend_proof(const std::string &tx_hash, const std::string &message) const override
Definition monero_wallet_full.cpp:3107
uint64_t get_height_by_date(uint16_t year, uint8_t month, uint8_t day) const override
Definition monero_wallet_full.cpp:1476
std::string export_outputs(bool all=false) const override
Definition monero_wallet_full.cpp:1928
monero_integrated_address decode_integrated_address(const std::string &integrated_address) const override
Definition monero_wallet_full.cpp:1427
monero_tx_set sign_txs(const std::string &unsigned_tx_hex) override
Definition monero_wallet_full.cpp:2868
std::vector< std::shared_ptr< monero_tx_wallet > > get_txs() const override
Definition monero_wallet_full.cpp:1751
std::vector< std::shared_ptr< monero_tx_wallet > > sweep_unlocked(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2190
monero_tx_set describe_tx_set(const monero_tx_set &tx_set) override
Definition monero_wallet_full.cpp:2694
void request_shutdown()
Definition monero_wallet_full.cpp:3630
int import_outputs(const std::string &outputs_hex) override
Definition monero_wallet_full.cpp:1934
std::string get_payment_uri(const monero_tx_config &config) const override
Definition monero_wallet_full.cpp:3310
std::shared_ptr< monero_check_tx > check_tx_proof(const std::string &tx_hash, const std::string &address, const std::string &message, const std::string &signature) const override
Definition monero_wallet_full.cpp:3074
void start_syncing(uint64_t sync_period_in_ms) override
Definition monero_wallet_full.cpp:1556
void add_listener(monero_wallet_listener &listener) override
Definition monero_wallet_full.cpp:1481
void save() override
Definition monero_wallet_full.cpp:3605
bool is_output_frozen(const std::string &key_image) override
Definition monero_wallet_full.cpp:2015
bool is_daemon_synced() const override
Definition monero_wallet_full.cpp:1286
bool is_multisig_import_needed() const override
Definition monero_wallet_full.cpp:3407
std::string get_reserve_proof_wallet(const std::string &message) const override
Definition monero_wallet_full.cpp:3139
monero_message_signature_result verify_message(const std::string &msg, const std::string &address, const std::string &signature) const override
Definition monero_wallet_full.cpp:2944
std::shared_ptr< monero_tx_wallet > sweep_output(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2395
std::string get_tx_proof(const std::string &tx_hash, const std::string &address, const std::string &message) const override
Definition monero_wallet_full.cpp:3055
void stop_mining() override
Definition monero_wallet_full.cpp:3363
bool get_attribute(const std::string &key, std::string &value) const override
Definition monero_wallet_full.cpp:3322
~monero_wallet_full()
Definition monero_wallet_full.cpp:1214
bool is_daemon_trusted() const override
Definition monero_wallet_full.cpp:1292
monero_tx_priority get_default_fee_priority() const override
Definition monero_wallet_full.cpp:2024
std::shared_ptr< monero_check_tx > check_tx_key(const std::string &tx_hash, const std::string &txKey, const std::string &address) const override
Definition monero_wallet_full.cpp:3004
void scan_txs(const std::vector< std::string > &tx_hashes) override
Definition monero_wallet_full.cpp:1572
std::string get_address(const uint32_t account_idx, const uint32_t subaddress_idx) const override
Definition monero_wallet_full.cpp:1368
std::set< monero_wallet_listener * > get_listeners() override
Definition monero_wallet_full.cpp:1492
bool check_spend_proof(const std::string &tx_hash, const std::string &message, const std::string &signature) const override
Definition monero_wallet_full.cpp:3122
void delete_address_book_entry(uint64_t index) override
Definition monero_wallet_full.cpp:3303
uint64_t add_address_book_entry(const std::string &address, const std::string &description) override
Definition monero_wallet_full.cpp:3251
std::string get_keys_file_buffer(const epee::wipeable_string &password, bool view_only) const
Definition monero_wallet_full.cpp:3612
bool is_connected_to_daemon() const override
Definition monero_wallet_full.cpp:1278
void change_password(const std::string &old_password, const std::string &new_password) override
Definition monero_wallet_full.cpp:3588
uint64_t wait_for_next_block() override
Definition monero_wallet_full.cpp:3374
void set_daemon_connection(const std::string &uri, const std::string &username="", const std::string &password="", const std::string &proxy_uri="", const boost::optional< bool > &is_trusted=boost::none) override
Definition monero_wallet_full.cpp:1219
monero_multisig_info get_multisig_info() const override
Definition monero_wallet_full.cpp:3412
uint64_t get_balance() const override
Definition monero_wallet_full.cpp:1610
monero_integrated_address get_integrated_address(const std::string &standard_address="", const std::string &payment_id="") const override
Definition monero_wallet_full.cpp:1396
static monero_wallet_full * open_wallet_data(const std::string &password, const monero_network_type, const std::string &keys_data, const std::string &cache_data, const std::shared_ptr< monero_rpc_connection > &daemon_connection=std::make_shared< monero_rpc_connection >(), std::unique_ptr< epee::net_utils::http::http_client_factory > http_client_factory=nullptr, bool regtest=false)
Definition monero_wallet_full.cpp:987
void move_to(const std::string &path, const std::string &password) override
Definition monero_wallet_full.cpp:3598
monero_multisig_init_result exchange_multisig_keys(const std::vector< std::string > &multisig_hexes, const std::string &password) override
Definition monero_wallet_full.cpp:3435
std::string get_seed_language() const override
Definition monero_wallet_full.cpp:1335
std::string make_multisig(const std::vector< std::string > &multisig_hexes, int threshold, const std::string &password) override
Definition monero_wallet_full.cpp:3427
monero_network_type get_network_type() const override
Definition monero_wallet_full.cpp:1315
monero_account create_account(const std::string &label="") override
Definition monero_wallet_full.cpp:1693
monero_sync_result sync() override
Definition monero_wallet_full.cpp:1506
std::string export_multisig_hex() override
Definition monero_wallet_full.cpp:3459
void remove_listener(monero_wallet_listener &listener) override
Definition monero_wallet_full.cpp:1487
uint64_t get_height() const override
Definition monero_wallet_full.cpp:1444
void edit_address_book_entry(uint64_t index, bool set_address, const std::string &address, bool set_description, const std::string &description) override
Definition monero_wallet_full.cpp:3269
std::string get_private_spend_key() const override
Definition monero_wallet_full.cpp:1359
void close(bool save=false) override
Definition monero_wallet_full.cpp:3638
uint64_t get_daemon_max_peer_height() const override
Definition monero_wallet_full.cpp:1467
void set_subaddress_label(uint32_t account_idx, uint32_t subaddress_idx, const std::string &label="") override
Definition monero_wallet_full.cpp:1743
uint64_t get_daemon_height() const override
Definition monero_wallet_full.cpp:1459
std::string get_public_spend_key() const override
Definition monero_wallet_full.cpp:1353
std::vector< std::shared_ptr< monero_transfer > > get_transfers(const monero_transfer_query &query) const override
Definition monero_wallet_full.cpp:1878
std::vector< std::string > get_tx_notes(const std::vector< std::string > &tx_hashes) const override
Definition monero_wallet_full.cpp:3190
bool is_synced() const override
Definition monero_wallet_full.cpp:1297
bool is_closed() const override
Definition monero_wallet_full.h:255
std::string get_reserve_proof_account(uint32_t account_idx, uint64_t amount, const std::string &message) const override
Definition monero_wallet_full.cpp:3147
void set_restore_height(uint64_t restore_height) override
Definition monero_wallet_full.cpp:1454
Definition monero_wallet.h:71
Definition monero_wallet.h:123
virtual std::vector< monero_account > get_accounts() const
Definition monero_wallet.h:579
Definition monero_error.h:61
monero_message_signature_type
Definition monero_wallet_model.h:465
monero_tx_priority
Definition monero_wallet_model.h:399
monero_network_type
Definition monero_daemon_model.h:119
Definition monero_wallet_model.h:131
Definition monero_wallet_model.h:386
Definition monero_wallet_model.h:473
Definition monero_wallet_model.h:523
Definition monero_wallet_model.h:539
Definition monero_wallet_model.h:551
Definition monero_wallet_model.h:271
Definition monero_wallet_model.h:112
Definition monero_wallet_model.h:98
Definition monero_wallet_model.h:226
Definition monero_wallet_model.h:409
Definition monero_wallet_model.h:331
Definition monero_wallet_model.h:370
Definition monero_daemon_model.h:142
Definition monero_wallet_model.h:68
Definition monero_wallet_full.cpp:596