mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 16:27:39 +00:00
Merge pull request #5154
8a1ff079
wallet-rpc: get transfers for all accounts and subaddresses (Jethro Grassie)
This commit is contained in:
commit
6984a4d69c
2 changed files with 14 additions and 4 deletions
|
@ -2309,10 +2309,18 @@ namespace tools
|
|||
max_height = req.max_height <= max_height ? req.max_height : max_height;
|
||||
}
|
||||
|
||||
boost::optional<uint32_t> account_index = req.account_index;
|
||||
std::set<uint32_t> subaddr_indices = req.subaddr_indices;
|
||||
if (req.all_accounts)
|
||||
{
|
||||
account_index = boost::none;
|
||||
subaddr_indices.clear();
|
||||
}
|
||||
|
||||
if (req.in)
|
||||
{
|
||||
std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
|
||||
m_wallet->get_payments(payments, min_height, max_height, req.account_index, req.subaddr_indices);
|
||||
m_wallet->get_payments(payments, min_height, max_height, account_index, subaddr_indices);
|
||||
for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
||||
res.in.push_back(wallet_rpc::transfer_entry());
|
||||
fill_transfer_entry(res.in.back(), i->second.m_tx_hash, i->first, i->second);
|
||||
|
@ -2322,7 +2330,7 @@ namespace tools
|
|||
if (req.out)
|
||||
{
|
||||
std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>> payments;
|
||||
m_wallet->get_payments_out(payments, min_height, max_height, req.account_index, req.subaddr_indices);
|
||||
m_wallet->get_payments_out(payments, min_height, max_height, account_index, subaddr_indices);
|
||||
for (std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
||||
res.out.push_back(wallet_rpc::transfer_entry());
|
||||
fill_transfer_entry(res.out.back(), i->first, i->second);
|
||||
|
@ -2331,7 +2339,7 @@ namespace tools
|
|||
|
||||
if (req.pending || req.failed) {
|
||||
std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>> upayments;
|
||||
m_wallet->get_unconfirmed_payments_out(upayments, req.account_index, req.subaddr_indices);
|
||||
m_wallet->get_unconfirmed_payments_out(upayments, account_index, subaddr_indices);
|
||||
for (std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>>::const_iterator i = upayments.begin(); i != upayments.end(); ++i) {
|
||||
const tools::wallet2::unconfirmed_transfer_details &pd = i->second;
|
||||
bool is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed;
|
||||
|
@ -2348,7 +2356,7 @@ namespace tools
|
|||
m_wallet->update_pool_state();
|
||||
|
||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> payments;
|
||||
m_wallet->get_unconfirmed_payments(payments, req.account_index, req.subaddr_indices);
|
||||
m_wallet->get_unconfirmed_payments(payments, account_index, subaddr_indices);
|
||||
for (std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
|
||||
res.pool.push_back(wallet_rpc::transfer_entry());
|
||||
fill_transfer_entry(res.pool.back(), i->first, i->second);
|
||||
|
|
|
@ -1418,6 +1418,7 @@ namespace wallet_rpc
|
|||
uint64_t max_height;
|
||||
uint32_t account_index;
|
||||
std::set<uint32_t> subaddr_indices;
|
||||
bool all_accounts;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(in);
|
||||
|
@ -1430,6 +1431,7 @@ namespace wallet_rpc
|
|||
KV_SERIALIZE_OPT(max_height, (uint64_t)CRYPTONOTE_MAX_BLOCK_NUMBER);
|
||||
KV_SERIALIZE(account_index);
|
||||
KV_SERIALIZE(subaddr_indices);
|
||||
KV_SERIALIZE_OPT(all_accounts, false);
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue