22#include "data/AmendmentCenterInterface.hpp"
23#include "data/BackendInterface.hpp"
24#include "feed/SubscriptionManagerInterface.hpp"
25#include "feed/Types.hpp"
26#include "rpc/common/Specs.hpp"
27#include "rpc/common/Types.hpp"
29#include <boost/asio/spawn.hpp>
30#include <boost/json/array.hpp>
31#include <boost/json/conversion.hpp>
32#include <boost/json/object.hpp>
33#include <boost/json/value.hpp>
34#include <boost/json/value_to.hpp>
35#include <xrpl/beast/utility/Zero.h>
36#include <xrpl/protocol/Book.h>
37#include <xrpl/protocol/ErrorCodes.h>
38#include <xrpl/protocol/jss.h>
56 std::shared_ptr<BackendInterface> sharedPtrBackend_;
57 std::shared_ptr<data::AmendmentCenterInterface const> amendmentCenter_;
58 std::shared_ptr<feed::SubscriptionManagerInterface> subscriptions_;
67 std::optional<boost::json::object> ledger;
70 std::optional<boost::json::array> offers;
72 std::optional<boost::json::array> asks;
74 std::optional<boost::json::array> bids;
82 std::optional<std::string> taker;
83 bool snapshot =
false;
91 std::optional<std::vector<std::string>> accounts;
92 std::optional<std::vector<std::string>> streams;
93 std::optional<std::vector<std::string>> accountsProposed;
94 std::optional<std::vector<OrderBook>> books;
107 std::shared_ptr<BackendInterface>
const& sharedPtrBackend,
108 std::shared_ptr<data::AmendmentCenterInterface const>
const& amendmentCenter,
109 std::shared_ptr<feed::SubscriptionManagerInterface>
const& subscriptions
119 spec([[maybe_unused]] uint32_t apiVersion);
134 boost::asio::yield_context yield,
135 std::vector<std::string>
const& streams,
136 feed::SubscriberSharedPtr
const& session
140 subscribeToAccounts(std::vector<std::string>
const& accounts, feed::SubscriberSharedPtr
const& session)
const;
143 subscribeToAccountsProposed(std::vector<std::string>
const& accounts, feed::SubscriberSharedPtr
const& session)
148 std::vector<OrderBook>
const& books,
149 feed::SubscriberSharedPtr
const& session,
150 boost::asio::yield_context yield,
161 tag_invoke(boost::json::value_from_tag, boost::json::value& jv,
Output const& output);
170 tag_invoke(boost::json::value_to_tag<Input>, boost::json::value
const& jv);
Contains functionality for handling the subscribe command. The subscribe method requests periodic not...
Definition Subscribe.hpp:55
static RpcSpecConstRef spec(uint32_t apiVersion)
Returns the API specification for the command.
Definition Subscribe.cpp:67
Result process(Input input, Context const &ctx) const
Process the Subscribe command.
Definition Subscribe.cpp:116
SubscribeHandler(std::shared_ptr< BackendInterface > const &sharedPtrBackend, std::shared_ptr< data::AmendmentCenterInterface const > const &amendmentCenter, std::shared_ptr< feed::SubscriptionManagerInterface > const &subscriptions)
Construct a new BaseSubscribeHandler object.
Definition Subscribe.cpp:57
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert output to json value.
Definition Subscribe.cpp:249
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:37
RpcSpec const & RpcSpecConstRef
An alias for a const reference to RpcSpec.
Definition Specs.hpp:145
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:81
Context of an RPC call.
Definition Types.hpp:118
A struct to hold the data for one order book.
Definition Subscribe.hpp:80
A struct to hold the output data of the command.
Definition Subscribe.hpp:64