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_channels/Types.hpp>
10#include <xrpl/protocol/STLedgerEntry.h>
29 :
public rpc::HandlerFor<rpc::spec::handlers::account_channels::Input> {
31 std::shared_ptr<BackendInterface>
const sharedPtrBackend_;
37 static constexpr auto kLimitMin = rpc::spec::handlers::account_channels::kLimitMin;
41 static constexpr auto kLimitMax = rpc::spec::handlers::account_channels::kLimitMax;
45 static constexpr auto kLimitDefault = rpc::spec::handlers::account_channels::kLimitDefault;
92 : sharedPtrBackend_(std::move(sharedPtrBackend))
108 addChannel(std::vector<ChannelResponse>& jsonChannels, xrpl::SLE
const& channelSle);
117 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
126 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, ChannelResponse
const& channel);
AccountChannelsHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new AccountChannelsHandler object.
Definition AccountChannels.hpp:91
static constexpr auto kLimitMax
Maximum accepted value for the limit request field.
Definition AccountChannels.hpp:41
static constexpr auto kLimitMin
Minimum accepted value for the limit request field.
Definition AccountChannels.hpp:37
Result process(Input const &input, Context const &ctx) const
Process the AccountChannels command.
Definition AccountChannels.cpp:67
HandlerReturnType< Output > Result
The result type of the command: the Output on success or an error Status.
Definition AccountChannels.hpp:84
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition AccountChannels.cpp:131
static constexpr auto kLimitDefault
Value of limit used when the request does not specify one.
Definition AccountChannels.hpp:45
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 channel response.
Definition AccountChannels.hpp:52
std::string account
Source account that owns the channel.
Definition AccountChannels.hpp:54
uint32_t settleDelay
Seconds the source must wait before closing the channel.
Definition AccountChannels.hpp:60
std::string channelID
Unique ID of the payment channel (hex).
Definition AccountChannels.hpp:53
std::optional< std::string > publicKey
Channel public key, base58-encoded.
Definition AccountChannels.hpp:58
std::optional< uint32_t > expiration
Time after which the channel can be closed.
Definition AccountChannels.hpp:61
std::optional< uint32_t > destinationTag
Destination tag of the channel, if any.
Definition AccountChannels.hpp:64
std::string balance
XRP, in drops, already paid out of the channel.
Definition AccountChannels.hpp:57
std::string accountDestination
Destination account of the channel.
Definition AccountChannels.hpp:55
std::optional< uint32_t > sourceTag
Source tag of the channel, if any.
Definition AccountChannels.hpp:63
std::optional< std::string > publicKeyHex
Channel public key, hex-encoded.
Definition AccountChannels.hpp:59
std::string amount
Total XRP, in drops, allocated to the channel.
Definition AccountChannels.hpp:56
std::optional< uint32_t > cancelAfter
Immutable expiration time of the channel.
Definition AccountChannels.hpp:62
A struct to hold the output data of the command.
Definition AccountChannels.hpp:70
std::string account
The account whose channels are returned.
Definition AccountChannels.hpp:72
uint32_t limit
Maximum number of channels requested.
Definition AccountChannels.hpp:77
std::string ledgerHash
Hash of the ledger used for the request.
Definition AccountChannels.hpp:73
std::optional< std::string > marker
Pagination marker to resume from, if more results.
Definition AccountChannels.hpp:78
bool validated
Whether the ledger is validated.
Definition AccountChannels.hpp:76
std::vector< ChannelResponse > channels
Payment channels owned by the account.
Definition AccountChannels.hpp:71
uint32_t ledgerIndex
Sequence of the ledger used for the request.
Definition AccountChannels.hpp:74
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