20 #include <ripple/app/ledger/LedgerToJson.h>
21 #include <ripple/ledger/ReadView.h>
22 #include <ripple/protocol/ErrorCodes.h>
23 #include <ripple/protocol/LedgerFormats.h>
24 #include <ripple/protocol/jss.h>
25 #include <ripple/rpc/Context.h>
26 #include <ripple/rpc/Role.h>
27 #include <ripple/rpc/impl/RPCHelpers.h>
28 #include <ripple/rpc/impl/Tuning.h>
47 auto const& params = context.
params;
53 bool const isMarker = params.isMember(jss::marker);
62 bool const isBinary = params[jss::binary].asBool();
65 if (params.isMember(jss::limit))
71 limit = jLimit.
asInt();
75 if ((limit < 0) || ((limit > maxLimit) && (!
isUnlimited(context.
role))))
79 jvResult[jss::ledger_index] = lpLedger->
info().
seq;
84 jvResult[jss::ledger] =
getJson(
85 LedgerFill(*lpLedger, isBinary ? LedgerFill::Options::binary : 0));
92 rpcStatus.inject(jvResult);
109 if (type ==
ltINVALID || sle->getType() == type)
115 entry[jss::index] =
to_string(sle->key());
121 entry[jss::index] =
to_string(sle->key());
virtual LedgerInfo const & info() const =0
Returns information about the ledger.
iterator upper_bound(key_type const &key) const
std::string to_string(ListDisposition disposition)
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 expected_field_error(std::string const &name, std::string const &type)
Value & append(const Value &value)
Append value to array at the end.
std::string serializeHex(STObject const &o)
Serialize an object to a hex string.
@ objectValue
object value (collection of name/value pairs).
Json::Value doLedgerData(RPC::JsonContext &)
sles_type sles
Iterable range of ledger state items.
constexpr int pageLength(bool isBinary)
Maximum number of pages in a LedgerData response.
Keylet unchecked(uint256 const &key) noexcept
Any ledger entry.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
std::pair< RPC::Status, LedgerEntryType > chooseLedgerEntryType(Json::Value const ¶ms)
std::string asString() const
Returns the unquoted string value.