Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
AccountCurrencies.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/value.hpp>
9#include <rpcspec/handlers/account_currencies/Types.hpp>
10
11#include <cstdint>
12#include <memory>
13#include <set>
14#include <string>
15
16namespace rpc {
17
25 : public rpc::HandlerFor<rpc::spec::handlers::account_currencies::Input> {
26 // dependencies
27 std::shared_ptr<BackendInterface> sharedPtrBackend_;
28
29public:
33 struct Output {
34 std::string ledgerHash;
35 uint32_t ledgerIndex{};
36 std::set<std::string> receiveCurrencies;
37 std::set<std::string> sendCurrencies;
38 // validated should be sent via framework
39 bool validated = true;
40 };
41
46
52 AccountCurrenciesHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
53 : sharedPtrBackend_(std::move(sharedPtrBackend))
54 {
55 }
56
64 [[nodiscard]] Result
65 process(Input const& input, Context const& ctx) const;
66
67private:
74 friend void
75 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
76};
77
78} // namespace rpc
Result process(Input const &input, Context const &ctx) const
Process the AccountCurrencies command.
Definition AccountCurrencies.cpp:27
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition AccountCurrencies.cpp:100
AccountCurrenciesHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new AccountCurrenciesHandler object.
Definition AccountCurrencies.hpp:52
HandlerReturnType< Output > Result
The result type of the command: the Output on success or an error Status.
Definition AccountCurrencies.hpp:45
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:63
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition SpecBackend.hpp:24
A struct to hold the output data of the command.
Definition AccountCurrencies.hpp:33
uint32_t ledgerIndex
Sequence of the ledger used for the request.
Definition AccountCurrencies.hpp:35
std::set< std::string > receiveCurrencies
Currencies the account can receive.
Definition AccountCurrencies.hpp:36
std::set< std::string > sendCurrencies
Currencies the account can send.
Definition AccountCurrencies.hpp:37
std::string ledgerHash
Hash of the ledger used for the request.
Definition AccountCurrencies.hpp:34
bool validated
Whether the ledger is validated.
Definition AccountCurrencies.hpp:39
Context of an RPC call.
Definition Types.hpp:102
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:132