3#include "data/BackendInterface.hpp"
4#include "data/Types.hpp"
5#include "rpc/common/SpecBackend.hpp"
6#include "rpc/common/Types.hpp"
7#include "util/log/Logger.hpp"
9#include <boost/json/array.hpp>
10#include <boost/json/conversion.hpp>
11#include <boost/json/object.hpp>
12#include <boost/json/value.hpp>
13#include <rpcspec/handlers/mptoken_issuance_history/Types.hpp>
14#include <xrpl/basics/base_uint.h>
34 :
public rpc::HandlerFor<rpc::spec::handlers::mptoken_issuance_history::Input> {
36 std::shared_ptr<BackendInterface> sharedPtrBackend_;
43 std::shared_ptr<std::atomic_bool> migrated_ = std::make_shared<std::atomic_bool>(
false);
49 static constexpr auto kLimitMin = rpc::spec::handlers::mptoken_issuance_history::kLimitMin;
53 static constexpr auto kLimitMax = rpc::spec::handlers::mptoken_issuance_history::kLimitMax;
58 rpc::spec::handlers::mptoken_issuance_history::kLimitDefault;
65 static constexpr char const*
kMigratorName =
"MPTokenIssuanceHistoryMigrator";
70 using Marker = rpc::spec::handlers::mptoken_issuance_history::Marker;
104 : sharedPtrBackend_(std::move(sharedPtrBackend))
122 struct SequenceRange {
137 verifyHistoryAvailable(Context
const& ctx)
const;
150 [[nodiscard]] std::expected<SequenceRange, Status>
151 resolveSequenceRange(Input
const& input, Context
const& ctx)
const;
169 xrpl::uint192
const& mptIssuanceID,
187 processTransactionsPage(
204 [[nodiscard]] std::optional<boost::json::object>
205 transactionToJsonIfTypeMatches(
223 [[nodiscard]] boost::json::object
224 expandedTransactionToJson(
225 boost::json::object txn,
226 boost::json::object meta,
238 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
256tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Marker
const& marker);
HandlerReturnType< Output > Result
The result type of the command: either the Output or an error status.
Definition MPTokenIssuanceHistory.hpp:96
Result process(Input const &input, Context const &ctx) const
Process the MPTokenIssuanceHistory command.
Definition MPTokenIssuanceHistory.cpp:48
MPTokenIssuanceHistoryHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new MPTokenIssuanceHistoryHandler object.
Definition MPTokenIssuanceHistory.hpp:103
static constexpr auto kLimitMax
Maximum allowed value of the limit parameter.
Definition MPTokenIssuanceHistory.hpp:53
rpc::spec::handlers::mptoken_issuance_history::Marker Marker
A struct to hold the marker data.
Definition MPTokenIssuanceHistory.hpp:70
static constexpr auto kLimitDefault
Default value of the limit parameter.
Definition MPTokenIssuanceHistory.hpp:57
static constexpr char const * kMigratorName
The name used to query the issuance-history migrator's status.
Definition MPTokenIssuanceHistory.hpp:65
static constexpr auto kLimitMin
Minimum allowed value of the limit parameter.
Definition MPTokenIssuanceHistory.hpp:49
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition MPTokenIssuanceHistory.cpp:283
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:110
JSON conversions for the mptoken_issuance_history spec types used by MPTokenIssuanceHistoryHandler.
Definition MPTokenIssuanceHistory.cpp:306
void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Marker const &marker)
Convert the Marker to a JSON object.
Definition MPTokenIssuanceHistory.cpp:309
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
std::expected< void, Status > MaybeError
Return type used for Validators that can return error but don't have specific value to return.
Definition Types.hpp:35
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition SpecBackend.hpp:24
Represests a bundle of transactions with metadata and a cursor to the next page.
Definition Types.hpp:156
Context of an RPC call.
Definition Types.hpp:102
A struct to hold the output data of the command.
Definition MPTokenIssuanceHistory.hpp:75
boost::json::array transactions
Transactions that affected the issuance.
Definition MPTokenIssuanceHistory.hpp:85
std::optional< uint32_t > limit
Limit from the request; unset if the default was used.
Definition MPTokenIssuanceHistory.hpp:79
uint32_t ledgerIndexMin
Lowest ledger sequence searched.
Definition MPTokenIssuanceHistory.hpp:77
bool validated
Whether the ledger is validated.
Definition MPTokenIssuanceHistory.hpp:90
std::string mptIssuanceID
ID of the queried MPTokenIssuance.
Definition MPTokenIssuanceHistory.hpp:76
uint32_t ledgerIndexMax
Highest ledger sequence searched.
Definition MPTokenIssuanceHistory.hpp:78
std::optional< Marker > marker
Marker to resume from, if more results remain.
Definition MPTokenIssuanceHistory.hpp:80
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:132