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
#include <xrpl/resource/Fees.h>
8
9
namespace
xrpl
{
10
11
// {
12
// ledger_hash : <ledger>
13
// ledger_index : <ledger_index>
14
// }
15
Json::Value
16
doLedgerRequest
(
RPC::JsonContext
& context)
17
{
18
context.
loadType
=
Resource::feeHeavyBurdenRPC
;
19
auto
res =
RPC::getOrAcquireLedger
(context);
20
21
if
(!res.has_value())
22
return
res.error();
23
24
auto
const
& ledger = res.value();
25
26
Json::Value
jvResult;
27
jvResult[jss::ledger_index] = ledger->header().seq;
28
addJson
(jvResult, {*ledger, &context, 0});
29
return
jvResult;
30
}
31
32
}
// namespace xrpl
Json::Value
Represents a JSON value.
Definition
json_value.h:131
xrpl::RPC::getOrAcquireLedger
Expected< std::shared_ptr< Ledger const >, Json::Value > getOrAcquireLedger(RPC::JsonContext const &context)
Retrieves or acquires a ledger based on the parameters provided in the given JsonContext.
Definition
RPCLedgerHelpers.cpp:392
xrpl::Resource::feeHeavyBurdenRPC
Charge const feeHeavyBurdenRPC
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:6
xrpl::doLedgerRequest
Json::Value doLedgerRequest(RPC::JsonContext &)
Definition
LedgerRequest.cpp:16
xrpl::addJson
void addJson(Json::Value &json, LedgerFill const &fill)
Given a Ledger and options, fill a Json::Value with a description of the ledger.
Definition
LedgerToJson.cpp:322
xrpl::RPC::Context::loadType
Resource::Charge & loadType
Definition
Context.h:23
xrpl::RPC::JsonContext
Definition
Context.h:34
Generated by
1.9.8