20#include <xrpld/app/main/Application.h> 
   21#include <xrpld/app/paths/TrustLine.h> 
   22#include <xrpld/rpc/Context.h> 
   23#include <xrpld/rpc/detail/RPCHelpers.h> 
   25#include <xrpl/ledger/ReadView.h> 
   26#include <xrpl/protocol/AccountID.h> 
   27#include <xrpl/protocol/ErrorCodes.h> 
   28#include <xrpl/protocol/RPCErr.h> 
   29#include <xrpl/protocol/jss.h> 
   30#include <xrpl/resource/Fees.h> 
   56    auto& params = context.
params;
 
   65    if (!(params.isMember(jss::account) || params.isMember(jss::ident)))
 
   69        params.isMember(jss::account) ? params[jss::account].asString()
 
   70                                      : params[jss::ident].asString());
 
   73    auto id = parseBase58<AccountID>(strIdent);
 
   76    auto const accountID{std::move(
id.value())};
 
   79    result[jss::account] = 
toBase58(accountID);
 
   90    if (params.isMember(jss::hotwallet))
 
   92        auto addHotWallet = [&hotWallets](
Json::Value const& j) {
 
   95                if (
auto id = parseBase58<AccountID>(j.asString()); id)
 
   97                    hotWallets.
insert(std::move(
id.value()));
 
  111            for (
unsigned i = 0; i < hw.
size(); ++i)
 
  112                valid &= addHotWallet(hw[i]);
 
  116            valid &= addHotWallet(hw);
 
  151                if (sle->getType() == ltESCROW)
 
  153                    auto const& escrow = sle->getFieldAmount(sfAmount);
 
  154                    auto& bal = locked[escrow.getCurrency()];
 
  155                    if (bal == beast::zero)
 
  185                int balSign = rs->getBalance().signum();
 
  189                auto const& peer = rs->getAccountIDPeer();
 
  195                if (hotWallets.
count(peer) > 0)
 
  198                    hotBalances[peer].push_back(-rs->getBalance());
 
  200                else if (balSign > 0)
 
  203                    assets[peer].push_back(rs->getBalance());
 
  205                else if (rs->getFreeze())
 
  208                    frozenBalances[peer].push_back(-rs->getBalance());
 
  213                    auto& bal = sums[rs->getBalance().getCurrency()];
 
  214                    if (bal == beast::zero)
 
  217                        bal = -rs->getBalance();
 
  223                            bal -= rs->getBalance();
 
  244        for (
auto const& [k, v] : sums)
 
  248        result[jss::obligations] = std::move(j);
 
  251    auto populateResult =
 
  258                for (
auto const& [accId, accBalances] : array)
 
  261                    for (
auto const& balance : accBalances)
 
  264                        entry[jss::currency] =
 
  266                        entry[jss::value] = balance.getText();
 
  267                        balanceArray.
append(std::move(entry));
 
  269                    j[
to_string(accId)] = std::move(balanceArray);
 
  271                result[name] = std::move(j);
 
  275    populateResult(hotBalances, jss::balances);
 
  276    populateResult(frozenBalances, jss::frozen_balances);
 
  277    populateResult(assets, jss::assets);
 
  283        for (
auto const& [k, v] : locked)
 
  287        result[jss::locked] = std::move(j);
 
 
Lightweight wrapper to tag static string.
 
Value & append(Value const &value)
Append value to array at the end.
 
UInt size() const
Number of values in array or object.
 
bool isArrayOrNull() const
 
static std::optional< PathFindTrustLine > makeItem(AccountID const &accountID, std::shared_ptr< SLE const > const &sle)
 
static int const cMaxOffset
 
static std::uint64_t const cMaxValue
 
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
 
Status lookupLedger(std::shared_ptr< ReadView const > &ledger, JsonContext &context, Json::Value &result)
Look up a ledger from a request and fill a Json::Result with the data representing a ledger.
 
Json::Value missing_field_error(std::string const &name)
 
Charge const feeHeavyBurdenRPC
 
TER valid(STTx const &tx, ReadView const &view, AccountID const &src, beast::Journal j)
 
Keylet account(AccountID const &id) noexcept
AccountID root.
 
Json::Value entry(jtx::Env &env, jtx::Account const &account, jtx::Account const &authorize)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
 
Json::Value rpcError(int iError)
 
void forEachItem(ReadView const &view, Keylet const &root, std::function< void(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items in the given directory.
 
Json::Value doGatewayBalances(RPC::JsonContext &context)
 
Resource::Charge & loadType