Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
VaultInfo.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/vault_info/Types.hpp>
10
11#include <cstdint>
12#include <memory>
13
14namespace rpc {
15
19class VaultInfoHandler : public rpc::HandlerFor<rpc::spec::handlers::vault_info::Input> {
20 std::shared_ptr<BackendInterface> sharedPtrBackend_;
21
22public:
28 VaultInfoHandler(std::shared_ptr<BackendInterface> sharedPtrBackend);
29
33 struct Output {
34 boost::json::value vault;
35 uint32_t ledgerIndex{};
36 bool validated = true;
37 };
38
43
51 [[nodiscard]] Result
52 process(Input const& input, Context const& ctx) const;
53
54private:
61 friend void
62 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
63};
64
65} // namespace rpc
Result process(Input const &input, Context const &ctx) const
Process the VaultInfo command.
Definition VaultInfo.cpp:59
HandlerReturnType< Output > Result
The result type of the command: either the Output or an error status.
Definition VaultInfo.hpp:42
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition VaultInfo.cpp:138
VaultInfoHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new VaultInfo object.
Definition VaultInfo.cpp:53
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
Context of an RPC call.
Definition Types.hpp:102
A struct to hold the output data for the command.
Definition VaultInfo.hpp:33
uint32_t ledgerIndex
Sequence of the ledger used.
Definition VaultInfo.hpp:35
bool validated
Whether the ledger is validated.
Definition VaultInfo.hpp:36
boost::json::value vault
Vault object as JSON; share issuance in shares.
Definition VaultInfo.hpp:34