mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-18 23:58:59 +02:00
use redefined MoneroNetworkType;
implement getMnemonic()
This commit is contained in:
@@ -23,8 +23,8 @@ namespace monero {
|
||||
struct MoneroRpcConnection {
|
||||
//MoneroRpcConnection() : uri(""), username(""), password("")) {}
|
||||
MoneroRpcConnection(const string& uri = "", const string& username = "", const epee::wipeable_string& password = epee::wipeable_string()) : uri(uri), username(username), password(password) {}
|
||||
const string uri;
|
||||
const string username;
|
||||
const string& uri;
|
||||
const string& username;
|
||||
const epee::wipeable_string& password;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "MoneroWallet.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include "MoneroWallet.h"
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
bool MoneroWallet::walletExists(const string& path) {
|
||||
cout << "walletExists(" << path << ")" << endl;
|
||||
@@ -14,24 +17,24 @@ MoneroWallet::MoneroWallet() {
|
||||
cout << "MoneroWallet()" << endl;
|
||||
}
|
||||
|
||||
MoneroWallet::MoneroWallet(network_type networkType, const MoneroRpcConnection& daemonConnection, const string& language) {
|
||||
wallet2 = new tools::wallet2(networkType, 1, true);
|
||||
MoneroWallet::MoneroWallet(const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language) {
|
||||
wallet2 = new tools::wallet2(static_cast<network_type>(networkType), 1, true);
|
||||
MoneroWallet::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);
|
||||
}
|
||||
|
||||
MoneroWallet::MoneroWallet(const string& mnemonic, network_type networkType, const string& daemonConnection, uint64_t restoreHeight) {
|
||||
MoneroWallet::MoneroWallet(const string& mnemonic, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight) {
|
||||
cout << "MoneroWallet(4)" << endl;
|
||||
}
|
||||
|
||||
MoneroWallet::MoneroWallet(const string& address, const string& viewKey, const string& spendKey, network_type networkType, const string& daemonConnection, uint64_t restoreHeight, const string& language) {
|
||||
MoneroWallet::MoneroWallet(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;
|
||||
}
|
||||
|
||||
MoneroWallet::MoneroWallet(const string& path, const epee::wipeable_string& password, network_type networkType) {
|
||||
wallet2 = new tools::wallet2(networkType, 1, true);
|
||||
MoneroWallet::MoneroWallet(const string& path, const epee::wipeable_string& password, const MoneroNetworkType networkType) {
|
||||
wallet2 = new tools::wallet2(static_cast<network_type>(networkType), 1, true);
|
||||
wallet2->load(path, password);
|
||||
}
|
||||
|
||||
@@ -40,7 +43,7 @@ MoneroWallet::~MoneroWallet() {
|
||||
}
|
||||
|
||||
void MoneroWallet::getMnemonic(epee::wipeable_string& mnemonic) const {
|
||||
throw runtime_error("Not implemented");
|
||||
wallet2->get_seed(mnemonic);
|
||||
}
|
||||
|
||||
void MoneroWallet::setDaemonConnection(const string& uri, const string& username, const epee::wipeable_string& password) {
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
using namespace std;
|
||||
using namespace monero;
|
||||
using namespace crypto;
|
||||
using namespace cryptonote;
|
||||
|
||||
/**
|
||||
* Monero wallet interface.
|
||||
*
|
||||
* TODO: daemonConnection is object with uri, username, and password
|
||||
*/
|
||||
class MoneroWallet {
|
||||
|
||||
@@ -37,7 +34,7 @@ using namespace cryptonote;
|
||||
* @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 MoneroRpcConnection& daemonConnection, const string& language);
|
||||
MoneroWallet(const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language);
|
||||
|
||||
/**
|
||||
* Construct a wallet from a mnemonic phrase.
|
||||
@@ -47,7 +44,7 @@ using namespace cryptonote;
|
||||
* @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);
|
||||
MoneroWallet(const string& mnemonic, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight);
|
||||
|
||||
/**
|
||||
* Construct a wallet from an address, view key, and spend key.
|
||||
@@ -60,7 +57,7 @@ using namespace cryptonote;
|
||||
* @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);
|
||||
MoneroWallet(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.
|
||||
@@ -69,7 +66,7 @@ using namespace cryptonote;
|
||||
* @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);
|
||||
MoneroWallet(const string& path, const epee::wipeable_string& password, const MoneroNetworkType networkType);
|
||||
|
||||
/**
|
||||
* Deconstructs the wallet.
|
||||
@@ -79,11 +76,11 @@ using namespace cryptonote;
|
||||
/**
|
||||
* 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
|
||||
* @param uri is the daemon's URI
|
||||
* @param username is the daemon's username
|
||||
* @param password is the daemon's password
|
||||
*/
|
||||
void setDaemonConnection(const string& daemonUri, const string& daemonUsername, const epee::wipeable_string& daemonPassword);
|
||||
void setDaemonConnection(const string& uri, const string& username, const epee::wipeable_string& password);
|
||||
|
||||
// /**
|
||||
// * Get the wallet's seed.
|
||||
|
||||
Reference in New Issue
Block a user