3#include "data/BackendInterface.hpp"
4#include "data/Types.hpp"
7#include "rpc/common/MetaProcessors.hpp"
8#include "rpc/common/Modifiers.hpp"
9#include "rpc/common/Specs.hpp"
10#include "rpc/common/Types.hpp"
11#include "rpc/common/Validators.hpp"
12#include "util/TxUtils.hpp"
13#include "util/log/Logger.hpp"
15#include <boost/json/array.hpp>
16#include <boost/json/conversion.hpp>
17#include <boost/json/object.hpp>
18#include <boost/json/value.hpp>
19#include <xrpl/basics/base_uint.h>
20#include <xrpl/protocol/ErrorCodes.h>
21#include <xrpl/protocol/jss.h>
42 std::shared_ptr<BackendInterface> sharedPtrBackend_;
49 std::shared_ptr<std::atomic_bool> migrated_ = std::make_shared<std::atomic_bool>(
false);
52 static constexpr auto kLimitMin = 1;
53 static constexpr auto kLimitMax = 100;
54 static constexpr auto kLimitDefault = 50;
61 static constexpr char const*
kMigratorName =
"MPTokenIssuanceHistoryMigrator";
75 std::string mptIssuanceID;
76 uint32_t ledgerIndexMin{0};
77 uint32_t ledgerIndexMax{0};
78 std::optional<uint32_t> limit;
79 std::optional<Marker> marker;
93 std::string mptIssuanceID;
94 std::optional<std::string> account;
95 std::optional<std::string> transactionTypeInLowercase;
96 std::optional<std::string> ledgerHash;
97 std::optional<uint32_t> ledgerIndex;
98 std::optional<int32_t> ledgerIndexMin;
99 std::optional<int32_t> ledgerIndexMax;
101 bool forward =
false;
102 std::optional<uint32_t> limit;
103 std::optional<Marker> marker;
114 : sharedPtrBackend_(std::move(sharedPtrBackend))
125 spec([[maybe_unused]] uint32_t apiVersion)
128 static auto const kRpcSpec =
RpcSpec{
129 {JS(mpt_issuance_id),
138 typesKeysInLowercase.cbegin(), typesKeysInLowercase.cend()
154 Status{RippledError::RpcInvalidParams,
"invalidMarker"}
179 struct SequenceRange {
194 verifyHistoryAvailable(Context
const& ctx)
const;
207 [[nodiscard]] std::expected<SequenceRange, Status>
208 resolveSequenceRange(Input
const& input, Context
const& ctx)
const;
226 xrpl::uint192
const& mptIssuanceID,
244 processTransactionsPage(
261 [[nodiscard]] std::optional<boost::json::object>
262 transactionToJsonIfTypeMatches(
280 [[nodiscard]] boost::json::object
281 expandedTransactionToJson(
282 boost::json::object txn,
283 boost::json::object meta,
295 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
304 tag_invoke(boost::json::value_to_tag<Input>, boost::json::value
const& jv);
313 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Marker
const& marker);
static RpcSpecConstRef spec(uint32_t apiVersion)
Returns the API specification for the command.
Definition MPTokenIssuanceHistory.hpp:125
Result process(Input const &input, Context const &ctx) const
Process the MPTokenIssuanceHistory command.
Definition MPTokenIssuanceHistory.cpp:47
MPTokenIssuanceHistoryHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new MPTokenIssuanceHistoryHandler object.
Definition MPTokenIssuanceHistory.hpp:113
static constexpr char const * kMigratorName
The name used to query the issuance-history migrator's status.
Definition MPTokenIssuanceHistory.hpp:61
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:286
Clamp value between min and max.
Definition Modifiers.hpp:23
Validate that value is equal or greater than the specified min.
Definition Validators.hpp:205
Validates that the value is one of the values passed in.
Definition Validators.hpp:364
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
RpcSpec const & RpcSpecConstRef
An alias for a const reference to RpcSpec.
Definition Specs.hpp:130
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:62
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:36
std::unordered_set< std::string > const & getTxTypesInLowercase()
Get the transaction types in lowercase.
Definition TxUtils.cpp:18
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:99
A struct to hold the input data for the command.
Definition MPTokenIssuanceHistory.hpp:92
A struct to hold the marker data.
Definition MPTokenIssuanceHistory.hpp:66
A struct to hold the output data of the command.
Definition MPTokenIssuanceHistory.hpp:74
boost::json::array transactions
Definition MPTokenIssuanceHistory.hpp:81
bool validated
Definition MPTokenIssuanceHistory.hpp:83
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:110
Represents a Specification of an entire RPC command.
Definition Specs.hpp:82
A status returned from any RPC handler.
Definition Errors.hpp:73
Convert input string to lower case.
Definition Modifiers.hpp:66
static CustomValidator accountValidator
Provides a commonly used validator for accounts.
Definition Validators.hpp:504
static CustomValidator ledgerIndexValidator
Provides a commonly used validator for ledger index.
Definition Validators.hpp:489
static CustomValidator uint192HexStringValidator
Provides a commonly used validator for uint192 hex string.
Definition Validators.hpp:543
static CustomValidator uint256HexStringValidator
Provides a commonly used validator for uint256 hex string.
Definition Validators.hpp:551
A validator that simply requires a field to be present.
Definition Validators.hpp:28
Validates that the type of the value is one of the given types.
Definition Validators.hpp:128