20#include <xrpld/rpc/Context.h> 
   21#include <xrpld/rpc/detail/RPCHelpers.h> 
   22#include <xrpld/rpc/detail/Tuning.h> 
   24#include <xrpl/ledger/ReadView.h> 
   25#include <xrpl/ledger/View.h> 
   26#include <xrpl/protocol/ErrorCodes.h> 
   27#include <xrpl/protocol/PublicKey.h> 
   28#include <xrpl/protocol/RPCErr.h> 
   29#include <xrpl/protocol/jss.h> 
   30#include <xrpl/resource/Fees.h> 
   39    jDst[jss::account] = 
to_string(line[sfAccount]);
 
   40    jDst[jss::destination_account] = 
to_string(line[sfDestination]);
 
   41    jDst[jss::amount] = line[sfAmount].getText();
 
   42    jDst[jss::balance] = line[sfBalance].getText();
 
   47        jDst[jss::public_key_hex] = 
strHex(pk);
 
   49    jDst[jss::settle_delay] = line[sfSettleDelay];
 
   50    if (
auto const& v = line[~sfExpiration])
 
   51        jDst[jss::expiration] = *v;
 
   52    if (
auto const& v = line[~sfCancelAfter])
 
   53        jDst[jss::cancel_after] = *v;
 
   54    if (
auto const& v = line[~sfSourceTag])
 
   55        jDst[jss::source_tag] = *v;
 
   56    if (
auto const& v = line[~sfDestinationTag])
 
   57        jDst[jss::destination_tag] = *v;
 
 
   70    auto const& params(context.
params);
 
   71    if (!params.isMember(jss::account))
 
   74    if (!params[jss::account].isString())
 
   82    auto id = parseBase58<AccountID>(params[jss::account].asString());
 
   87    AccountID const accountID{std::move(
id.value())};
 
   93    if (params.isMember(jss::destination_account))
 
   94        strDst = params[jss::destination_account].asString();
 
   99    if (!strDst.
empty() && !raDstAccount)
 
  113    VisitData visitData = {{}, accountID, raDstAccount};
 
  114    visitData.items.reserve(limit);
 
  115    uint256 startAfter = beast::zero;
 
  118    if (params.isMember(jss::marker))
 
  120        if (!params[jss::marker].isString())
 
  138            startHint = boost::lexical_cast<std::uint64_t>(value);
 
  140        catch (boost::bad_lexical_cast&)
 
  147        auto const sle = ledger->read({
ltANY, startAfter});
 
  165            [&visitData, &accountID, &count, &limit, &marker, &nextHint](
 
  170                    UNREACHABLE(
"ripple::doAccountChannels : null SLE");
 
  175                if (++count == limit)
 
  177                    marker = sleCur->key();
 
  181                if (count <= limit && sleCur->getType() == ltPAYCHAN &&
 
  182                    (*sleCur)[sfAccount] == accountID &&
 
  183                    (!visitData.raDstAccount ||
 
  184                     *visitData.raDstAccount == (*sleCur)[sfDestination]))
 
  186                    visitData.items.emplace_back(sleCur);
 
  198    if (count == limit + 1 && marker)
 
  200        result[jss::limit] = limit;
 
  201        result[jss::marker] =
 
  205    result[jss::account] = 
toBase58(accountID);
 
  207    for (
auto const& item : visitData.items)
 
  211    result[jss::channels] = std::move(jsonChannels);
 
 
Value & append(Value const &value)
Append value to array at the end.
 
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
 
@ arrayValue
array value (ordered list)
 
@ objectValue
object value (collection of name/value pairs).
 
static LimitRange constexpr accountChannels
Limits for the account_channels command.
 
Json::Value invalid_field_error(std::string const &name)
 
bool isRelatedToAccount(ReadView const &ledger, std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Tests if a SLE is owned by accountID.
 
Json::Value expected_field_error(std::string const &name, std::string const &type)
 
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.
 
std::uint64_t getStartHint(std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Gets the start hint for traversing account objects.
 
Json::Value missing_field_error(std::string const &name)
 
Charge const feeMediumBurdenRPC
 
Keylet account(AccountID const &id) noexcept
AccountID root.
 
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.
 
void addChannel(Json::Value &jsonLines, SLE const &line)
 
Json::Value rpcError(int iError)
 
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
 
std::string strHex(FwdIt begin, FwdIt end)
 
bool forEachItemAfter(ReadView const &view, Keylet const &root, uint256 const &after, std::uint64_t const hint, unsigned int limit, std::function< bool(std::shared_ptr< SLE const > const &)> const &f)
Iterate all items after an item in the given directory.
 
std::string to_string(base_uint< Bits, Tag > const &a)
 
@ ltANY
A special type, matching any ledger entry type.
 
Json::Value doAccountChannels(RPC::JsonContext &context)
 
Resource::Charge & loadType