diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 79b97ca..31656b9 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -109,22 +109,22 @@ namespace monero { return walletFileExists; } - MoneroWallet::MoneroWallet() { + MoneroWallet::MoneroWallet(const string& path, const string&password) { cout << "MoneroWallet()" << endl; throw runtime_error("Not implemented"); } - MoneroWallet::MoneroWallet(const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language) { + MoneroWallet::MoneroWallet(const string& path, const string&password, const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language) { cout << "MoneroWallet(3)" << endl; wallet2 = shared_ptr(new tools::wallet2(static_cast(networkType), 1, true)); setDaemonConnection(daemonConnection.uri, daemonConnection.username, daemonConnection.password); wallet2->set_seed_language(language); crypto::secret_key recovery_val, secret_key; - wallet2->generate(string(""), string(""), secret_key, false, false); + wallet2->generate(path, password, secret_key, false, false); wallet2Listener = unique_ptr(new Wallet2Listener(this, wallet2)); } - MoneroWallet::MoneroWallet(const string& mnemonic, const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, uint64_t restoreHeight) { + MoneroWallet::MoneroWallet(const string& path, const string& password, const string& mnemonic, const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, uint64_t restoreHeight) { // validate mnemonic and get recovery key and language crypto::secret_key recoveryKey; @@ -136,7 +136,7 @@ namespace monero { // initialize wallet wallet2 = shared_ptr(new tools::wallet2(static_cast(networkType), 1, true)); wallet2->set_seed_language(language); - wallet2->generate(string(""), string(""), recoveryKey, true, false); + wallet2->generate(path, password, recoveryKey, true, false); wallet2->set_refresh_from_block_height(restoreHeight); wallet2Listener = unique_ptr(new Wallet2Listener(this, wallet2)); @@ -146,7 +146,7 @@ namespace monero { cout << "Mnemonic: " << string(fetchedMnemonic.data(), fetchedMnemonic.size()) << endl; } - MoneroWallet::MoneroWallet(const string& address, const string& viewKey, const string& spendKey, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language) { + MoneroWallet::MoneroWallet(const string& path, const string& password, const string& address, const string& viewKey, const string& spendKey, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language) { cout << "MoneroWallet(7)" << endl; throw runtime_error("Not implemented"); } diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index 5c8ab49..a039e5b 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -169,31 +169,40 @@ namespace monero { /** * Construct an unconnected English wallet with a randomly generated seed on mainnet. + * + * @param path is the path to create the wallet + * @param password is the password encrypt the wallet */ - MoneroWallet(); + MoneroWallet(const string& path, const string& password); /** * Construct a wallet with a randomly generated seed. * + * @param path is the path to create the wallet + * @param password is the password encrypt the wallet * @param networkType is the wallet's network type (default = MoneroNetworkType.MAINNET) * @param daemonConnection is connection information to a daemon (default = an unconnected wallet) * @param language is the wallet and mnemonic's language (default = "English") */ - MoneroWallet(const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language); + MoneroWallet(const string& path, const string& password, const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language); /** * Construct a wallet from a mnemonic phrase. * + * @param path is the path to create the wallet + * @param password is the password encrypt the wallet * @param mnemonic is the mnemonic of the wallet to construct * @param networkType is the wallet's network type * @param daemonConnection is connection information to a daemon (default = an unconnected wallet) * @param restoreHeight is the block height to restore (i.e. scan the chain) from (default = 0) */ - MoneroWallet(const string& mnemonic, const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, uint64_t restoreHeight); + MoneroWallet(const string& path, const string& password, const string& mnemonic, const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, uint64_t restoreHeight); /** * Construct 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 address is the address of the wallet to construct * @param viewKey is the view key of the wallet to construct * @param spendKey is the spend key of the wallet to construct @@ -202,7 +211,7 @@ namespace monero { * @param restoreHeight 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") */ - MoneroWallet(const string& address, const string& viewKey, const string& spendKey, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language); + MoneroWallet(const string& path, const string& password, const string& address, const string& viewKey, const string& spendKey, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language); /** * Construct a wallet by opening a wallet file on disk.