rippled
Loading...
Searching...
No Matches
xrpld
rpc
handlers
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
10
namespace
ripple
{
11
12
// {
13
// ledger_hash : <ledger>
14
// ledger_index : <ledger_index>
15
// }
16
Json::Value
17
doLedgerRequest
(
RPC::JsonContext
& context)
18
{
19
auto
res = getLedgerByContext(context);
20
21
if
(
std::holds_alternative<Json::Value>
(res))
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
Json::Value
Represents a JSON value.
Definition
json_value.h:131
std::is_same_v
T is_same_v
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:6
ripple::doLedgerRequest
Json::Value doLedgerRequest(RPC::JsonContext &)
Definition
LedgerRequest.cpp:17
ripple::addJson
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.
Definition
LedgerToJson.cpp:328
ripple::RPC::JsonContext
Definition
Context.h:34
variant
Generated by
1.9.8