xrpld
Loading...
Searching...
No Matches
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
19namespace xrpl::rpc {
20
21struct 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
34class LedgerHandler : public HandlerFor<::rpc::spec::handlers::ledger::Input>
35{
36public:
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
72private:
74};
75
76} // namespace xrpl::rpc
Represents a JSON value.
Definition json_value.h:121
std::expected< Output, ::rpc::Status > process(Input const &input)
Process the request.
void writeResult(json::Value &value, Output const &output) const
Write the output of process() into the response.
LedgerHandler(JsonContext &context)
Construct a handler for a single request.
std::reference_wrapper< JsonContext > context_
The api_version numbers this server serves.
Definition ApiVersion.h:26
The data a ledger request produces, written out by writeResult().
int options
The LedgerFill options to write the ledger with.
std::shared_ptr< ReadView const > ledger
The ledger the request selected.
std::vector< TxQ::TxDetails > queueTxs
The queued transactions, when requested.