Add receivable along with pending to RPC responses (#3439)

This commit is contained in:
Shryder 2021-10-20 14:59:29 +01:00 committed by GitHub
commit 2f098d4ec7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -527,6 +527,7 @@ void nano::json_handler::account_balance ()
auto balance (node.balance_pending (account, include_only_confirmed));
response_l.put ("balance", balance.first.convert_to<std::string> ());
response_l.put ("pending", balance.second.convert_to<std::string> ());
response_l.put ("receivable", balance.second.convert_to<std::string> ());
}
response_errors ();
}
@ -693,6 +694,7 @@ void nano::json_handler::account_info ()
{
auto account_pending (node.ledger.account_pending (transaction, account));
response_l.put ("pending", account_pending.convert_to<std::string> ());
response_l.put ("receivable", account_pending.convert_to<std::string> ());
if (include_confirmed)
{
@ -896,6 +898,7 @@ void nano::json_handler::accounts_balances ()
auto balance (node.balance_pending (account, false));
entry.put ("balance", balance.first.convert_to<std::string> ());
entry.put ("pending", balance.second.convert_to<std::string> ());
entry.put ("receivable", balance.second.convert_to<std::string> ());
balances.push_back (std::make_pair (account.to_account (), entry));
}
}
@ -2660,6 +2663,7 @@ void nano::json_handler::ledger ()
continue;
}
response_a.put ("pending", account_pending.convert_to<std::string> ());
response_a.put ("receivable", account_pending.convert_to<std::string> ());
}
response_a.put ("frontier", info.head.to_string ());
response_a.put ("open_block", info.open_block.to_string ());
@ -2712,6 +2716,7 @@ void nano::json_handler::ledger ()
continue;
}
response_a.put ("pending", account_pending.convert_to<std::string> ());
response_a.put ("receivable", account_pending.convert_to<std::string> ());
}
response_a.put ("frontier", info.head.to_string ());
response_a.put ("open_block", info.open_block.to_string ());
@ -4315,6 +4320,7 @@ void nano::json_handler::wallet_info ()
uint32_t deterministic_index (wallet->store.deterministic_index_get (transaction));
response_l.put ("balance", balance.convert_to<std::string> ());
response_l.put ("pending", pending.convert_to<std::string> ());
response_l.put ("receivable", pending.convert_to<std::string> ());
response_l.put ("accounts_count", std::to_string (count));
response_l.put ("accounts_block_count", std::to_string (block_count));
response_l.put ("accounts_cemented_block_count", std::to_string (cemented_block_count));
@ -4345,6 +4351,7 @@ void nano::json_handler::wallet_balances ()
nano::uint128_t pending = node.ledger.account_pending (block_transaction, account);
entry.put ("balance", balance.convert_to<std::string> ());
entry.put ("pending", pending.convert_to<std::string> ());
entry.put ("receivable", pending.convert_to<std::string> ());
balances.push_back (std::make_pair (account.to_account (), entry));
}
}
@ -4619,6 +4626,7 @@ void nano::json_handler::wallet_ledger ()
{
auto account_pending (node.ledger.account_pending (block_transaction, account));
entry.put ("pending", account_pending.convert_to<std::string> ());
entry.put ("receivable", account_pending.convert_to<std::string> ());
}
accounts.push_back (std::make_pair (account.to_account (), entry));
}
@ -5201,6 +5209,8 @@ ipc_json_handler_no_arg_func_map create_ipc_json_handler_no_arg_func_map ()
no_arg_funcs.emplace ("peers", &nano::json_handler::peers);
no_arg_funcs.emplace ("pending", &nano::json_handler::pending);
no_arg_funcs.emplace ("pending_exists", &nano::json_handler::pending_exists);
no_arg_funcs.emplace ("receivable", &nano::json_handler::pending);
no_arg_funcs.emplace ("receivable_exists", &nano::json_handler::pending_exists);
no_arg_funcs.emplace ("process", &nano::json_handler::process);
no_arg_funcs.emplace ("pruned_exists", &nano::json_handler::pruned_exists);
no_arg_funcs.emplace ("receive", &nano::json_handler::receive);