3#include "data/AmendmentCenterInterface.hpp"
4#include "data/BackendInterface.hpp"
5#include "feed/SubscriptionManagerInterface.hpp"
6#include "feed/Types.hpp"
7#include "rpc/common/SpecBackend.hpp"
8#include "rpc/common/Types.hpp"
10#include <boost/asio/spawn.hpp>
11#include <boost/json/array.hpp>
12#include <boost/json/conversion.hpp>
13#include <boost/json/object.hpp>
14#include <boost/json/value.hpp>
15#include <rpcspec/handlers/subscribe/Types.hpp>
16#include <xrpl/protocol/AccountID.h>
17#include <xrpl/protocol/UintTypes.h>
34 std::shared_ptr<BackendInterface> sharedPtrBackend_;
35 std::shared_ptr<data::AmendmentCenterInterface const> amendmentCenter_;
36 std::shared_ptr<feed::SubscriptionManagerInterface> subscriptions_;
45 std::optional<boost::json::object> ledger;
49 std::optional<boost::json::array> offers;
51 std::optional<boost::json::array> asks;
53 std::optional<boost::json::array> bids;
59 using OrderBook = rpc::spec::handlers::subscribe::OrderBook;
64 using StreamType = rpc::spec::handlers::subscribe::StreamType;
76 std::shared_ptr<BackendInterface> sharedPtrBackend,
77 std::shared_ptr<data::AmendmentCenterInterface const>
const& amendmentCenter,
78 std::shared_ptr<feed::SubscriptionManagerInterface>
const& subscriptions
92 [[nodiscard]] boost::json::object
94 boost::asio::yield_context yield,
95 std::vector<StreamType>
const& streams,
96 feed::SubscriberSharedPtr
const& session
101 std::vector<xrpl::AccountID>
const& accounts,
102 feed::SubscriberSharedPtr
const& session
106 subscribeToAccountsProposed(
107 std::vector<xrpl::AccountID>
const& accounts,
108 feed::SubscriberSharedPtr
const& session
112 subscribeToMPTIssuances(
113 std::vector<xrpl::MPTID>
const& mptIssuanceIDs,
114 feed::SubscriberSharedPtr
const& session
119 std::vector<OrderBook>
const& books,
120 feed::SubscriberSharedPtr
const& session,
121 boost::asio::yield_context yield,
132 tag_invoke(boost::json::value_from_tag, boost::json::value& jv,
Output const& output);
rpc::spec::handlers::subscribe::StreamType StreamType
A subscribable stream type.
Definition Subscribe.hpp:64
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert output to json value.
Definition Subscribe.cpp:208
Result process(Input const &input, Context const &ctx) const
Process the Subscribe command.
Definition Subscribe.cpp:45
SubscribeHandler(std::shared_ptr< BackendInterface > sharedPtrBackend, std::shared_ptr< data::AmendmentCenterInterface const > const &amendmentCenter, std::shared_ptr< feed::SubscriptionManagerInterface > const &subscriptions)
Construct a new BaseSubscribeHandler object.
Definition Subscribe.cpp:33
rpc::spec::handlers::subscribe::OrderBook OrderBook
A struct to hold the data for one order book.
Definition Subscribe.hpp:59
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:61
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition SpecBackend.hpp:24
Context of an RPC call.
Definition Types.hpp:98
A struct to hold the output data of the command.
Definition Subscribe.hpp:42