implemented MoneroWallet::walletExists(const string& path)

This commit is contained in:
woodser
2019-05-27 10:40:37 -04:00
parent a7830f5b67
commit 696cb268d9
3 changed files with 79 additions and 66 deletions
+8
View File
@@ -5,6 +5,14 @@
using namespace std;
using namespace epee;
bool MoneroWallet::walletExists(const string& path) {
cout << "walletExists(" << path << ")" << endl;
bool keyFileExists;
bool walletFileExists;
tools::wallet2::wallet_exists(path, keyFileExists, walletFileExists);
return walletFileExists;
}
MoneroWallet::MoneroWallet() {
cout << "MoneroWallet()" << endl;
}
+69 -65
View File
@@ -4,10 +4,6 @@ using namespace std;
using namespace crypto;
using namespace cryptonote;
//int main(int argc, const char* argv[]) {
// cout << "===== MAIN =====" << endl;
//}
/**
* Monero wallet interface.
*
@@ -15,69 +11,77 @@ using namespace cryptonote;
*/
class MoneroWallet {
// --------------------------------- PUBLIC --------------------------------
// --------------------------------- PUBLIC --------------------------------
public:
/**
* Construct a wallet with a randomly generated seed.
*/
MoneroWallet();
/**
* Indicates if a wallet exists at the given path.
*
* @param path is the path to check for a wallet
* @return true if a wallet exists at the given path, false otherwise
*/
static bool walletExists(const string& path);
/**
* Construct a wallet with a randomly generated seed.
*
* @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(network_type networkType, const string& daemonConnection, const string& language);
/**
* Construct a wallet with a randomly generated seed.
*/
MoneroWallet();
/**
* Construct a wallet from a mnemonic phrase.
*
* @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, network_type networkType, const string& daemonConnection, uint64_t restoreHeight);
/**
* Construct a wallet with a randomly generated seed.
*
* @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(network_type networkType, const string& daemonConnection, const string& language);
/**
* Construct a wallet from an address, view key, and spend key.
*
* @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
* @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)
* @param language is the wallet and mnemonic's language (default = "English")
*/
MoneroWallet(const string& address, const string& viewKey, const string& spendKey, network_type networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language);
/**
* Construct a wallet from a mnemonic phrase.
*
* @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, network_type networkType, const string& daemonConnection, uint64_t restoreHeight);
/**
* Construct a wallet by opening a wallet file on disk.
*
* @param path is the path to the wallet file to open
* @param password is the password of the wallet file to open
* @param networkType is the wallet's network type
*/
MoneroWallet(const string& path, const epee::wipeable_string& password, network_type networkType);
/**
* Construct a wallet from an address, view key, and spend key.
*
* @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
* @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)
* @param language is the wallet and mnemonic's language (default = "English")
*/
MoneroWallet(const string& address, const string& viewKey, const string& spendKey, network_type networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language);
/**
* Deconstructs the wallet.
*/
~MoneroWallet();
/**
* Construct a wallet by opening a wallet file on disk.
*
* @param path is the path to the wallet file to open
* @param password is the password of the wallet file to open
* @param networkType is the wallet's network type
*/
MoneroWallet(const string& path, const epee::wipeable_string& password, network_type networkType);
/**
* Set the wallet's daemon connection.
*
* @param daemonUri is the daemon's URI
* @param daemonUsername is the daemon's username
* @param daemonPassword is the daemon's password
*/
void setDaemonConnection(const string& daemonUri, const string& daemonUsername, const epee::wipeable_string& daemonPassword);
/**
* Deconstructs the wallet.
*/
~MoneroWallet();
/**
* Set the wallet's daemon connection.
*
* @param daemonUri is the daemon's URI
* @param daemonUsername is the daemon's username
* @param daemonPassword is the daemon's password
*/
void setDaemonConnection(const string& daemonUri, const string& daemonUsername, const epee::wipeable_string& daemonPassword);
// /**
// * Get the wallet's seed.
@@ -86,14 +90,14 @@ using namespace cryptonote;
// */
// const string getSeed();
/**
* Get the wallet's mnemonic phrase derived from the seed.
*
* @param mnemonic is assigned the wallet's mnemonic phrase
*/
void getMnemonic(epee::wipeable_string& mnemonic) const;
/**
* Get the wallet's mnemonic phrase derived from the seed.
*
* @param mnemonic is assigned the wallet's mnemonic phrase
*/
void getMnemonic(epee::wipeable_string& mnemonic) const;
// --------------------------------- PRIVATE --------------------------------
// --------------------------------- PRIVATE --------------------------------
private:
tools::wallet2* wallet2; // internal wallet implementation
+2 -1
View File
@@ -1 +1,2 @@
DaemonConnection is its own object
DaemonConnection is its own object
rename external-libs/monero to monero-core for clarity