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;
40 bool isClawbackEnabled = false;
41 bool isTokenEscrowEnabled = false;
42 uint32_t apiVersion;
46 std::optional<std::vector<xrpl::STLedgerEntry>> signerLists;
47 // validated should be sent via framework
48 bool validated = true;
49 };
50
55
63 std::shared_ptr<BackendInterface> sharedPtrBackend,
64 std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter
65 )
66 : sharedPtrBackend_(std::move(sharedPtrBackend)), amendmentCenter_{amendmentCenter}
67 {
68 }
69
77 [[nodiscard]] Result
78 process(Input const& input, Context const& ctx) const;
79
80private:
87 friend void
88 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
89};
90
91} // 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
HandlerReturnType< Output > Result
The result type of the command: the Output on success or an error Status.
Definition AccountInfo.hpp:54
AccountInfoHandler(std::shared_ptr< BackendInterface > sharedPtrBackend, std::shared_ptr< data::AmendmentCenterInterface const > const &amendmentCenter)
Construct a new AccountInfoHandler object.
Definition AccountInfo.hpp:62
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: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 AccountInfo.hpp:35
uint32_t ledgerIndex
Sequence of the ledger used for the request.
Definition AccountInfo.hpp:36
bool isDisallowIncomingEnabled
Whether DisallowIncoming amendment is enabled.
Definition AccountInfo.hpp:39
xrpl::STLedgerEntry accountData
The AccountRoot ledger entry of the account.
Definition AccountInfo.hpp:38
bool isTokenEscrowEnabled
Whether the TokenEscrow amendment is enabled.
Definition AccountInfo.hpp:41
bool isClawbackEnabled
Whether the Clawback amendment is enabled.
Definition AccountInfo.hpp:40
uint32_t apiVersion
API version of the request; affects signer_lists placement.
Definition AccountInfo.hpp:42
std::optional< std::vector< xrpl::STLedgerEntry > > signerLists
SignerList ledger entries of the account; set only if requested.
Definition AccountInfo.hpp:46
std::string ledgerHash
Hash of the ledger used for the request.
Definition AccountInfo.hpp:37
bool validated
Whether the ledger is validated.
Definition AccountInfo.hpp:48
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