20#include <xrpld/app/paths/TrustLine.h> 
   21#include <xrpld/rpc/Context.h> 
   22#include <xrpld/rpc/detail/RPCHelpers.h> 
   23#include <xrpld/rpc/detail/Tuning.h> 
   25#include <xrpl/ledger/ReadView.h> 
   26#include <xrpl/protocol/ErrorCodes.h> 
   27#include <xrpl/protocol/RPCErr.h> 
   28#include <xrpl/protocol/jss.h> 
   29#include <xrpl/resource/Fees.h> 
   36    STAmount const& saBalance(line.getBalance());
 
   37    STAmount const& saLimit(line.getLimit());
 
   38    STAmount const& saLimitPeer(line.getLimitPeer());
 
   41    jPeer[jss::account] = 
to_string(line.getAccountIDPeer());
 
   47    jPeer[jss::balance] = saBalance.
getText();
 
   49    jPeer[jss::limit] = saLimit.
getText();
 
   50    jPeer[jss::limit_peer] = saLimitPeer.
getText();
 
   51    jPeer[jss::quality_in] = line.getQualityIn().value;
 
   52    jPeer[jss::quality_out] = line.getQualityOut().value;
 
   54        jPeer[jss::authorized] = 
true;
 
   55    if (line.getAuthPeer())
 
   56        jPeer[jss::peer_authorized] = 
true;
 
   57    if (line.getNoRipple())
 
   58        jPeer[jss::no_ripple] = 
true;
 
   59    if (line.getNoRipplePeer())
 
   60        jPeer[jss::no_ripple_peer] = 
true;
 
   62        jPeer[jss::freeze] = 
true;
 
   63    if (line.getFreezePeer())
 
   64        jPeer[jss::freeze_peer] = 
true;
 
   65    if (line.getDeepFreeze())
 
   66        jPeer[jss::deep_freeze] = 
true;
 
   67    if (line.getDeepFreezePeer())
 
   68        jPeer[jss::deep_freeze_peer] = 
true;
 
 
   83    auto const& params(context.
params);
 
   84    if (!params.isMember(jss::account))
 
   87    if (!params[jss::account].isString())
 
   95    auto id = parseBase58<AccountID>(params[jss::account].asString());
 
  101    auto const accountID{std::move(
id.value())};
 
  107    if (params.isMember(jss::peer))
 
  108        strPeer = params[jss::peer].asString();
 
  113    if (!strPeer.
empty() && !raPeerAccount)
 
  125    bool ignoreDefault = params.isMember(jss::ignore_default) &&
 
  126        params[jss::ignore_default].asBool();
 
  137    VisitData visitData = {{}, accountID, raPeerAccount, ignoreDefault, 0};
 
  138    uint256 startAfter = beast::zero;
 
  141    if (params.isMember(jss::marker))
 
  143        if (!params[jss::marker].isString())
 
  161            startHint = boost::lexical_cast<std::uint64_t>(value);
 
  163        catch (boost::bad_lexical_cast&)
 
  170        auto const sle = ledger->read({
ltANY, startAfter});
 
  189                [&visitData, &count, &marker, &limit, &nextHint](
 
  194                        UNREACHABLE(
"ripple::doAccountLines : null SLE");
 
  199                    if (++count == limit)
 
  201                        marker = sleCur->key();
 
  206                    if (sleCur->getType() != ltRIPPLE_STATE)
 
  210                    if (visitData.ignoreDefault)
 
  212                        if (sleCur->getFieldAmount(sfLowLimit).getIssuer() ==
 
  221                    if (!ignore && count <= limit)
 
  227                            (!visitData.raPeerAccount ||
 
  228                             *visitData.raPeerAccount ==
 
  229                                 line->getAccountIDPeer()))
 
  231                            visitData.items.emplace_back(*line);
 
  245    if (count == limit + 1 && marker)
 
  247        result[jss::limit] = limit;
 
  248        result[jss::marker] =
 
  252    result[jss::account] = 
toBase58(accountID);
 
  254    for (
auto const& item : visitData.items)
 
 
Value & append(Value const &value)
Append value to array at the end.
 
static std::optional< RPCTrustLine > makeItem(AccountID const &accountID, std::shared_ptr< SLE const > const &sle)
 
std::string getText() const override
 
Issue const & issue() const
 
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 accountLines
Limits for the account_lines 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.
 
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
 
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 addLine(Json::Value &jsonLines, RPCTrustLine const &line)
 
Json::Value doAccountLines(RPC::JsonContext &context)
 
Json::Value rpcError(int iError)
 
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.
 
Resource::Charge & loadType