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/GRPCHandlers.h>
27 #include <ripple/rpc/Role.h>
28 #include <ripple/rpc/impl/RPCHelpers.h>
29 #include <ripple/rpc/impl/Tuning.h>
48 auto const& params = context.
params;
54 bool const isMarker = params.isMember(jss::marker);
63 bool const isBinary = params[jss::binary].asBool();
66 if (params.isMember(jss::limit))
72 limit = jLimit.
asInt();
76 if ((limit < 0) || ((limit > maxLimit) && (!
isUnlimited(context.
role))))
80 jvResult[jss::ledger_index] = lpLedger->
info().
seq;
86 *lpLedger, &context, isBinary ? LedgerFill::Options::binary : 0));
93 rpcStatus.inject(jvResult);
110 if (type ==
ltANY || sle->getType() == type)
116 entry[jss::index] =
to_string(sle->key());
122 entry[jss::index] =
to_string(sle->key());
134 org::xrpl::rpc::v1::GetLedgerDataRequest& request = context.
params;
135 org::xrpl::rpc::v1::GetLedgerDataResponse response;
136 grpc::Status status = grpc::Status::OK;
141 grpc::Status errorStatus;
144 errorStatus = grpc::Status(
145 grpc::StatusCode::INVALID_ARGUMENT, status.message());
150 grpc::Status(grpc::StatusCode::NOT_FOUND, status.message());
152 return {response, errorStatus};
160 else if (request.marker().size() != 0)
162 grpc::Status errorStatus{
163 grpc::StatusCode::INVALID_ARGUMENT,
"marker malformed"};
164 return {response, errorStatus};
172 else if (request.end_marker().size() != 0)
174 grpc::Status errorStatus{
175 grpc::StatusCode::INVALID_ARGUMENT,
"end marker malformed"};
176 return {response, errorStatus};
189 response.set_marker(k.data(), k.size());
192 auto stateObject = response.mutable_ledger_objects()->add_objects();
196 stateObject->set_key(sle->key().data(), sle->key().size());
198 return {response, status};