3#include "data/BackendInterface.hpp"
4#include "etl/ETLServiceInterface.hpp"
7#include "rpc/common/JsonBool.hpp"
8#include "rpc/common/MetaProcessors.hpp"
9#include "rpc/common/Modifiers.hpp"
10#include "rpc/common/Specs.hpp"
11#include "rpc/common/Types.hpp"
12#include "rpc/common/Validators.hpp"
13#include "util/TxUtils.hpp"
14#include "util/log/Logger.hpp"
16#include <boost/json/array.hpp>
17#include <boost/json/conversion.hpp>
18#include <boost/json/object.hpp>
19#include <boost/json/value.hpp>
20#include <xrpl/protocol/ErrorCodes.h>
21#include <xrpl/protocol/TxFormats.h>
22#include <xrpl/protocol/jss.h>
28#include <unordered_set>
40 std::shared_ptr<BackendInterface> sharedPtrBackend_;
41 std::shared_ptr<etl::ETLServiceInterface const> etl_;
44 static constexpr auto kLIMIT_MIN = 1;
45 static constexpr auto kLIMIT_MAX = 1000;
46 static constexpr auto kLIMIT_DEFAULT = 200;
61 uint32_t ledgerIndexMin{0};
62 uint32_t ledgerIndexMax{0};
63 std::optional<uint32_t> limit;
64 std::optional<Marker> marker;
66 boost::json::array transactions;
68 bool validated =
true;
78 std::optional<std::string> ledgerHash;
79 std::optional<uint32_t> ledgerIndex;
80 std::optional<int32_t> ledgerIndexMin;
81 std::optional<int32_t> ledgerIndexMax;
82 bool usingValidatedLedger =
false;
85 std::optional<uint32_t> limit;
86 std::optional<Marker> marker;
87 std::optional<std::string> transactionTypeInLowercase;
99 std::shared_ptr<BackendInterface> sharedPtrBackend,
100 std::shared_ptr<etl::ETLServiceInterface const>
const& etl
102 : sharedPtrBackend_(std::move(sharedPtrBackend)), etl_{etl}
113 spec([[maybe_unused]] uint32_t apiVersion)
116 static auto const kRPC_SPEC_FOR_V1 =
RpcSpec{
130 Status{RippledError::rpcINVALID_PARAMS,
"invalidMarker"},
141 typesKeysInLowercase.cbegin(), typesKeysInLowercase.cend()
146 static auto const kRPC_SPEC =
RpcSpec{
154 return apiVersion == 1 ? kRPC_SPEC_FOR_V1 : kRPC_SPEC;
175 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
184 tag_invoke(boost::json::value_to_tag<Input>, boost::json::value
const& jv);
193 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Marker
const& marker);
Result process(Input const &input, Context const &ctx) const
Process the AccountTx command.
Definition AccountTx.cpp:36
AccountTxHandler(std::shared_ptr< BackendInterface > sharedPtrBackend, std::shared_ptr< etl::ETLServiceInterface const > const &etl)
Construct a new AccountTxHandler object.
Definition AccountTx.hpp:98
static RpcSpecConstRef spec(uint32_t apiVersion)
Returns the API specification for the command.
Definition AccountTx.hpp:113
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition AccountTx.cpp:212
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:77
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:18
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::unordered_set< std::string > const & getTxTypesInLowercase()
Get the transaction types in lowercase.
Definition TxUtils.cpp:18
A struct to hold the marker data.
Definition AccountTx.hpp:51
A struct to hold the output data of the command.
Definition AccountTx.hpp:59
Context of an RPC call.
Definition Types.hpp:99
A wrapper around bool that allows to convert from any JSON value.
Definition JsonBool.hpp:15
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:65
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 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