xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
handlers
ledger
src/xrpld/rpc/handlers/ledger/Ledger.h
1
#pragma once
2
3
#include <xrpld/app/main/Application.h>
4
#include <xrpld/app/misc/TxQ.h>
// IWYU pragma: keep
5
#include <xrpld/rpc/Context.h>
6
#include <xrpld/rpc/detail/SpecBridge.hpp>
7
8
#include <xrpl/json/json_value.h>
9
#include <xrpl/ledger/ReadView.h>
10
11
#include <rpcspec/Errors.hpp>
12
#include <rpcspec/handlers/ledger/Types.hpp>
13
14
#include <expected>
15
#include <
functional
>
16
#include <
memory
>
17
#include <
vector
>
18
19
namespace
xrpl::rpc
{
20
21
struct
JsonContext
;
22
23
// ledger [id|index|current|closed] [full]
24
// {
25
// ledger: 'current' | 'closed' | <UInt256> | <number>, // optional
26
// full: true | false // optional, defaults to false.
27
// }
28
34
class
LedgerHandler
:
public
HandlerFor<::rpc::spec::handlers::ledger::Input>
35
{
36
public
:
40
struct
Output
41
{
42
std::shared_ptr<ReadView const>
ledger
;
43
std::vector<TxQ::TxDetails>
queueTxs
;
44
int
options
= 0;
45
};
46
52
explicit
LedgerHandler
(
JsonContext
& context);
53
60
[[nodiscard]] std::expected<Output, ::rpc::Status>
61
process
(Input
const
& input);
62
69
void
70
writeResult
(
json::Value
& value,
Output
const
& output)
const
;
71
72
private
:
73
std::reference_wrapper<JsonContext>
context_
;
74
};
75
76
}
// namespace xrpl::rpc
json::Value
Represents a JSON value.
Definition
json_value.h:121
xrpl::rpc::LedgerHandler::process
std::expected< Output, ::rpc::Status > process(Input const &input)
Process the request.
Definition
xrpld/rpc/handlers/ledger/Ledger.cpp:44
xrpl::rpc::LedgerHandler::writeResult
void writeResult(json::Value &value, Output const &output) const
Write the output of process() into the response.
Definition
xrpld/rpc/handlers/ledger/Ledger.cpp:89
xrpl::rpc::LedgerHandler::LedgerHandler
LedgerHandler(JsonContext &context)
Construct a handler for a single request.
Definition
xrpld/rpc/handlers/ledger/Ledger.cpp:39
xrpl::rpc::LedgerHandler::context_
std::reference_wrapper< JsonContext > context_
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:73
functional
memory
xrpl::rpc
The api_version numbers this server serves.
Definition
ApiVersion.h:26
std::reference_wrapper
std::shared_ptr
xrpl::rpc::JsonContext
Definition
Context.h:41
xrpl::rpc::LedgerHandler::Output
The data a ledger request produces, written out by writeResult().
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:41
xrpl::rpc::LedgerHandler::Output::options
int options
The LedgerFill options to write the ledger with.
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:44
xrpl::rpc::LedgerHandler::Output::ledger
std::shared_ptr< ReadView const > ledger
The ledger the request selected.
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:42
xrpl::rpc::LedgerHandler::Output::queueTxs
std::vector< TxQ::TxDetails > queueTxs
The queued transactions, when requested.
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:43
vector
Generated by
1.17.0