mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-21 09:08:43 +02:00
defined MoneroDaemon.h;
defined MoneroNetworkType, MoneroRpcConnection structs; implement random mnemonic constructor with rpc connection struct
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "include_base_utils.h"
|
||||
#include "common/util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Public interface for libmonero library.
|
||||
*/
|
||||
namespace monero {
|
||||
|
||||
/**
|
||||
* Enumerates Monero network types.
|
||||
*/
|
||||
enum MoneroNetworkType : uint8_t {
|
||||
MAINNET = 0,
|
||||
TESTNET,
|
||||
STAGENET
|
||||
};
|
||||
|
||||
/**
|
||||
* Models a connection to a daemon.
|
||||
*/
|
||||
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 epee::wipeable_string& password;
|
||||
};
|
||||
}
|
||||
@@ -2,9 +2,6 @@
|
||||
#include <iostream>
|
||||
#include "MoneroWallet.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace epee;
|
||||
|
||||
bool MoneroWallet::walletExists(const string& path) {
|
||||
cout << "walletExists(" << path << ")" << endl;
|
||||
bool keyFileExists;
|
||||
@@ -17,13 +14,12 @@ MoneroWallet::MoneroWallet() {
|
||||
cout << "MoneroWallet()" << endl;
|
||||
}
|
||||
|
||||
MoneroWallet::MoneroWallet(network_type networkType, const string& daemonConnection, const string& language) {
|
||||
MoneroWallet::MoneroWallet(network_type networkType, const MoneroRpcConnection& daemonConnection, const string& language) {
|
||||
wallet2 = new tools::wallet2(networkType, 1, true);
|
||||
MoneroWallet::setDaemonConnection(daemonConnection, nullptr, nullptr);
|
||||
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);
|
||||
cout << "MoneroWallet(3)" << endl;
|
||||
}
|
||||
|
||||
MoneroWallet::MoneroWallet(const string& mnemonic, network_type networkType, const string& daemonConnection, uint64_t restoreHeight) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "daemon/MoneroDaemon.h"
|
||||
#include "wallet/wallet2.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace monero;
|
||||
using namespace crypto;
|
||||
using namespace cryptonote;
|
||||
|
||||
@@ -35,7 +37,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 string& daemonConnection, const string& language);
|
||||
MoneroWallet(network_type networkType, const MoneroRpcConnection& daemonConnection, const string& language);
|
||||
|
||||
/**
|
||||
* Construct a wallet from a mnemonic phrase.
|
||||
|
||||
Reference in New Issue
Block a user