mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 15:21:30 +02:00
remove wasm support until pr merged into monero core
remove http client factory and load from cache wasm modifications available on `wasm_modifications` branch
This commit is contained in:
@@ -809,24 +809,10 @@ namespace monero {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
monero_wallet_core* monero_wallet_core::open_wallet(const string& password, const monero_network_type network_type, const string& keys_data, const string& cache_data, const monero_rpc_connection& daemon_connection, unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory) {
|
||||
MTRACE("open_wallet(...buffers...)");
|
||||
cout << "open_wallet(...buffers...)" << endl;
|
||||
monero_wallet_core* wallet = new monero_wallet_core();
|
||||
if (http_client_factory == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client_factory)));
|
||||
wallet->m_w2->load("", password, keys_data, cache_data);
|
||||
wallet->m_w2->init("");
|
||||
wallet->set_daemon_connection(daemon_connection);
|
||||
wallet->init_common();
|
||||
return wallet;
|
||||
}
|
||||
|
||||
monero_wallet_core* monero_wallet_core::create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection, const string& language, unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory) {
|
||||
monero_wallet_core* monero_wallet_core::create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection, const string& language) {
|
||||
MTRACE("create_wallet_random(path, password, network_type, daemon_connection, language)");
|
||||
monero_wallet_core* wallet = new monero_wallet_core();
|
||||
if (http_client_factory == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client_factory)));
|
||||
wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
wallet->set_daemon_connection(daemon_connection);
|
||||
wallet->m_w2->set_seed_language(language);
|
||||
crypto::secret_key secret_key;
|
||||
@@ -836,7 +822,7 @@ namespace monero {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
monero_wallet_core* monero_wallet_core::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& seed_offset, unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory) {
|
||||
monero_wallet_core* monero_wallet_core::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& seed_offset) {
|
||||
MTRACE("create_wallet_from_mnemonic(path, password, mnemonic, network_type, daemon_connection, restore_height)");
|
||||
monero_wallet_core* wallet = new monero_wallet_core();
|
||||
|
||||
@@ -851,8 +837,7 @@ namespace monero {
|
||||
if (!seed_offset.empty()) recovery_key = cryptonote::decrypt_key(recovery_key, seed_offset);
|
||||
|
||||
// initialize wallet
|
||||
if (http_client_factory == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client_factory)));
|
||||
wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
wallet->set_daemon_connection(daemon_connection);
|
||||
wallet->m_w2->set_seed_language(language);
|
||||
wallet->m_w2->generate(path, password, recovery_key, true, false);
|
||||
@@ -861,7 +846,7 @@ namespace monero {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
monero_wallet_core* monero_wallet_core::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, unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory) {
|
||||
monero_wallet_core* monero_wallet_core::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) {
|
||||
MTRACE("create_wallet_from_keys(path, password, address, view_key, spend_key, network_type, daemon_connection, restore_height, language)");
|
||||
monero_wallet_core* wallet = new monero_wallet_core();
|
||||
|
||||
@@ -908,8 +893,7 @@ namespace monero {
|
||||
}
|
||||
|
||||
// initialize wallet
|
||||
if (http_client_factory == nullptr) wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
else wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true, std::move(http_client_factory)));
|
||||
wallet->m_w2 = unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(network_type), 1, true));
|
||||
if (has_spend_key && has_view_key) wallet->m_w2->generate(path, password, info.address, spend_key_sk, view_key_sk);
|
||||
else if (has_spend_key) wallet->m_w2->generate(path, password, spend_key_sk, true, false);
|
||||
else wallet->m_w2->generate(path, password, info.address, view_key_sk);
|
||||
@@ -3200,20 +3184,6 @@ namespace monero {
|
||||
m_w2->store_to(path, password);
|
||||
}
|
||||
|
||||
std::string monero_wallet_core::get_keys_file_buffer(const epee::wipeable_string& password, bool watch_only) const {
|
||||
boost::optional<wallet2::keys_file_data> keys_file_data = m_w2->get_keys_file_data(password, watch_only);
|
||||
std::string buf;
|
||||
::serialization::dump_binary(keys_file_data.get(), buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::string monero_wallet_core::get_cache_file_buffer(const epee::wipeable_string& password) const {
|
||||
boost::optional<wallet2::cache_file_data> cache_file_data = m_w2->get_cache_file_data(password);
|
||||
std::string buf;
|
||||
::serialization::dump_binary(cache_file_data.get(), buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
void monero_wallet_core::close(bool save) {
|
||||
MTRACE("close()");
|
||||
if (save) this->save();
|
||||
|
||||
@@ -98,21 +98,6 @@ namespace monero {
|
||||
*/
|
||||
static monero_wallet_core* open_wallet(const string& path, const string& password, const monero_network_type network_type);
|
||||
|
||||
/**
|
||||
* Open an in-memory wallet from existing data buffers.
|
||||
*
|
||||
* TODO: support path = "" which autosaves?
|
||||
*
|
||||
* @param password is the password of the wallet file to open
|
||||
* @param network_type is the wallet's network type
|
||||
* @param keys_data contains the contents of the ".keys" file
|
||||
* @param cache_data contains the contents of the wallet cache file (no extension)
|
||||
* @param daemon_connection is connection information to a daemon (default = an unconnected wallet)
|
||||
* @param http_client_factory allows use of custom http clients
|
||||
* @return a pointer to the wallet instance
|
||||
*/
|
||||
static monero_wallet_core* open_wallet(const string& password, const monero_network_type, const string& keys_data, const string& cache_data, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory = nullptr);
|
||||
|
||||
/**
|
||||
* Create a new wallet with a randomly generated seed.
|
||||
*
|
||||
@@ -121,10 +106,9 @@ namespace monero {
|
||||
* @param network_type is the wallet's network type's
|
||||
* @param daemon_connection is connection information to a daemon (defaults to an unconnected wallet)
|
||||
* @param language is the wallet and mnemonic's language (defaults to "English")
|
||||
* @param http_client_factory allows use of custom http clients
|
||||
* @return a pointer to the wallet instance
|
||||
*/
|
||||
static monero_wallet_core* create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), const string& language = "English", unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory = nullptr);
|
||||
static monero_wallet_core* create_wallet_random(const string& path, const string& password, const monero_network_type network_type, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), const string& language = "English");
|
||||
|
||||
/**
|
||||
* Create a wallet from an existing mnemonic phrase.
|
||||
@@ -135,10 +119,9 @@ namespace monero {
|
||||
* @param daemon_connection is connection information to a daemon (defaults to an unconnected wallet)
|
||||
* @param restore_height is the block height to restore from (default = 0)
|
||||
* @param seed_offset is the offset used to derive a new seed from the given mnemonic to recover a secret wallet from the mnemonic phrase (default = "")
|
||||
* @param http_client_factory allows use of custom http clients
|
||||
* @return a pointer to the wallet instance
|
||||
*/
|
||||
static monero_wallet_core* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& seed_offset = "", unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory = nullptr);
|
||||
static monero_wallet_core* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type network_type, const string& mnemonic, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& seed_offset = "");
|
||||
|
||||
/**
|
||||
* Create a wallet from an address, view key, and spend key.
|
||||
@@ -152,10 +135,9 @@ namespace monero {
|
||||
* @param daemon_connection is connection information to a daemon (defaults to an unconnected wallet)
|
||||
* @param restore_height is the block height to restore (i.e. scan the chain) from (default = 0)
|
||||
* @param language is the wallet and mnemonic's language (defaults to "English")
|
||||
* @param http_client_factory allows use of custom http clients
|
||||
* @return a pointer to the wallet instance
|
||||
*/
|
||||
static monero_wallet_core* 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 = monero_rpc_connection(), uint64_t restore_height = 0, const string& language = "English", unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory = nullptr);
|
||||
static monero_wallet_core* 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 = monero_rpc_connection(), uint64_t restore_height = 0, const string& language = "English");
|
||||
|
||||
/**
|
||||
* Get a list of available languages for the wallet's mnemonic phrase.
|
||||
@@ -288,12 +270,6 @@ namespace monero {
|
||||
void move_to(string path, string password);
|
||||
void close(bool save = false);
|
||||
|
||||
/**
|
||||
* Wallet import and export using buffers and not the file system.
|
||||
*/
|
||||
std::string get_keys_file_buffer(const epee::wipeable_string& password, bool watch_only) const;
|
||||
std::string get_cache_file_buffer(const epee::wipeable_string& password) const;
|
||||
|
||||
// --------------------------------- PRIVATE --------------------------------
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user