3#include "data/BackendInterface.hpp"
4#include "rpc/common/SpecBackend.hpp"
5#include "rpc/common/Types.hpp"
7#include <boost/json/conversion.hpp>
8#include <boost/json/value.hpp>
9#include <rpcspec/handlers/account_offers/Types.hpp>
10#include <xrpl/protocol/STAmount.h>
11#include <xrpl/protocol/STLedgerEntry.h>
28 std::shared_ptr<BackendInterface> sharedPtrBackend_;
34 static constexpr auto kLimitMin = rpc::spec::handlers::account_offers::kLimitMin;
38 static constexpr auto kLimitMax = rpc::spec::handlers::account_offers::kLimitMax;
42 static constexpr auto kLimitDefault = rpc::spec::handlers::account_offers::kLimitDefault;
80 : sharedPtrBackend_(std::move(sharedPtrBackend))
96 addOffer(std::vector<Offer>& offers, xrpl::SLE
const& offerSle);
105 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
114 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Offer
const& offer);
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition AccountOffers.cpp:105
static constexpr auto kLimitMin
Minimum accepted value for the limit request field.
Definition AccountOffers.hpp:34
static constexpr auto kLimitDefault
Value of limit used when the request does not specify one.
Definition AccountOffers.hpp:42
Result process(Input const &input, Context const &ctx) const
Process the AccountOffers command.
Definition AccountOffers.cpp:48
AccountOffersHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new AccountOffersHandler object.
Definition AccountOffers.hpp:79
HandlerReturnType< Output > Result
The result type of the command: the Output on success or an error Status.
Definition AccountOffers.hpp:72
static constexpr auto kLimitMax
Maximum accepted value for the limit request field.
Definition AccountOffers.hpp:38
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
A struct to hold data for one offer response.
Definition AccountOffers.hpp:47
xrpl::STAmount takerPays
Amount the offer creator wants in return.
Definition AccountOffers.hpp:51
uint32_t seq
Sequence number of the transaction that created the offer.
Definition AccountOffers.hpp:49
uint32_t flags
Flags set on the offer.
Definition AccountOffers.hpp:48
std::optional< uint32_t > expiration
Time after which the offer is no longer active.
Definition AccountOffers.hpp:53
xrpl::STAmount takerGets
Amount the offer creator is selling.
Definition AccountOffers.hpp:50
std::string quality
Exchange rate of the offer (takerPays / takerGets).
Definition AccountOffers.hpp:52
A struct to hold the output data of the command.
Definition AccountOffers.hpp:59
std::string ledgerHash
Hash of the ledger used for the request.
Definition AccountOffers.hpp:61
std::string account
The account whose offers are returned.
Definition AccountOffers.hpp:60
uint32_t ledgerIndex
Sequence of the ledger used for the request.
Definition AccountOffers.hpp:62
bool validated
Whether the ledger is validated.
Definition AccountOffers.hpp:66
std::vector< Offer > offers
Offers owned by the account.
Definition AccountOffers.hpp:63
std::optional< std::string > marker
Pagination marker to resume from, if more results.
Definition AccountOffers.hpp:64
Context of an RPC call.
Definition Types.hpp:102
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:132