Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
AccountInfo.hpp
1#pragma once
2
3#include "data/AmendmentCenterInterface.hpp"
4#include "data/BackendInterface.hpp"
5#include "rpc/common/SpecBackend.hpp"
6#include "rpc/common/Types.hpp"
7
8#include <boost/json/conversion.hpp>
9#include <boost/json/value.hpp>
10#include <rpcspec/handlers/account_info/Types.hpp>
11#include <xrpl/protocol/STLedgerEntry.h>
12
13#include <cstdint>
14#include <memory>
15#include <optional>
16#include <string>
17#include <vector>
18
19namespace rpc {
20
27class AccountInfoHandler : public rpc::HandlerFor<rpc::spec::handlers::account_info::Input> {
28 std::shared_ptr<BackendInterface> sharedPtrBackend_;
29 std::shared_ptr<data::AmendmentCenterInterface const> amendmentCenter_;
30
31public:
35 struct Output {
36 uint32_t ledgerIndex;
37 std::string ledgerHash;
38 xrpl::STLedgerEntry accountData;
39 bool isDisallowIncomingEnabled = false;
40 bool isClawbackEnabled = false;
41 bool isTokenEscrowEnabled = false;
42 uint32_t apiVersion;
43 std::optional<std::vector<xrpl::STLedgerEntry>> signerLists;
44 // validated should be sent via framework
45 bool validated = true;
46 };
47
48 using Result = HandlerReturnType<Output>;
49
57 std::shared_ptr<BackendInterface> sharedPtrBackend,
58 std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter
59 )
60 : sharedPtrBackend_(std::move(sharedPtrBackend)), amendmentCenter_{amendmentCenter}
61 {
62 }
63
71 [[nodiscard]] Result
72 process(Input const& input, Context const& ctx) const;
73
74private:
81 friend void
82 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
83};
84
85} // 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 AccountInfo.cpp:121
AccountInfoHandler(std::shared_ptr< BackendInterface > sharedPtrBackend, std::shared_ptr< data::AmendmentCenterInterface const > const &amendmentCenter)
Construct a new AccountInfoHandler object.
Definition AccountInfo.hpp:56
Result process(Input const &input, Context const &ctx) const
Process the AccountInfo command.
Definition AccountInfo.cpp:34
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
A struct to hold the output data of the command.
Definition AccountInfo.hpp:35
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