Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
DepositAuthorized.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/deposit_authorized/Types.hpp>
11#include <xrpl/basics/base_uint.h>
12#include <xrpl/protocol/STArray.h>
13
14#include <cstdint>
15#include <expected>
16#include <memory>
17#include <optional>
18#include <string>
19#include <utility>
20#include <vector>
21
22namespace rpc {
23
34 : public rpc::HandlerFor<rpc::spec::handlers::deposit_authorized::Input> {
35 // dependencies
36 std::shared_ptr<BackendInterface> const sharedPtrBackend_;
37
38public:
39 // Note: `ledger_current_index` is omitted because it only makes sense for rippled
43 struct Output {
44 bool depositAuthorized = true;
45 std::string sourceAccount;
46 std::string destinationAccount;
47 std::string ledgerHash;
48 uint32_t ledgerIndex{};
49 std::optional<std::vector<xrpl::uint256>> credentials;
50
51 // validated should be sent via framework
52 bool validated = true;
53 };
54
55 using Result = HandlerReturnType<Output>;
56
62 DepositAuthorizedHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
63 : sharedPtrBackend_(std::move(sharedPtrBackend))
64 {
65 }
66
74 [[nodiscard]] Result
75 process(Input const& input, Context const& ctx) const;
76
77private:
84 friend void
85 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
86};
87
88} // namespace rpc
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition DepositAuthorized.cpp:130
DepositAuthorizedHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new DepositAuthorizedHandler object.
Definition DepositAuthorized.hpp:62
Result process(Input const &input, Context const &ctx) const
Process the DepositAuthorized command.
Definition DepositAuthorized.cpp:35
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 DepositAuthorized.hpp:43
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:109