rippled
Loading...
Searching...
No Matches
LedgerRequest.cpp
1#include <xrpld/app/ledger/LedgerToJson.h>
2#include <xrpld/rpc/Context.h>
3#include <xrpld/rpc/detail/RPCLedgerHelpers.h>
4
5#include <xrpl/protocol/ErrorCodes.h>
6#include <xrpl/protocol/jss.h>
7
8#include <variant>
9
10namespace ripple {
11
12// {
13// ledger_hash : <ledger>
14// ledger_index : <ledger_index>
15// }
18{
19 auto res = getLedgerByContext(context);
20
22 return std::get<Json::Value>(res);
23
24 auto const& ledger = std::get<std::shared_ptr<Ledger const>>(res);
25
26 Json::Value jvResult;
27 jvResult[jss::ledger_index] = ledger->info().seq;
28 addJson(jvResult, {*ledger, &context, 0});
29 return jvResult;
30}
31
32} // namespace ripple
Represents a JSON value.
Definition json_value.h:131
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
Json::Value doLedgerRequest(RPC::JsonContext &)
void addJson(Json::Value &json, LedgerFill const &fill)
Given a Ledger and options, fill a Json::Object or Json::Value with a description of the ledger.