Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
NoRippleCheck.hpp
1#pragma once
2
3#include "data/BackendInterface.hpp"
4#include "rpc/common/SpecBackend.hpp"
5#include "rpc/common/Types.hpp"
6
7#include <boost/json/array.hpp>
8#include <boost/json/conversion.hpp>
9#include <boost/json/value.hpp>
10#include <rpcspec/handlers/noripple_check/Types.hpp>
11
12#include <cstdint>
13#include <memory>
14#include <optional>
15#include <string>
16#include <utility>
17#include <vector>
18
19namespace rpc {
20
29class NoRippleCheckHandler : public rpc::HandlerFor<rpc::spec::handlers::noripple_check::Input> {
30 std::shared_ptr<BackendInterface> sharedPtrBackend_;
31
32public:
33 static constexpr auto kLimitMin = 1;
34 static constexpr auto kLimitMax = 500;
35 static constexpr auto kLimitDefault = 300;
36
40 struct Output {
41 std::string ledgerHash;
42 uint32_t ledgerIndex{};
43 std::vector<std::string> problems;
44 // TODO: use better type than json
45 std::optional<boost::json::array> transactions;
46 bool validated = true;
47 };
48
49 using Result = HandlerReturnType<Output>;
50
56 NoRippleCheckHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
57 : sharedPtrBackend_(std::move(sharedPtrBackend))
58 {
59 }
60
68 [[nodiscard]] Result
69 process(Input const& input, Context const& ctx) const;
70
71private:
78 friend void
79 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
80};
81} // namespace rpc
NoRippleCheckHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new NoRippleCheckHandler object.
Definition NoRippleCheck.hpp:56
Result process(Input const &input, Context const &ctx) const
Process the NoRippleCheck command.
Definition NoRippleCheck.cpp:38
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition NoRippleCheck.cpp:174
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:17
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:61
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition SpecBackend.hpp:24
Context of an RPC call.
Definition Types.hpp:98
A struct to hold the output data of the command.
Definition NoRippleCheck.hpp:40
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:109