defined MoneroAccount and MoneroSubaddress;

ready to implement MoneroWallet::getAccounts()
This commit is contained in:
woodser
2019-05-30 16:21:30 -04:00
parent 376764d6ee
commit 0ddde43970
2 changed files with 106 additions and 49 deletions
+29
View File
@@ -246,6 +246,35 @@ namespace monero {
return syncAux(&startHeight, nullptr, &listener);
}
// rescanBlockchain
// isMultisigImportNeeded
list<MoneroAccount> MoneroWallet::getAccounts() const {
cout << "getAccounts()" << endl;
throw runtime_error("Not implemented");
}
list<MoneroAccount> MoneroWallet::getAccounts(const bool includeSubaddresses) const {
throw runtime_error("Not implemented");
}
list<MoneroAccount> MoneroWallet::getAccounts(const string tag) const {
throw runtime_error("Not implemented");
}
list<MoneroAccount> MoneroWallet::getAccounts(const bool includeSubaddresses, const string tag) const {
throw runtime_error("Not implemented");
}
MoneroAccount MoneroWallet::getAccount(const uint32_t accountIdx) const {
throw runtime_error("Not implemented");
}
MoneroAccount MoneroWallet::getAccount(const uint32_t accountIdx, const bool includeSubaddresses) const {
throw runtime_error("Not implemented");
}
string MoneroWallet::getAddress(uint32_t accountIdx, uint32_t subaddressIdx) const {
return wallet2->get_subaddress_as_str({accountIdx, subaddressIdx});
}
+77 -49
View File
@@ -40,6 +40,34 @@ namespace monero {
// TODO
};
/**
* Models a Monero subaddress.
*/
struct MoneroSubaddress {
uint32_t accountIndex;
uint32_t index;
string address;
string label;
uint64_t balance;
uint64_t unlockedBalance;
uint32_t numUnspentOutputs;
bool isUsed;
uint32_t numBlocksToUnlock;
};
/**
* Models a Monero account.
*/
struct MoneroAccount {
uint32_t index;
string primaryAddress;
string label;
uint64_t balance;
uint64_t unlockedBalance;
string tag;
vector<MoneroSubaddress> subaddresses;
};
// --------------------------------- LISTENERS ------------------------------
// class i_wallet2_callback
@@ -304,55 +332,55 @@ namespace monero {
// * @return true if importing multisig data is needed for returning a correct balance, false otherwise
// */
// public boolean isMultisigImportNeeded();
//
// /**
// * Get all accounts.
// *
// * @return List<MoneroAccount> are all accounts within the wallet
// */
// public List<MoneroAccount> getAccounts();
//
// /**
// * Get all accounts.
// *
// * @param includeSubaddresses specifies if subaddresses should be included
// * @return List<MoneroAccount> are all accounts
// */
// public List<MoneroAccount> getAccounts(boolean includeSubaddresses);
//
// /**
// * Get accounts with a given tag.
// *
// * @param tag is the tag for filtering accounts, all accounts if null
// * @return List<MoneroAccount> are all accounts for the wallet with the given tag
// */
// public List<MoneroAccount> getAccounts(String tag);
//
// /**
// * Get accounts with a given tag.
// *
// * @param includeSubaddresses specifies if subaddresses should be included
// * @param tag is the tag for filtering accounts, all accounts if null
// * @return List<MoneroAccount> are all accounts for the wallet with the given tag
// */
// public List<MoneroAccount> getAccounts(boolean includeSubaddresses, String tag);
//
// /**
// * Get an account without subaddress information.
// *
// * @param accountIdx specifies the account to get
// * @return the retrieved account
// */
// public MoneroAccount getAccount(int accountIdx);
//
// /**
// * Get an account.
// *
// * @param accountIdx specifies the account to get
// * @param includeSubaddresses specifies if subaddresses should be included
// * @return the retrieved account
// */
// public MoneroAccount getAccount(int accountIdx, boolean includeSubaddresses);
/**
* Get all accounts.
*
* @return List<MoneroAccount> are all accounts within the wallet
*/
list<MoneroAccount> getAccounts() const;
/**
* Get all accounts.
*
* @param includeSubaddresses specifies if subaddresses should be included
* @return List<MoneroAccount> are all accounts
*/
list<MoneroAccount> getAccounts(const bool includeSubaddresses) const;
/**
* Get accounts with a given tag.
*
* @param tag is the tag for filtering accounts, all accounts if null
* @return List<MoneroAccount> are all accounts for the wallet with the given tag
*/
list<MoneroAccount> getAccounts(const string tag) const;
/**
* Get accounts with a given tag.
*
* @param includeSubaddresses specifies if subaddresses should be included
* @param tag is the tag for filtering accounts, all accounts if null
* @return List<MoneroAccount> are all accounts for the wallet with the given tag
*/
list<MoneroAccount> getAccounts(const bool includeSubaddresses, const string tag) const;
/**
* Get an account without subaddress information.
*
* @param accountIdx specifies the account to get
* @return the retrieved account
*/
MoneroAccount getAccount(const uint32_t accountIdx) const;
/**
* Get an account.
*
* @param accountIdx specifies the account to get
* @param includeSubaddresses specifies if subaddresses should be included
* @return the retrieved account
*/
MoneroAccount getAccount(const uint32_t accountIdx, const bool includeSubaddresses) const;
//
// /**
// * Create a new account without a label.