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/MethodNames.h>
7
#include <xrpld/rpc/Role.h>
8
#include <xrpld/rpc/detail/Handler.h>
9
#include <xrpld/rpc/detail/SpecBridge.hpp>
10
11
#include <xrpl/json/json_value.h>
12
#include <xrpl/ledger/ReadView.h>
13
#include <xrpl/protocol/ApiVersion.h>
14
15
#include <rpcspec/Errors.hpp>
16
#include <rpcspec/handlers/ledger/Types.hpp>
17
18
#include <expected>
19
#include <
functional
>
20
#include <
memory
>
21
#include <
string_view
>
22
#include <
vector
>
23
24
namespace
xrpl::rpc
{
25
26
struct
JsonContext
;
27
28
// ledger [id|index|current|closed] [full]
29
// {
30
// ledger: 'current' | 'closed' | <UInt256> | <number>, // optional
31
// full: true | false // optional, defaults to false.
32
// }
33
34
class
LedgerHandler
:
public
HandlerFor<::rpc::spec::handlers::ledger::Input>
35
{
36
public
:
37
struct
Output
38
{
39
std::shared_ptr<ReadView const>
ledger
;
40
std::vector<TxQ::TxDetails>
queueTxs
;
41
int
options
= 0;
42
};
43
44
explicit
LedgerHandler
(
JsonContext
&);
45
46
[[nodiscard]] std::expected<Output, ::rpc::Status>
47
process
(Input
const
& input);
48
49
void
50
writeResult
(
json::Value
& value,
Output
const
& output)
const
;
51
52
// NOLINTBEGIN(readability-identifier-naming)
53
static
constexpr
std::string_view
name
=
method::kLedger
;
54
55
static
constexpr
unsigned
minApiVer
=
rpc::kApiMinimumSupportedVersion
;
56
57
static
constexpr
unsigned
maxApiVer
=
rpc::kApiMaximumValidVersion
;
58
59
static
constexpr
Role
role
=
Role::USER
;
60
61
static
constexpr
Condition
condition
=
Condition::NoCondition
;
62
// NOLINTEND(readability-identifier-naming)
63
64
private
:
65
std::reference_wrapper<JsonContext>
context_
;
66
};
67
68
}
// namespace xrpl::rpc
std::string_view
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::rpc::LedgerHandler::maxApiVer
static constexpr unsigned maxApiVer
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:57
xrpl::rpc::LedgerHandler::process
std::expected< Output, ::rpc::Status > process(Input const &input)
Definition
xrpld/rpc/handlers/ledger/Ledger.cpp:45
xrpl::rpc::LedgerHandler::LedgerHandler
LedgerHandler(JsonContext &)
Definition
xrpld/rpc/handlers/ledger/Ledger.cpp:40
xrpl::rpc::LedgerHandler::name
static constexpr std::string_view name
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:53
xrpl::rpc::LedgerHandler::condition
static constexpr Condition condition
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:61
xrpl::rpc::LedgerHandler::writeResult
void writeResult(json::Value &value, Output const &output) const
Definition
xrpld/rpc/handlers/ledger/Ledger.cpp:89
xrpl::rpc::LedgerHandler::minApiVer
static constexpr unsigned minApiVer
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:55
xrpl::rpc::LedgerHandler::context_
std::reference_wrapper< JsonContext > context_
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:65
xrpl::rpc::LedgerHandler::role
static constexpr Role role
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:59
functional
memory
xrpl::rpc::method::kLedger
constexpr std::string_view kLedger
Definition
MethodNames.h:46
xrpl::rpc
API version numbers used in later API versions.
Definition
ApiVersion.h:36
xrpl::rpc::kApiMaximumValidVersion
static constexpr auto kApiMaximumValidVersion
Definition
ApiVersion.h:47
xrpl::rpc::kApiMinimumSupportedVersion
static constexpr auto kApiMinimumSupportedVersion
Definition
ApiVersion.h:42
xrpl::rpc::Condition
Condition
Definition
Handler.h:22
xrpl::rpc::Condition::NoCondition
@ NoCondition
Definition
Handler.h:23
xrpl::Role
Role
Indicates the level of administrative permission to grant.
Definition
Role.h:27
xrpl::Role::USER
@ USER
Definition
Role.h:27
std::reference_wrapper
std::shared_ptr
string_view
xrpl::rpc::JsonContext
Definition
Context.h:41
xrpl::rpc::LedgerHandler::Output
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:38
xrpl::rpc::LedgerHandler::Output::options
int options
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:41
xrpl::rpc::LedgerHandler::Output::ledger
std::shared_ptr< ReadView const > ledger
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:39
xrpl::rpc::LedgerHandler::Output::queueTxs
std::vector< TxQ::TxDetails > queueTxs
Definition
src/xrpld/rpc/handlers/ledger/Ledger.h:40
vector
Generated by
1.17.0