3#include "data/BackendInterface.hpp"
5#include "rpc/common/Checkers.hpp"
6#include "rpc/common/MetaProcessors.hpp"
7#include "rpc/common/Specs.hpp"
8#include "rpc/common/Types.hpp"
9#include "rpc/common/Validators.hpp"
10#include "util/log/Logger.hpp"
12#include <boost/json/array.hpp>
13#include <boost/json/conversion.hpp>
14#include <boost/json/object.hpp>
15#include <boost/json/value.hpp>
16#include <xrpl/basics/base_uint.h>
17#include <xrpl/protocol/ErrorCodes.h>
18#include <xrpl/protocol/jss.h>
35 std::shared_ptr<BackendInterface> sharedPtrBackend_;
40 static constexpr uint32_t kLIMIT_BINARY = 2048;
41 static constexpr uint32_t kLIMIT_JSON = 256;
47 uint32_t ledgerIndex{};
48 std::string ledgerHash;
49 std::optional<boost::json::object> header;
50 boost::json::array states;
51 std::optional<std::string> marker;
52 std::optional<uint32_t> diffMarker;
53 std::optional<bool> cacheFull;
54 bool validated =
true;
64 std::optional<std::string> ledgerHash;
65 std::optional<uint32_t> ledgerIndex;
67 uint32_t limit = LedgerDataHandler::kLIMIT_JSON;
68 std::optional<ripple::uint256> marker;
69 std::optional<uint32_t> diffMarker;
70 bool outOfOrder =
false;
71 ripple::LedgerEntryType type = ripple::LedgerEntryType::ltANY;
82 : sharedPtrBackend_(std::move(sharedPtrBackend))
93 spec([[maybe_unused]] uint32_t apiVersion)
95 static auto const kRPC_SPEC =
RpcSpec{
128 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
137 tag_invoke(boost::json::value_to_tag<Input>, boost::json::value
const& jv);
Result process(Input const &input, Context const &ctx) const
Process the LedgerData command.
Definition LedgerData.cpp:37
LedgerDataHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new LedgerDataHandler object.
Definition LedgerData.hpp:81
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition LedgerData.cpp:149
static RpcSpecConstRef spec(uint32_t apiVersion)
Returns the API specification for the command.
Definition LedgerData.hpp:93
Check for a deprecated fields.
Definition Checkers.hpp:44
Validate that value is equal or greater than the specified min.
Definition Validators.hpp:205
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:77
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:18
RpcSpec const & RpcSpecConstRef
An alias for a const reference to RpcSpec.
Definition Specs.hpp:130
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:62
Context of an RPC call.
Definition Types.hpp:99
A struct to hold the output data of the command.
Definition LedgerData.hpp:46
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:110
Represents a Specification of an entire RPC command.
Definition Specs.hpp:82
static CustomValidator ledgerTypeValidator
Provides a validator for ledger type.
Definition Validators.hpp:497
static CustomValidator ledgerIndexValidator
Provides a commonly used validator for ledger index.
Definition Validators.hpp:489
static CustomValidator uint256HexStringValidator
Provides a commonly used validator for uint256 hex string.
Definition Validators.hpp:551
Validates that the type of the value is one of the given types.
Definition Validators.hpp:128