3#include "data/AmendmentCenterInterface.hpp"
4#include "data/BackendInterface.hpp"
5#include "rpc/common/SpecBackend.hpp"
6#include "rpc/common/Types.hpp"
8#include <boost/json/array.hpp>
9#include <boost/json/conversion.hpp>
10#include <boost/json/value.hpp>
11#include <rpcspec/handlers/amm_info/Types.hpp>
27 std::shared_ptr<BackendInterface> sharedPtrBackend_;
28 std::shared_ptr<data::AmendmentCenterInterface const> amendmentCenter_;
63 std::shared_ptr<BackendInterface> sharedPtrBackend,
64 std::shared_ptr<data::AmendmentCenterInterface const>
const& amendmentCenter
66 : sharedPtrBackend_(std::move(sharedPtrBackend)), amendmentCenter_{amendmentCenter}
88 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
Result process(Input const &input, Context const &ctx) const
Process the AMMInfo command.
Definition AMMInfo.cpp:56
HandlerReturnType< Output > Result
The result type of the command: the Output on success or an error Status.
Definition AMMInfo.hpp:54
AMMInfoHandler(std::shared_ptr< BackendInterface > sharedPtrBackend, std::shared_ptr< data::AmendmentCenterInterface const > const &amendmentCenter)
Construct a new AMMInfoHandler object.
Definition AMMInfo.hpp:62
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition AMMInfo.cpp:223
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 the output data of the command.
Definition AMMInfo.hpp:34
std::uint16_t tradingFee
Trading fee in units of 1/100,000.
Definition AMMInfo.hpp:41
std::string ammAccount
Address of the AMM's special account.
Definition AMMInfo.hpp:42
std::string ledgerHash
Hash of the ledger the info was taken from.
Definition AMMInfo.hpp:46
boost::json::value amount2
Balance of the second asset in the AMM pool.
Definition AMMInfo.hpp:37
uint32_t ledgerIndex
Sequence of the ledger the info was taken from.
Definition AMMInfo.hpp:47
boost::json::value auctionSlot
Current auction slot holder info; null if none.
Definition AMMInfo.hpp:40
boost::json::array voteSlots
Current trading fee votes (account, fee, weight).
Definition AMMInfo.hpp:39
std::optional< bool > asset1Frozen
Whether the first asset is frozen; unset for XRP.
Definition AMMInfo.hpp:43
boost::json::value lpToken
LP tokens of account if given, else total.
Definition AMMInfo.hpp:38
bool validated
Whether the ledger is validated.
Definition AMMInfo.hpp:48
boost::json::value amount1
Balance of the first asset in the AMM pool.
Definition AMMInfo.hpp:36
std::optional< bool > asset2Frozen
Whether the second asset is frozen; unset for XRP.
Definition AMMInfo.hpp:44
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