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_transfer>> get_transfers_aux(
const monero_transfer_query& query)
const;
281 std::vector<std::shared_ptr<monero_output_wallet>> get_outputs_aux(
const monero_output_query& query)
const;
282 std::vector<std::shared_ptr<monero_tx_wallet>> sweep_account(
const monero_tx_config& config);
284 void assert_not_closed()
const;
287 struct sync_op_lock {
289 sync_op_lock(
const sync_op_lock&) =
delete;
295 mutable std::atomic<bool> m_is_synced;
296 mutable std::atomic<bool> m_is_connected;
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_rescan_on_sync;
302 std::atomic<bool> m_syncing_enabled;
303 std::atomic<bool> m_sync_loop_running;
304 std::atomic<int> m_syncing_interval;
305 boost::thread m_syncing_thread;
306 boost::mutex m_syncing_mutex;
307 void run_sync_loop();
308 monero_sync_result lock_and_sync(boost::optional<uint64_t> start_height = boost::none,
bool background =
false);
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:3283
std::string get_seed() const override
Definition monero_wallet_full.cpp:1279
std::vector< std::shared_ptr< monero_output_wallet > > get_outputs(const monero_output_query &query) const override
Definition monero_wallet_full.cpp:1832
std::shared_ptr< monero_rpc_connection > get_daemon_connection() const override
Definition monero_wallet_full.cpp:1216
static bool wallet_exists(const std::string &path)
Definition monero_wallet_full.cpp:941
std::string get_tx_note(const std::string &tx_hash) const override
Definition monero_wallet_full.cpp:3089
monero_version get_version() const override
Definition monero_wallet_full.cpp:1261
uint64_t get_restore_height() const override
Definition monero_wallet_full.cpp:1407
std::string get_private_view_key() const override
Definition monero_wallet_full.cpp:1306
std::string prepare_multisig() override
Definition monero_wallet_full.cpp:3370
std::string get_public_view_key() const override
Definition monero_wallet_full.cpp:1300
std::vector< monero_address_book_entry > get_address_book_entries(const std::vector< uint64_t > &indices) const override
Definition monero_wallet_full.cpp:3128
monero_account get_account(const uint32_t account_idx, bool include_subaddresses) const override
Definition monero_wallet_full.cpp:1621
std::vector< std::shared_ptr< monero_tx_wallet > > sweep_dust(bool relay=false) override
Definition monero_wallet_full.cpp:2465
void set_attribute(const std::string &key, const std::string &val) override
Definition monero_wallet_full.cpp:3278
void set_tx_notes(const std::vector< std::string > &tx_hashes, const std::vector< std::string > ¬es) override
Definition monero_wallet_full.cpp:3119
void stop_syncing() override
Definition monero_wallet_full.cpp:1518
std::string get_path() const override
Definition monero_wallet_full.cpp:1269
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:1656
void set_tx_note(const std::string &tx_hash, const std::string ¬e) override
Definition monero_wallet_full.cpp:3108
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:949
monero_multisig_sign_result sign_multisig_tx_hex(const std::string &multisig_tx_hex) override
Definition monero_wallet_full.cpp:3449
void freeze_output(const std::string &key_image) override
Definition monero_wallet_full.cpp:1921
std::vector< std::string > relay_txs(const std::vector< std::string > &tx_metadatas) override
Definition monero_wallet_full.cpp:2568
int import_multisig_hex(const std::vector< std::string > &multisig_hexes, const bool refresh_after_import=true) override
Definition monero_wallet_full.cpp:3419
monero_subaddress create_subaddress(uint32_t account_idx, const std::string &label="") override
Definition monero_wallet_full.cpp:1666
std::shared_ptr< monero_key_image_export_result > export_key_images(bool all=false) const override
Definition monero_wallet_full.cpp:1874
void rescan_blockchain() override
Definition monero_wallet_full.cpp:1554
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:1174
void rescan_spent() override
Definition monero_wallet_full.cpp:1544
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:2847
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:981
std::string get_tx_key(const std::string &tx_hash) const override
Definition monero_wallet_full.cpp:2888
void thaw_output(const std::string &key_image) override
Definition monero_wallet_full.cpp:1930
uint64_t get_unlocked_balance() const override
Definition monero_wallet_full.cpp:1581
monero_subaddress get_address_index(const std::string &address) const override
Definition monero_wallet_full.cpp:1332
std::vector< std::string > submit_txs(const std::string &signed_tx_hex) override
Definition monero_wallet_full.cpp:2819
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:1892
std::vector< std::shared_ptr< monero_tx_wallet > > create_txs(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:1953
std::shared_ptr< monero_tx_config > parse_payment_uri(const std::string &uri) const override
Definition monero_wallet_full.cpp:3244
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:3067
std::vector< std::string > submit_multisig_tx_hex(const std::string &signed_multisig_tx_hex) override
Definition monero_wallet_full.cpp:3495
std::string get_spend_proof(const std::string &tx_hash, const std::string &message) const override
Definition monero_wallet_full.cpp:3017
uint64_t get_height_by_date(uint16_t year, uint8_t month, uint8_t day) const override
Definition monero_wallet_full.cpp:1436
std::string export_outputs(bool all=false) const override
Definition monero_wallet_full.cpp:1854
monero_integrated_address decode_integrated_address(const std::string &integrated_address) const override
Definition monero_wallet_full.cpp:1385
monero_tx_set sign_txs(const std::string &unsigned_tx_hex) override
Definition monero_wallet_full.cpp:2778
std::vector< std::shared_ptr< monero_tx_wallet > > get_txs() const override
Definition monero_wallet_full.cpp:1696
std::vector< std::shared_ptr< monero_tx_wallet > > sweep_unlocked(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2114
monero_tx_set describe_tx_set(const monero_tx_set &tx_set) override
Definition monero_wallet_full.cpp:2618
int import_outputs(const std::string &outputs_hex) override
Definition monero_wallet_full.cpp:1860
std::string get_payment_uri(const monero_tx_config &config) const override
Definition monero_wallet_full.cpp:3220
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:2984
void start_syncing(uint64_t sync_period_in_ms) override
Definition monero_wallet_full.cpp:1508
void add_listener(monero_wallet_listener &listener) override
Definition monero_wallet_full.cpp:1441
void save() override
Definition monero_wallet_full.cpp:3556
bool is_output_frozen(const std::string &key_image) override
Definition monero_wallet_full.cpp:1939
bool is_daemon_synced() const override
Definition monero_wallet_full.cpp:1243
bool is_multisig_import_needed() const override
Definition monero_wallet_full.cpp:3358
std::string get_reserve_proof_wallet(const std::string &message) const override
Definition monero_wallet_full.cpp:3049
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:2854
std::shared_ptr< monero_tx_wallet > sweep_output(const monero_tx_config &config) override
Definition monero_wallet_full.cpp:2319
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:2965
void stop_mining() override
Definition monero_wallet_full.cpp:3314
bool get_attribute(const std::string &key, std::string &value) const override
Definition monero_wallet_full.cpp:3273
~monero_wallet_full()
Definition monero_wallet_full.cpp:1182
bool is_daemon_trusted() const override
Definition monero_wallet_full.cpp:1250
monero_tx_priority get_default_fee_priority() const override
Definition monero_wallet_full.cpp:1948
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:2914
void scan_txs(const std::vector< std::string > &tx_hashes) override
Definition monero_wallet_full.cpp:1524
std::string get_address(const uint32_t account_idx, const uint32_t subaddress_idx) const override
Definition monero_wallet_full.cpp:1327
std::set< monero_wallet_listener * > get_listeners() override
Definition monero_wallet_full.cpp:1453
bool check_spend_proof(const std::string &tx_hash, const std::string &message, const std::string &signature) const override
Definition monero_wallet_full.cpp:3032
void delete_address_book_entry(uint64_t index) override
Definition monero_wallet_full.cpp:3213
uint64_t add_address_book_entry(const std::string &address, const std::string &description) override
Definition monero_wallet_full.cpp:3161
std::string get_keys_file_buffer(const epee::wipeable_string &password, bool view_only) const
Definition monero_wallet_full.cpp:3563
bool is_connected_to_daemon() const override
Definition monero_wallet_full.cpp:1234
void change_password(const std::string &old_password, const std::string &new_password) override
Definition monero_wallet_full.cpp:3539
uint64_t wait_for_next_block() override
Definition monero_wallet_full.cpp:3325
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:1187
monero_multisig_info get_multisig_info() const override
Definition monero_wallet_full.cpp:3363
uint64_t get_balance() const override
Definition monero_wallet_full.cpp:1564
monero_integrated_address get_integrated_address(const std::string &standard_address="", const std::string &payment_id="") const override
Definition monero_wallet_full.cpp:1354
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:964
void move_to(const std::string &path, const std::string &password) override
Definition monero_wallet_full.cpp:3549
monero_multisig_init_result exchange_multisig_keys(const std::vector< std::string > &multisig_hexes, const std::string &password) override
Definition monero_wallet_full.cpp:3386
std::string get_seed_language() const override
Definition monero_wallet_full.cpp:1294
std::string make_multisig(const std::vector< std::string > &multisig_hexes, int threshold, const std::string &password) override
Definition monero_wallet_full.cpp:3378
monero_network_type get_network_type() const override
Definition monero_wallet_full.cpp:1274
monero_account create_account(const std::string &label="") override
Definition monero_wallet_full.cpp:1639
monero_sync_result sync() override
Definition monero_wallet_full.cpp:1458
std::string export_multisig_hex() override
Definition monero_wallet_full.cpp:3410
void remove_listener(monero_wallet_listener &listener) override
Definition monero_wallet_full.cpp:1447
uint64_t get_height() const override
Definition monero_wallet_full.cpp:1402
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:3179
std::string get_private_spend_key() const override
Definition monero_wallet_full.cpp:1318
void close(bool save=false) override
Definition monero_wallet_full.cpp:3581
uint64_t get_daemon_max_peer_height() const override
Definition monero_wallet_full.cpp:1426
void set_subaddress_label(uint32_t account_idx, uint32_t subaddress_idx, const std::string &label="") override
Definition monero_wallet_full.cpp:1688
uint64_t get_daemon_height() const override
Definition monero_wallet_full.cpp:1417
std::string get_public_spend_key() const override
Definition monero_wallet_full.cpp:1312
std::vector< std::shared_ptr< monero_transfer > > get_transfers(const monero_transfer_query &query) const override
Definition monero_wallet_full.cpp:1810
std::vector< std::string > get_tx_notes(const std::vector< std::string > &tx_hashes) const override
Definition monero_wallet_full.cpp:3100
bool is_synced() const override
Definition monero_wallet_full.cpp:1256
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:3057
void set_restore_height(uint64_t restore_height) override
Definition monero_wallet_full.cpp:1412
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:444
monero_tx_priority
Definition monero_wallet_model.h:381
monero_network_type
Definition monero_daemon_model.h:117
Definition monero_wallet_model.h:127
Definition monero_wallet_model.h:369
Definition monero_wallet_model.h:452
Definition monero_wallet_model.h:497
Definition monero_wallet_model.h:512
Definition monero_wallet_model.h:523
Definition monero_wallet_model.h:259
Definition monero_wallet_model.h:109
Definition monero_wallet_model.h:97
Definition monero_wallet_model.h:216
Definition monero_wallet_model.h:391
Definition monero_wallet_model.h:313
Definition monero_wallet_model.h:353
Definition monero_daemon_model.h:140
Definition monero_wallet_model.h:68
Definition monero_wallet_full.cpp:592