implemented getAddress()

This commit is contained in:
woodser
2019-05-27 13:37:58 -04:00
parent d71ad76e50
commit 68a6f3868b
2 changed files with 30 additions and 4 deletions
+15 -4
View File
@@ -15,6 +15,7 @@ bool MoneroWallet::walletExists(const string& path) {
MoneroWallet::MoneroWallet() {
cout << "MoneroWallet()" << endl;
throw runtime_error("Not implemented");
}
MoneroWallet::MoneroWallet(const MoneroNetworkType networkType, const MoneroRpcConnection& daemonConnection, const string& language) {
@@ -27,10 +28,12 @@ MoneroWallet::MoneroWallet(const MoneroNetworkType networkType, const MoneroRpcC
MoneroWallet::MoneroWallet(const string& mnemonic, const MoneroNetworkType networkType, const string& daemonConnection, uint64_t restoreHeight) {
cout << "MoneroWallet(4)" << endl;
throw runtime_error("Not implemented");
}
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;
throw runtime_error("Not implemented");
}
MoneroWallet::MoneroWallet(const string& path, const epee::wipeable_string& password, const MoneroNetworkType networkType) {
@@ -42,10 +45,6 @@ MoneroWallet::~MoneroWallet() {
cout << "~MoneroWallet()" << endl;
}
void MoneroWallet::getMnemonic(epee::wipeable_string& mnemonic) const {
wallet2->get_seed(mnemonic);
}
void MoneroWallet::setDaemonConnection(const string& uri, const string& username, const epee::wipeable_string& password) {
// prepare uri, login, and isTrusted for wallet2
@@ -58,3 +57,15 @@ void MoneroWallet::setDaemonConnection(const string& uri, const string& username
// set wallet2 daemon connection
wallet2->set_daemon(uri, login, isTrusted);
}
MoneroNetworkType MoneroWallet::getNetworkType() {
return static_cast<MoneroNetworkType>(wallet2->nettype());
}
void MoneroWallet::getMnemonic(epee::wipeable_string& mnemonic) const {
wallet2->get_seed(mnemonic);
}
string MoneroWallet::getAddress(uint32_t accountIdx, uint32_t subaddressIdx) {
return wallet2->get_subaddress_as_str({accountIdx, subaddressIdx});
}
+15
View File
@@ -73,6 +73,8 @@ using namespace crypto;
*/
~MoneroWallet();
// ------------ WALLET METHODS SPECIFIC TO JNI IMPLEMENTATION ---------------
/**
* Set the wallet's daemon connection.
*
@@ -82,6 +84,10 @@ using namespace crypto;
*/
void setDaemonConnection(const string& uri, const string& username, const epee::wipeable_string& password);
MoneroNetworkType getNetworkType();
// -------------------------- COMMON WALLET METHODS -------------------------
// /**
// * Get the wallet's seed.
// *
@@ -96,6 +102,15 @@ using namespace crypto;
*/
void getMnemonic(epee::wipeable_string& mnemonic) const;
/**
* Get the address of a specific subaddress.
*
* @param accountIdx specifies the account index of the address's subaddress
* @param subaddressIdx specifies the subaddress index within the account
* @return the receive address of the specified subaddress
*/
string getAddress(uint32_t accountIdx, uint32_t subaddressIdx);
// --------------------------------- PRIVATE --------------------------------
private: