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);
46 static constexpr auto kLimitMin = rpc::spec::handlers::mptoken_issuance_history::kLimitMin;
47 static constexpr auto kLimitMax = rpc::spec::handlers::mptoken_issuance_history::kLimitMax;
48 static constexpr auto kLimitDefault =
49 rpc::spec::handlers::mptoken_issuance_history::kLimitDefault;
56 static constexpr char const*
kMigratorName =
"MPTokenIssuanceHistoryMigrator";
61 using Marker = rpc::spec::handlers::mptoken_issuance_history::Marker;
67 std::string mptIssuanceID;
68 uint32_t ledgerIndexMin{0};
69 uint32_t ledgerIndexMax{0};
70 std::optional<uint32_t> limit;
71 std::optional<Marker> marker;
86 : sharedPtrBackend_(std::move(sharedPtrBackend))
104 struct SequenceRange {
119 verifyHistoryAvailable(Context
const& ctx)
const;
132 [[nodiscard]] std::expected<SequenceRange, Status>
133 resolveSequenceRange(Input
const& input, Context
const& ctx)
const;
151 xrpl::uint192
const& mptIssuanceID,
169 processTransactionsPage(
186 [[nodiscard]] std::optional<boost::json::object>
187 transactionToJsonIfTypeMatches(
205 [[nodiscard]] boost::json::object
206 expandedTransactionToJson(
207 boost::json::object txn,
208 boost::json::object meta,
220 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
225namespace rpc::spec::handlers::mptoken_issuance_history {
228tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Marker
const& marker);
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:85
rpc::spec::handlers::mptoken_issuance_history::Marker Marker
A struct to hold the marker data.
Definition MPTokenIssuanceHistory.hpp:61
static constexpr char const * kMigratorName
The name used to query the issuance-history migrator's status.
Definition MPTokenIssuanceHistory.hpp:56
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:78
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
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:153
Context of an RPC call.
Definition Types.hpp:98
A struct to hold the output data of the command.
Definition MPTokenIssuanceHistory.hpp:66
boost::json::array transactions
Definition MPTokenIssuanceHistory.hpp:73
bool validated
Definition MPTokenIssuanceHistory.hpp:75
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:109