Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
NFTInfo.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/nft_info/Types.hpp>
10
11#include <cstdint>
12#include <memory>
13#include <string>
14#include <utility>
15
16namespace rpc {
17
23class NFTInfoHandler : public rpc::HandlerFor<rpc::spec::handlers::nft_info::Input> {
24 std::shared_ptr<BackendInterface> sharedPtrBackend_;
25
26public:
30 struct Output {
31 std::string nftID;
32 uint32_t ledgerIndex;
33 std::string owner;
34 bool isBurned;
35 uint32_t flags;
36 uint32_t transferFee;
37 std::string issuer;
38 uint32_t taxon;
39 uint32_t serial; // TODO: documented as 'nft_sequence' atm.
40 // https://github.com/XRPLF/xrpl-dev-portal/issues/1841
41 std::string uri;
42
43 // validated should be sent via framework
44 bool validated = true;
45 };
46
47 using Result = HandlerReturnType<Output>;
48
54 NFTInfoHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
55 : sharedPtrBackend_(std::move(sharedPtrBackend))
56 {
57 }
58
66 [[nodiscard]] Result
67 process(Input const& input, Context const& ctx) const;
68
69private:
76 friend void
77 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
78};
79
80} // namespace rpc
Result process(Input const &input, Context const &ctx) const
Process the NFTInfo command.
Definition NFTInfo.cpp:25
NFTInfoHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new NFTInfoHandler object.
Definition NFTInfo.hpp:54
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition NFTInfo.cpp:70
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 NFTInfo.hpp:30
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:109