diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index eb404ca..c2a01e3 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -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(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}); +} diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index 0cd0e31..20061e5 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -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: