From cbbe48a251395a2df0c57b4a78b8802e3cbef6a4 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 30 May 2019 21:21:46 -0400 Subject: [PATCH] getAccounts() returns primaryAddress and uses common method --- src/wallet/MoneroWallet.cpp | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index a25eed5..9bc363d 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -252,38 +252,29 @@ namespace monero { vector MoneroWallet::getAccounts() const { cout << "getAccounts()" << endl; - vector accounts; - for (uint32_t accountIdx = 0; accountIdx < wallet2->get_num_subaddress_accounts(); accountIdx++) { - MoneroAccount account; - account.index = accountIdx; - accounts.push_back(account); - } - return accounts; + return getAccounts(false, string("")); } vector MoneroWallet::getAccounts(const bool includeSubaddresses) const { + cout << "getAccounts(" << includeSubaddresses << ")" << endl; throw runtime_error("Not implemented"); - - cout << "getAccounts(includeSubaddresses)" << endl; - vector accounts; - for (uint32_t accountIdx = 0; accountIdx < wallet2->get_num_subaddress_accounts(); accountIdx++) { - MoneroAccount account; - account.index = accountIdx; - accounts.push_back(account); -// // build subaddresses -// for (uint32_t subaddressIdx = 0; subaddressIdx < wallet2->get_num_subaddresses(accountIdx); subaddressIdx++) { -// cout << "Account " << accountIdx << ", " << subaddressIdx << endl; -// } - } - return accounts; } vector MoneroWallet::getAccounts(const string tag) const { + cout << "getAccounts(" << tag << ")" << endl; throw runtime_error("Not implemented"); } vector MoneroWallet::getAccounts(const bool includeSubaddresses, const string tag) const { - throw runtime_error("Not implemented"); + cout << "getAccounts(" << includeSubaddresses << ", " << tag << ")" << endl; + vector accounts; + for (uint32_t accountIdx = 0; accountIdx < wallet2->get_num_subaddress_accounts(); accountIdx++) { + MoneroAccount account; + account.index = accountIdx; + account.primaryAddress = MoneroWallet::getAddress(0, 0); + accounts.push_back(account); + } + return accounts; } MoneroAccount MoneroWallet::getAccount(const uint32_t accountIdx) const {