mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-19 16:18:40 +02:00
update wallet2 api
This commit is contained in:
@@ -1288,7 +1288,7 @@ namespace monero {
|
||||
}
|
||||
|
||||
uint64_t monero_wallet_core::get_unlocked_balance(uint32_t account_idx, uint32_t subaddress_idx) const {
|
||||
map<uint32_t, std::pair<uint64_t, uint64_t>> unlocked_balance_per_subaddress = m_w2->unlocked_balance_per_subaddress(account_idx, STRICT);
|
||||
std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> unlocked_balance_per_subaddress = m_w2->unlocked_balance_per_subaddress(account_idx, STRICT);
|
||||
auto iter = unlocked_balance_per_subaddress.find(subaddress_idx);
|
||||
return iter == unlocked_balance_per_subaddress.end() ? 0 : iter->second.first;
|
||||
}
|
||||
@@ -3275,7 +3275,7 @@ namespace monero {
|
||||
|
||||
// get balances per subaddress as maps
|
||||
map<uint32_t, uint64_t> balance_per_subaddress = m_w2->balance_per_subaddress(account_idx, STRICT);
|
||||
map<uint32_t, std::pair<uint64_t, uint64_t>> unlocked_balance_per_subaddress = m_w2->unlocked_balance_per_subaddress(account_idx, STRICT);
|
||||
std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> unlocked_balance_per_subaddress = m_w2->unlocked_balance_per_subaddress(account_idx, STRICT);
|
||||
|
||||
// get all indices if no indices given
|
||||
vector<uint32_t> subaddress_indices_req;
|
||||
@@ -3302,7 +3302,7 @@ namespace monero {
|
||||
cryptonote::subaddress_index index = {account_idx, subaddress_idx};
|
||||
subaddress.m_num_unspent_outputs = count_if(transfers.begin(), transfers.end(), [&](const tools::wallet2::transfer_details& td) { return !td.m_spent && td.m_subaddr_index == index; });
|
||||
subaddress.m_is_used = find_if(transfers.begin(), transfers.end(), [&](const tools::wallet2::transfer_details& td) { return td.m_subaddr_index == index; }) != transfers.end();
|
||||
subaddress.m_num_blocks_to_unlock = iter1 == balance_per_subaddress.end() ? 0 : iter2->second.second;
|
||||
subaddress.m_num_blocks_to_unlock = iter1 == balance_per_subaddress.end() ? 0 : iter2->second.second.first;
|
||||
subaddresses.push_back(subaddress);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user