From 78b705c8fe2161fc165628ab3453a35018c2c8bb Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 11 Jan 2020 08:23:11 -0500 Subject: [PATCH] revert order of core wallet constructor args --- src/wallet/monero_wallet_core.cpp | 10 +++++----- src/wallet/monero_wallet_core.h | 29 ++++++++++++++--------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/wallet/monero_wallet_core.cpp b/src/wallet/monero_wallet_core.cpp index 175cd22..24ca589 100644 --- a/src/wallet/monero_wallet_core.cpp +++ b/src/wallet/monero_wallet_core.cpp @@ -798,7 +798,7 @@ namespace monero { return wallet_file_exists; } - monero_wallet_core* monero_wallet_core::open_wallet(const monero_network_type network_type, const string& path, const string& password) { + monero_wallet_core* monero_wallet_core::open_wallet(const string& path, const string& password, const monero_network_type network_type) { MTRACE("open_wallet(" << path << ", " << password << ", " << network_type << ")"); monero_wallet_core* wallet = new monero_wallet_core(); wallet->m_w2 = unique_ptr(new tools::wallet2(static_cast(network_type), 1, true)); @@ -808,7 +808,7 @@ namespace monero { return wallet; } - monero_wallet_core* monero_wallet_core::open_wallet(const monero_network_type network_type, const string& keys_data, const string& cache_data, const string& password, const monero_rpc_connection& daemon_connection, shared_ptr http_client) { + 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, shared_ptr http_client) { MTRACE("open_wallet(...buffers...)"); cout << "open_wallet(...buffers...)" << endl; monero_wallet_core* wallet = new monero_wallet_core(); @@ -821,7 +821,7 @@ namespace monero { return wallet; } - monero_wallet_core* monero_wallet_core::create_wallet_random(const monero_network_type network_type, const string& password, const string& path, const monero_rpc_connection& daemon_connection, const string& language, shared_ptr http_client) { + 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, shared_ptr http_client) { MTRACE("create_wallet_random(path, password, network_type, daemon_connection, language)"); monero_wallet_core* wallet = new monero_wallet_core(); if (http_client == nullptr) wallet->m_w2 = unique_ptr(new tools::wallet2(static_cast(network_type), 1, true)); @@ -835,7 +835,7 @@ namespace monero { return wallet; } - monero_wallet_core* monero_wallet_core::create_wallet_from_mnemonic(const monero_network_type network_type, const string& mnemonic, const string& password, const string& path, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& seed_offset, shared_ptr http_client) { + 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, shared_ptr http_client) { MTRACE("create_wallet_from_mnemonic(path, password, mnemonic, network_type, daemon_connection, restore_height)"); monero_wallet_core* wallet = new monero_wallet_core(); @@ -860,7 +860,7 @@ namespace monero { return wallet; } - monero_wallet_core* monero_wallet_core::create_wallet_from_keys(const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const string& password, const string& path, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& language) { + 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(); diff --git a/src/wallet/monero_wallet_core.h b/src/wallet/monero_wallet_core.h index 1da73f9..5c627fb 100644 --- a/src/wallet/monero_wallet_core.h +++ b/src/wallet/monero_wallet_core.h @@ -91,71 +91,70 @@ namespace monero { /** * Open an existing wallet from disk. * - * @param network_type is the wallet's network type * @param path is the path to the wallet file to open * @param password is the password of the wallet file to open + * @param network_type is the wallet's network type * @return a pointer to the wallet instance */ - static monero_wallet_core* open_wallet(const monero_network_type network_type, const string& path, const string& password); + static monero_wallet_core* open_wallet(const string& path, const string& password, const monero_network_type network_type); /** - * Open an existing wallet from data buffers. + * 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 password is the password of the wallet file to open * @param daemon_connection is connection information to a daemon (default = an unconnected wallet) * @param http_client allows the http client to be overriden (defaults to monero-project's http_client.h) * @return a pointer to the wallet instance */ - static monero_wallet_core* open_wallet(const monero_network_type, const string& keys_data, const string& cache_data, const string& password, const monero_rpc_connection& daemon_connection = monero_rpc_connection(), shared_ptr http_client = nullptr); + 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(), shared_ptr http_client = nullptr); /** * Create a new wallet with a randomly generated seed. * - * @param network_type is the wallet's network type's + * @param path is the path to create the wallet ("" for an in-memory wallet) * @param password is the password encrypt the wallet - * @param path is the path to create the wallet (defaults to in-memory wallet with path "") + * @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 allows the http client to be overriden (defaults to monero-project's http_client.h) * @return a pointer to the wallet instance */ - static monero_wallet_core* create_wallet_random(const monero_network_type network_type, const string& password, const string& path = "", const monero_rpc_connection& daemon_connection = monero_rpc_connection(), const string& language = "English", shared_ptr http_client = 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", shared_ptr http_client = nullptr); /** * Create a wallet from an existing mnemonic phrase. * - * @param network_type is the wallet's network type + * @param path is the path to create the wallet ("" for an in-memory wallet) + * @param password is the password encrypt the wallet * @param network_type is the wallet's network type * @param mnemonic is the mnemonic of the wallet to construct - * @param password is the password encrypt the wallet - * @param path is the path to create the wallet (defaults to in-memory wallet with path "") * @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 allows the http client to be overriden (defaults to monero-project's http_client.h) * @return a pointer to the wallet instance */ - static monero_wallet_core* create_wallet_from_mnemonic(const monero_network_type network_type, const string& mnemonic, const string& password, const string& path = "", const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& seed_offset = "", shared_ptr http_client = 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 = "", shared_ptr http_client = nullptr); /** * Create a wallet from an address, view key, and spend key. * + * @param path is the path to create the wallet ("" for an in-memory wallet) + * @param password is the password encrypt the wallet (defaults to in-memory wallet with password "") * @param network_type is the wallet's network type * @param address is the address of the wallet to construct * @param view_key is the private view key of the wallet to construct * @param spend_key is the private spend key of the wallet to construct - * @param password is the password encrypt the wallet (defaults to in-memory wallet with password "") - * @param path is the path to create the wallet (defaults to in-memory wallet with path "") * @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") * @return a pointer to the wallet instance */ - static monero_wallet_core* create_wallet_from_keys(const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const string& password, const string& path = "", const monero_rpc_connection& daemon_connection = monero_rpc_connection(), uint64_t restore_height = 0, const string& language = "English"); + 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.