From fb92fcdb657429fe48bc9cdd390c63bc9d9745b3 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 3 Aug 2019 13:41:52 -0400 Subject: [PATCH] net_type -> nettype --- src/wallet/monero_wallet.cpp | 38 ++++++++++++++++++------------------ src/wallet/monero_wallet.h | 22 ++++++++++----------- test/scratchpad.cpp | 14 ++++++------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/wallet/monero_wallet.cpp b/src/wallet/monero_wallet.cpp index 17afc1c..2479221 100644 --- a/src/wallet/monero_wallet.cpp +++ b/src/wallet/monero_wallet.cpp @@ -791,10 +791,10 @@ namespace monero { return wallet_file_exists; } - monero_wallet* monero_wallet::open_wallet(const string& path, const string& password, const monero_network_type net_type) { - MTRACE("open_wallet(" << path << ", " << password << ", " << net_type << ")"); + monero_wallet* monero_wallet::open_wallet(const string& path, const string& password, const monero_network_type nettype) { + MTRACE("open_wallet(" << path << ", " << password << ", " << nettype << ")"); monero_wallet* wallet = new monero_wallet(); - wallet->w2 = unique_ptr(new tools::wallet2(static_cast(net_type), 1, true)); + wallet->w2 = unique_ptr(new tools::wallet2(static_cast(nettype), 1, true)); wallet->w2->load(path, password); wallet->w2->init(""); wallet->init_common(); @@ -806,10 +806,10 @@ namespace monero { throw runtime_error("Not implemented"); } - monero_wallet* monero_wallet::create_wallet_random(const string& path, const string& password, const monero_network_type net_type, const monero_rpc_connection& daemon_connection, const string& language) { - MTRACE("create_wallet_random(path, password, net_type, daemon_connection, language)"); + monero_wallet* monero_wallet::create_wallet_random(const string& path, const string& password, const monero_network_type nettype, const monero_rpc_connection& daemon_connection, const string& language) { + MTRACE("create_wallet_random(path, password, nettype, daemon_connection, language)"); monero_wallet* wallet = new monero_wallet(); - wallet->w2 = unique_ptr(new tools::wallet2(static_cast(net_type), 1, true)); + wallet->w2 = unique_ptr(new tools::wallet2(static_cast(nettype), 1, true)); wallet->set_daemon_connection(daemon_connection); wallet->w2->set_seed_language(language); crypto::secret_key secret_key; @@ -818,13 +818,13 @@ namespace monero { return wallet; } - monero_wallet* monero_wallet::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type net_type, const string& mnemonic) { - MTRACE("create_wallet_from_mnemonic(path, password, net_type, mnemonic)"); + monero_wallet* monero_wallet::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type nettype, const string& mnemonic) { + MTRACE("create_wallet_from_mnemonic(path, password, nettype, mnemonic)"); throw runtime_error("Not implemented"); } - monero_wallet* monero_wallet::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type net_type, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height) { - MTRACE("create_wallet_from_mnemonic(path, password, mnemonic, net_type, daemon_connection, restore_height)"); + monero_wallet* monero_wallet::create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type nettype, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height) { + MTRACE("create_wallet_from_mnemonic(path, password, mnemonic, nettype, daemon_connection, restore_height)"); monero_wallet* wallet = new monero_wallet(); // validate mnemonic and get recovery key and language @@ -835,7 +835,7 @@ namespace monero { if (language == crypto::ElectrumWords::old_language_name) language = Language::English().get_language_name(); // initialize wallet - wallet->w2 = unique_ptr(new tools::wallet2(static_cast(net_type), 1, true)); + wallet->w2 = unique_ptr(new tools::wallet2(static_cast(nettype), 1, true)); wallet->set_daemon_connection(daemon_connection); wallet->w2->set_seed_language(language); wallet->w2->generate(path, password, recoveryKey, true, false); @@ -844,23 +844,23 @@ namespace monero { return wallet; } - monero_wallet* monero_wallet::create_wallet_from_keys(const string& path, const string& password, const monero_network_type net_type, const string& address, const string& view_key, const string& spend_key) { - MTRACE("create_wallet_from_keys(path, password, address, view_key, spend_key, net_type)"); + monero_wallet* monero_wallet::create_wallet_from_keys(const string& path, const string& password, const monero_network_type nettype, const string& address, const string& view_key, const string& spend_key) { + MTRACE("create_wallet_from_keys(path, password, address, view_key, spend_key, nettype)"); throw runtime_error("Not implemented"); } - monero_wallet* monero_wallet::create_wallet_from_keys(const string& path, const string& password, const monero_network_type net_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height) { - MTRACE("create_wallet_from_keys(path, password, address, view_key, spend_key, net_type, daemon_connection, restore_height)"); + monero_wallet* monero_wallet::create_wallet_from_keys(const string& path, const string& password, const monero_network_type nettype, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height) { + MTRACE("create_wallet_from_keys(path, password, address, view_key, spend_key, nettype, daemon_connection, restore_height)"); throw runtime_error("Not implemented"); } - monero_wallet* monero_wallet::create_wallet_from_keys(const string& path, const string& password, const monero_network_type net_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, net_type, daemon_connection, restore_height, language)"); + monero_wallet* monero_wallet::create_wallet_from_keys(const string& path, const string& password, const monero_network_type nettype, 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, nettype, daemon_connection, restore_height, language)"); monero_wallet* wallet = new monero_wallet(); // validate and parse address cryptonote::address_parse_info info; - if (!get_account_address_from_str(info, static_cast(net_type), address)) throw runtime_error("failed to parse address"); + if (!get_account_address_from_str(info, static_cast(nettype), address)) throw runtime_error("failed to parse address"); // validate and parse optional private spend key crypto::secret_key spend_key_sk; @@ -901,7 +901,7 @@ namespace monero { } // initialize wallet - wallet->w2 = unique_ptr(new tools::wallet2(static_cast(net_type), 1, true)); + wallet->w2 = unique_ptr(new tools::wallet2(static_cast(nettype), 1, true)); if (has_spend_key && has_view_key) wallet->w2->generate(path, password, info.address, spend_key_sk, view_key_sk); if (!has_spend_key && has_view_key) wallet->w2->generate(path, password, info.address, view_key_sk); if (has_spend_key && !has_view_key) wallet->w2->generate(path, password, spend_key_sk, true, false); diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index aa8ec12..6350564 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -141,41 +141,41 @@ namespace monero { * * @param path is the path to the wallet file to open * @param password is the password of the wallet file to open - * @param net_type is the wallet's network type + * @param nettype is the wallet's network type */ - static monero_wallet* open_wallet(const string& path, const string& password, const monero_network_type net_type); + static monero_wallet* open_wallet(const string& path, const string& password, const monero_network_type nettype); /** * Create a new wallet with a randomly generated seed. * * @param path is the path to create the wallet * @param password is the password encrypt the wallet - * @param net_type is the wallet's network type (default = monero_network_type.MAINNET) + * @param nettype is the wallet's network type (default = monero_network_type.MAINNET) * @param daemon_connection is connection information to a daemon (default = an unconnected wallet) * @param language is the wallet and mnemonic's language (default = "English") */ static monero_wallet* create_wallet_random(const string& path, const string& password); - static monero_wallet* create_wallet_random(const string& path, const string& password, const monero_network_type net_type, const monero_rpc_connection& daemon_connection, const string& language); + static monero_wallet* create_wallet_random(const string& path, const string& password, const monero_network_type nettype, const monero_rpc_connection& daemon_connection, const string& language); /** * Create a wallet from an existing mnemonic phrase. * * @param path is the path to create the wallet * @param password is the password encrypt the wallet - * @param net_type is the wallet's network type + * @param nettype is the wallet's network type * @param mnemonic is the mnemonic of the wallet to construct * @param daemon_connection is connection information to a daemon (default = an unconnected wallet) * @param restore_height is the block height to restore (i.e. scan the chain) from (default = 0) */ - static monero_wallet* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type net_type, const string& mnemonic); - static monero_wallet* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type net_type, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height); + static monero_wallet* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type nettype, const string& mnemonic); + static monero_wallet* create_wallet_from_mnemonic(const string& path, const string& password, const monero_network_type nettype, const string& mnemonic, const monero_rpc_connection& daemon_connection, uint64_t restore_height); /** * Create a wallet from an address, view key, and spend key. * * @param path is the path to create the wallet * @param password is the password encrypt the wallet - * @param net_type is the wallet's network type + * @param nettype is the wallet's network type * @param address is the address of the wallet to construct * @param view_key is the view key of the wallet to construct * @param spend_key is the spend key of the wallet to construct @@ -183,9 +183,9 @@ namespace monero { * @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 (default = "English") */ - static monero_wallet* create_wallet_from_keys(const string& path, const string& password, const monero_network_type net_type, const string& address, const string& view_key, const string& spend_key); - static monero_wallet* create_wallet_from_keys(const string& path, const string& password, const monero_network_type net_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height); - static monero_wallet* create_wallet_from_keys(const string& path, const string& password, const monero_network_type net_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); + static monero_wallet* create_wallet_from_keys(const string& path, const string& password, const monero_network_type nettype, const string& address, const string& view_key, const string& spend_key); + static monero_wallet* create_wallet_from_keys(const string& path, const string& password, const monero_network_type nettype, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height); + static monero_wallet* create_wallet_from_keys(const string& path, const string& password, const monero_network_type nettype, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& language); /** * Deconstruct the wallet. diff --git a/test/scratchpad.cpp b/test/scratchpad.cpp index 75f454f..e8078cb 100644 --- a/test/scratchpad.cpp +++ b/test/scratchpad.cpp @@ -13,15 +13,15 @@ bool wallet_exists(string path) { return wallet_file_exists; } -void open_wallet(string path, string password, int net_type) { - cout << "open_wallet(" << path << ", " << password << ", " << net_type << ")" << endl; +void open_wallet(string path, string password, int nettype) { + cout << "open_wallet(" << path << ", " << password << ", " << nettype << ")" << endl; std::unique_ptr wallet; wallet.reset(new tools::wallet2(cryptonote::network_type::STAGENET, 1, true)); throw runtime_error("Not implemented"); } -void create_wallet_random(string language, int net_type) { - tools::wallet2* wallet = new tools::wallet2(static_cast(net_type), 1, true); +void create_wallet_random(string language, int nettype) { + tools::wallet2* wallet = new tools::wallet2(static_cast(nettype), 1, true); wallet->set_seed_language(language); crypto::secret_key recovery_val, secret_key; wallet->generate(string(""), string(""), secret_key, false, false); @@ -53,12 +53,12 @@ int main(int argc, const char* argv[]) { string path = "test_wallet_1"; string password = "supersecretpassword123"; string language = "English"; - int net_type = 2; + int nettype = 2; MINFO("Wallet exists: " << wallet_exists(path)); -// open_wallet(path, password, net_type); -// create_wallet_random(language, net_type); +// open_wallet(path, password, nettype); +// create_wallet_random(language, nettype); // // create wallet // monero_wallet* wallet = new monero_wallet();