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;
42 uint32_t serial; // TODO: documented as 'nft_sequence' atm.
43 // https://github.com/XRPLF/xrpl-dev-portal/issues/1841
44 std::string uri;
45
46 // validated should be sent via framework
47 bool validated = true;
48 };
49
54
60 NFTInfoHandler(std::shared_ptr<BackendInterface> sharedPtrBackend)
61 : sharedPtrBackend_(std::move(sharedPtrBackend))
62 {
63 }
64
72 [[nodiscard]] Result
73 process(Input const& input, Context const& ctx) const;
74
75private:
82 friend void
83 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
84};
85
86} // 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:60
HandlerReturnType< Output > Result
The result type of the command: either the Output or an error status.
Definition NFTInfo.hpp:53
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: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 of the command.
Definition NFTInfo.hpp:30
uint32_t serial
Serial number of the NFT within its issuer.
Definition NFTInfo.hpp:42
uint32_t ledgerIndex
Sequence of the ledger used.
Definition NFTInfo.hpp:32
uint32_t flags
Flags set on the NFT.
Definition NFTInfo.hpp:35
std::string owner
Address of the current owner.
Definition NFTInfo.hpp:33
bool validated
Whether the ledger is validated.
Definition NFTInfo.hpp:47
std::string nftID
ID of the NFT.
Definition NFTInfo.hpp:31
std::string uri
Hex-encoded URI of the NFT.
Definition NFTInfo.hpp:44
bool isBurned
Whether the NFT has been burned.
Definition NFTInfo.hpp:34
std::string issuer
Address of the issuer.
Definition NFTInfo.hpp:37
uint32_t transferFee
Fee on secondary sales, in 1/100000 units.
Definition NFTInfo.hpp:36
uint32_t taxon
Taxon of the NFT.
Definition NFTInfo.hpp:38
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:132