3#include "data/AmendmentCenterInterface.hpp"
4#include "data/BackendInterface.hpp"
5#include "feed/SubscriptionManagerInterface.hpp"
6#include "feed/Types.hpp"
7#include "rpc/common/Specs.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 <boost/json/value_to.hpp>
16#include <xrpl/beast/utility/Zero.h>
17#include <xrpl/protocol/Book.h>
18#include <xrpl/protocol/ErrorCodes.h>
19#include <xrpl/protocol/jss.h>
37 std::shared_ptr<BackendInterface> sharedPtrBackend_;
38 std::shared_ptr<data::AmendmentCenterInterface const> amendmentCenter_;
39 std::shared_ptr<feed::SubscriptionManagerInterface> subscriptions_;
48 std::optional<boost::json::object> ledger;
52 std::optional<boost::json::array> offers;
54 std::optional<boost::json::array> asks;
56 std::optional<boost::json::array> bids;
64 std::optional<std::string> taker;
65 bool snapshot =
false;
73 std::optional<std::vector<std::string>> accounts;
74 std::optional<std::vector<std::string>> streams;
75 std::optional<std::vector<std::string>> accountsProposed;
76 std::optional<std::vector<OrderBook>> books;
89 std::shared_ptr<BackendInterface> sharedPtrBackend,
90 std::shared_ptr<data::AmendmentCenterInterface const>
const& amendmentCenter,
91 std::shared_ptr<feed::SubscriptionManagerInterface>
const& subscriptions
101 spec([[maybe_unused]] uint32_t apiVersion);
116 boost::asio::yield_context yield,
117 std::vector<std::string>
const& streams,
118 feed::SubscriberSharedPtr
const& session
123 std::vector<std::string>
const& accounts,
124 feed::SubscriberSharedPtr
const& session
128 subscribeToAccountsProposed(
129 std::vector<std::string>
const& accounts,
130 feed::SubscriberSharedPtr
const& session
135 std::vector<OrderBook>
const& books,
136 feed::SubscriberSharedPtr
const& session,
137 boost::asio::yield_context yield,
148 tag_invoke(boost::json::value_from_tag, boost::json::value& jv,
Output const& output);
157 tag_invoke(boost::json::value_to_tag<Input>, boost::json::value
const& jv);
static RpcSpecConstRef spec(uint32_t apiVersion)
Returns the API specification for the command.
Definition Subscribe.cpp:50
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert output to json value.
Definition Subscribe.cpp:250
Result process(Input const &input, Context const &ctx) const
Process the Subscribe command.
Definition Subscribe.cpp:108
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:38
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
Context of an RPC call.
Definition Types.hpp:99
A struct to hold the data for one order book.
Definition Subscribe.hpp:62
A struct to hold the output data of the command.
Definition Subscribe.hpp:45