Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
TransactionEntry.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/conversion.hpp>
8#include <boost/json/object.hpp>
9#include <boost/json/value.hpp>
10#include <rpcspec/handlers/transaction_entry/Types.hpp>
11#include <xrpl/protocol/LedgerHeader.h>
12
13#include <cstdint>
14#include <memory>
15#include <optional>
16#include <utility>
17
18namespace rpc {
19
27 : public rpc::HandlerFor<rpc::spec::handlers::transaction_entry::Input> {
28 std::shared_ptr<BackendInterface> sharedPtrBackend_;
29
30public:
34 struct Output {
35 std::optional<xrpl::LedgerHeader> ledgerHeader;
36 // TODO: use a better type for this
37 boost::json::object metadata;
38 boost::json::object tx;
39 // validated should be sent via framework
40 bool validated = true;
41 uint32_t apiVersion;
42 };
43
44 using Result = HandlerReturnType<Output>;
45
51 TransactionEntryHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
52 : sharedPtrBackend_(std::move(sharedPtrBackend))
53 {
54 }
55
63 [[nodiscard]] Result
64 process(Input const& input, Context const& ctx) const;
65
66private:
73 friend void
74 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
75};
76
77} // namespace rpc
Result process(Input const &input, Context const &ctx) const
Process the transaction_entry command.
Definition TransactionEntry.cpp:21
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition TransactionEntry.cpp:72
TransactionEntryHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new Transaction Entry Handler object.
Definition TransactionEntry.hpp:51
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
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:109
A struct to hold the output data of the command.
Definition TransactionEntry.hpp:34