55#include <boost/optional.hpp>
56#include <boost/thread/mutex.hpp>
57#include <boost/thread/thread.hpp>
58#include <boost/thread/condition_variable.hpp>
61#include "monero_wallet.h"
62#include "wallet/wallet2.h"
114 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);
143 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;
144 void set_daemon_connection(
const std::shared_ptr<monero_rpc_connection>& connection,
const boost::optional<bool>& is_trusted = boost::none)
override;
151 std::string
get_path()
const override;
153 std::string
get_seed()
const override;
159 std::string
get_address(
const uint32_t account_idx,
const uint32_t subaddress_idx)
const override;
168 uint64_t
get_height_by_date(uint16_t year, uint8_t month, uint8_t day)
const override;
178 void scan_txs(
const std::vector<std::string>& tx_hashes)
override;
182 uint64_t
get_balance(uint32_t account_idx)
const override;
183 uint64_t
get_balance(uint32_t account_idx, uint32_t subaddress_idx)
const override;
187 std::vector<monero_account>
get_accounts(
bool include_subaddresses,
const std::string& tag)
const override;
190 std::vector<monero_subaddress>
get_subaddresses(
const uint32_t account_idx,
const std::vector<uint32_t>& subaddress_indices)
const override;
192 void set_subaddress_label(uint32_t account_idx, uint32_t subaddress_idx,
const std::string& label =
"")
override;
193 std::vector<std::shared_ptr<monero_tx_wallet>>
get_txs()
const override;
199 std::shared_ptr<monero_key_image_export_result>
export_key_images(
bool all =
false)
const override;
200 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;
202 void thaw_output(
const std::string& key_image)
override;
208 std::vector<std::shared_ptr<monero_tx_wallet>>
sweep_dust(
bool relay =
false)
override;
209 std::vector<std::string>
relay_txs(
const std::vector<std::string>& tx_metadatas)
override;
212 std::vector<std::string>
submit_txs(
const std::string& signed_tx_hex)
override;
215 std::string
get_tx_key(
const std::string& tx_hash)
const override;
216 std::shared_ptr<monero_check_tx>
check_tx_key(
const std::string& tx_hash,
const std::string& txKey,
const std::string& address)
const override;
217 std::string
get_tx_proof(
const std::string& tx_hash,
const std::string& address,
const std::string& message)
const override;
218 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;
219 std::string
get_spend_proof(
const std::string& tx_hash,
const std::string& message)
const override;
220 bool check_spend_proof(
const std::string& tx_hash,
const std::string& message,
const std::string& signature)
const override;
223 std::shared_ptr<monero_check_reserve>
check_reserve_proof(
const std::string& address,
const std::string& message,
const std::string& signature)
const override;
224 std::string
get_tx_note(
const std::string& tx_hash)
const override;
225 std::vector<std::string>
get_tx_notes(
const std::vector<std::string>& tx_hashes)
const override;
226 void set_tx_note(
const std::string& tx_hash,
const std::string& note)
override;
227 void set_tx_notes(
const std::vector<std::string>& tx_hashes,
const std::vector<std::string>& notes)
override;
228 std::vector<monero_address_book_entry>
get_address_book_entries(
const std::vector<uint64_t>& indices)
const override;
230 void edit_address_book_entry(uint64_t index,
bool set_address,
const std::string& address,
bool set_description,
const std::string& description)
override;
233 std::shared_ptr<monero_tx_config>
parse_payment_uri(
const std::string& uri)
const override;
234 bool get_attribute(
const std::string& key, std::string& value)
const override;
235 void set_attribute(
const std::string& key,
const std::string& val)
override;
236 void start_mining(boost::optional<uint64_t> num_threads, boost::optional<bool> background_mining, boost::optional<bool> ignore_battery)
override;
242 std::string
make_multisig(
const std::vector<std::string>& multisig_hexes,
int threshold,
const std::string& password)
override;
245 int import_multisig_hex(
const std::vector<std::string>& multisig_hexes,
const bool refresh_after_import =
true)
override;
248 void change_password(
const std::string& old_password,
const std::string& new_password)
override;
249 void move_to(
const std::string& path,
const std::string& password)
override;
250 void save()
override;
258 std::string get_cache_file_buffer()
const;
263 std::unique_ptr<tools::wallet2> m_w2;
271 std::unique_ptr<wallet2_listener> m_w2_listener;
272 std::set<monero_wallet_listener*> m_listeners;
273 std::atomic<bool> m_is_closed;
279 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;
280 std::vector<std::shared_ptr<monero_tx_wallet>> get_txs_aux(
const monero_tx_query& query,
int max_attempts = 5)
const;
281 std::vector<std::shared_ptr<monero_transfer>> get_transfers_aux(
const monero_transfer_query& query)
const;
282 std::vector<std::shared_ptr<monero_output_wallet>> get_outputs_aux(
const monero_output_query& query)
const;
283 std::vector<std::shared_ptr<monero_tx_wallet>> sweep_account(
const monero_tx_config& config);
285 void assert_not_closed()
const;
288 struct sync_op_lock {
290 sync_op_lock(
const sync_op_lock&) =
delete;
296 mutable std::atomic<bool> m_is_synced;
297 boost::condition_variable m_sync_cv;
298 mutable boost::mutex m_sync_mutex;
299 mutable std::atomic<uint32_t> m_num_sync_pauses;
300 std::atomic<bool> m_background_syncing;
301 std::atomic<bool> m_interrupt_sync;
302 std::atomic<bool> m_sync_in_progress;
303 std::atomic<bool> m_rescan_on_sync;
304 std::atomic<bool> m_syncing_enabled;
305 std::atomic<bool> m_sync_loop_running;
306 std::atomic<int> m_syncing_interval;
307 boost::thread m_syncing_thread;
308 boost::mutex m_syncing_mutex;
309 void run_sync_loop();
310 monero_sync_result lock_and_sync(boost::optional<uint64_t> start_height = boost::none,
bool background =
false);
311 monero_sync_result sync_aux(boost::optional<uint64_t> start_height, boost::unique_lock<boost::mutex>& lock);
Definition monero_wallet_full.h:79
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:3361
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:1891
std::shared_ptr< monero_rpc_connection > get_daemon_connection() const override
Definition monero_wallet_full.cpp:1260
static bool wallet_exists(const std::string &path)
Definition monero_wallet_full.cpp:976
std::string get_tx_note(const std::string &tx_hash) const override
Definition monero_wallet_full.cpp:3167
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:3448
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:3206
monero_account get_account(const uint32_t account_idx, bool include_subaddresses) const override
Definition monero_wallet_full.cpp:1666
std::vector< std::shared_ptr< monero_tx_wallet > > sweep_dust(bool relay=false) override
Definition monero_wallet_full.cpp:2529
void set_attribute(const std::string &key, const std::string &val) override
Definition monero_wallet_full.cpp:3356
void set_tx_notes(const std::vector< std::string > &tx_hashes, const std::vector< std::string > ¬es) override
Definition monero_wallet_full.cpp:3197
void stop_syncing() override
Definition monero_wallet_full.cpp:1557
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:1702
void set_tx_note(const std::string &tx_hash, const std::string ¬e) override
Definition monero_wallet_full.cpp:3186
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:984
monero_multisig_sign_result sign_multisig_tx_hex(const std::string &multisig_tx_hex) override
Definition monero_wallet_full.cpp:3527
void freeze_output(const std::string &key_image) override
Definition monero_wallet_full.cpp:1985
std::vector< std::string > relay_txs(const std::vector< std::string > &tx_metadatas) override
Definition monero_wallet_full.cpp:2632
int import_multisig_hex(const std::vector< std::string > &multisig_hexes, const bool refresh_after_import=true) override
Definition monero_wallet_full.cpp:3497
monero_subaddress create_subaddress(uint32_t account_idx, const std::string &label="") override
Definition monero_wallet_full.cpp:1713
std::shared_ptr< monero_key_image_export_result > export_key_images(bool all=false) const override
Definition monero_wallet_full.cpp:1936
void rescan_blockchain() override
Definition monero_wallet_full.cpp:1593
bool is_view_only() const override
Definition monero_wallet_full.h:142
static std::vector< std::string > get_seed_languages()
Definition monero_wallet_full.cpp:1219
void rescan_spent() override
Definition monero_wallet_full.cpp:1584
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:2925
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:1018
std::string get_tx_key(const std::string &tx_hash) const override
Definition monero_wallet_full.cpp:2966
void thaw_output(const std::string &key_image) override
Definition monero_wallet_full.cpp:1994
uint64_t get_unlocked_balance() const override
Definition monero_wallet_full.cpp:1622
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:2897
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:1954
std::vector< std::shared_ptr< monero_tx_wallet > > create_txs(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2017
std::shared_ptr< monero_tx_config > parse_payment_uri(const std::string &uri) const override
Definition monero_wallet_full.cpp:3322
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:3145
std::vector< std::string > submit_multisig_tx_hex(const std::string &signed_multisig_tx_hex) override
Definition monero_wallet_full.cpp:3573
std::string get_spend_proof(const std::string &tx_hash, const std::string &message) const override
Definition monero_wallet_full.cpp:3095
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:1916
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:2856
std::vector< std::shared_ptr< monero_tx_wallet > > get_txs() const override
Definition monero_wallet_full.cpp:1743
std::vector< std::shared_ptr< monero_tx_wallet > > sweep_unlocked(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2178
monero_tx_set describe_tx_set(const monero_tx_set &tx_set) override
Definition monero_wallet_full.cpp:2682
int import_outputs(const std::string &outputs_hex) override
Definition monero_wallet_full.cpp:1922
std::string get_payment_uri(const monero_tx_config &config) const override
Definition monero_wallet_full.cpp:3298
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:3062
void start_syncing(uint64_t sync_period_in_ms) override
Definition monero_wallet_full.cpp:1548
void add_listener(monero_wallet_listener &listener) override
Definition monero_wallet_full.cpp:1481
void save() override
Definition monero_wallet_full.cpp:3634
bool is_output_frozen(const std::string &key_image) override
Definition monero_wallet_full.cpp:2003
bool is_daemon_synced() const override
Definition monero_wallet_full.cpp:1286
bool is_multisig_import_needed() const override
Definition monero_wallet_full.cpp:3436
std::string get_reserve_proof_wallet(const std::string &message) const override
Definition monero_wallet_full.cpp:3127
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:2932
std::shared_ptr< monero_tx_wallet > sweep_output(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2383
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:3043
void stop_mining() override
Definition monero_wallet_full.cpp:3392
bool get_attribute(const std::string &key, std::string &value) const override
Definition monero_wallet_full.cpp:3351
~monero_wallet_full()
Definition monero_wallet_full.cpp:1227
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:2012
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:2992
void scan_txs(const std::vector< std::string > &tx_hashes) override
Definition monero_wallet_full.cpp:1564
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:1493
bool check_spend_proof(const std::string &tx_hash, const std::string &message, const std::string &signature) const override
Definition monero_wallet_full.cpp:3110
void delete_address_book_entry(uint64_t index) override
Definition monero_wallet_full.cpp:3291
uint64_t add_address_book_entry(const std::string &address, const std::string &description) override
Definition monero_wallet_full.cpp:3239
std::string get_keys_file_buffer(const epee::wipeable_string &password, bool view_only) const
Definition monero_wallet_full.cpp:3641
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:3617
uint64_t wait_for_next_block() override
Definition monero_wallet_full.cpp:3403
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:1232
monero_multisig_info get_multisig_info() const override
Definition monero_wallet_full.cpp:3441
uint64_t get_balance() const override
Definition monero_wallet_full.cpp:1602
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:1000
void move_to(const std::string &path, const std::string &password) override
Definition monero_wallet_full.cpp:3627
monero_multisig_init_result exchange_multisig_keys(const std::vector< std::string > &multisig_hexes, const std::string &password) override
Definition monero_wallet_full.cpp:3464
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:3456
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:1685
monero_sync_result sync() override
Definition monero_wallet_full.cpp:1498
std::string export_multisig_hex() override
Definition monero_wallet_full.cpp:3488
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:3257
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:3659
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:1735
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:1866
std::vector< std::string > get_tx_notes(const std::vector< std::string > &tx_hashes) const override
Definition monero_wallet_full.cpp:3178
bool is_synced() const override
Definition monero_wallet_full.cpp:1297
bool is_closed() const override
Definition monero_wallet_full.h:252
std::string get_reserve_proof_account(uint32_t account_idx, uint64_t amount, const std::string &message) const override
Definition monero_wallet_full.cpp:3135
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:594