20#include <xrpld/app/ledger/LedgerToJson.h> 
   21#include <xrpld/rpc/Context.h> 
   22#include <xrpld/rpc/GRPCHandlers.h> 
   23#include <xrpld/rpc/Role.h> 
   24#include <xrpld/rpc/detail/RPCHelpers.h> 
   25#include <xrpld/rpc/detail/Tuning.h> 
   27#include <xrpl/ledger/ReadView.h> 
   28#include <xrpl/protocol/ErrorCodes.h> 
   29#include <xrpl/protocol/LedgerFormats.h> 
   30#include <xrpl/protocol/jss.h> 
   49    auto const& params = context.
params;
 
   55    bool const isMarker = params.isMember(jss::marker);
 
   64    bool const isBinary = params[jss::binary].asBool();
 
   67    if (params.isMember(jss::limit))
 
   73        limit = jLimit.
asInt();
 
   77    if ((limit < 0) || ((limit > maxLimit) && (!
isUnlimited(context.
role))))
 
   80    jvResult[jss::ledger_hash] = 
to_string(lpLedger->info().hash);
 
   81    jvResult[jss::ledger_index] = lpLedger->info().seq;
 
   94        rpcStatus.inject(jvResult);
 
  103    auto e = lpLedger->sles.end();
 
  104    for (
auto i = lpLedger->sles.upper_bound(key); i != e; ++i)
 
  115        if (type == 
ltANY || sle->getType() == type)
 
  121                entry[jss::index] = 
to_string(sle->key());
 
  127                entry[jss::index] = 
to_string(sle->key());
 
 
  139    org::xrpl::rpc::v1::GetLedgerDataRequest& request = context.
params;
 
  140    org::xrpl::rpc::v1::GetLedgerDataResponse response;
 
  141    grpc::Status status = grpc::Status::OK;
 
  146        grpc::Status errorStatus;
 
  149            errorStatus = grpc::Status(
 
  150                grpc::StatusCode::INVALID_ARGUMENT, status.message());
 
  155                grpc::Status(grpc::StatusCode::NOT_FOUND, status.message());
 
  157        return {response, errorStatus};
 
  165    else if (request.marker().size() != 0)
 
  167        grpc::Status errorStatus{
 
  168            grpc::StatusCode::INVALID_ARGUMENT, 
"marker malformed"};
 
  169        return {response, errorStatus};
 
  172    auto e = ledger->sles.end();
 
  173    if (request.end_marker().size() != 0)
 
  180                {grpc::StatusCode::INVALID_ARGUMENT, 
"end marker malformed"}};
 
  185                {grpc::StatusCode::INVALID_ARGUMENT,
 
  186                 "end marker out of range"}};
 
  188        e = ledger->sles.upper_bound(*key);
 
  193    for (
auto i = ledger->sles.upper_bound(startKey); i != e; ++i)
 
  201            response.set_marker(k.data(), k.size());
 
  204        auto stateObject = response.mutable_ledger_objects()->add_objects();
 
  208        stateObject->set_key(sle->key().data(), sle->key().size());
 
  210    return {response, status};
 
 
Value & append(Value const &value)
Append value to array at the end.
 
std::string asString() const
Returns the unquoted string value.
 
Blob const & peekData() const
 
static std::optional< base_uint > fromVoidChecked(T const &from)
 
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).
 
int constexpr pageLength(bool isBinary)
Maximum number of pages in a LedgerData response.
 
Status ledgerFromRequest(T &ledger, GRPCContext< R > &context)
 
std::pair< RPC::Status, LedgerEntryType > chooseLedgerEntryType(Json::Value const ¶ms)
 
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.
 
Keylet unchecked(uint256 const &key) noexcept
Any ledger entry.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::string serializeHex(STObject const &o)
Serialize an object to a hex string.
 
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
 
Json::Value doLedgerData(RPC::JsonContext &)
 
std::string to_string(base_uint< Bits, Tag > const &a)
 
@ ltANY
A special type, matching any ledger entry type.
 
Json::Value getJson(LedgerFill const &fill)
Return a new Json::Value representing the ledger with given options.
 
std::pair< org::xrpl::rpc::v1::GetLedgerDataResponse, grpc::Status > doLedgerDataGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerDataRequest > &context)