1#include <xrpld/rpc/detail/Handler.h> 
    2#include <xrpld/rpc/handlers/Handlers.h> 
    3#include <xrpld/rpc/handlers/Version.h> 
    5#include <xrpl/basics/contract.h> 
   14template <
typename Function>
 
   15Handler::Method<Json::Value>
 
   16byRef(Function 
const& f)
 
   18    return [f](JsonContext& context, 
Json::Value& result) {
 
   23            UNREACHABLE(
"ripple::RPC::byRef : result is object");
 
   32template <
class Object, 
class HandlerImpl>
 
   34handle(JsonContext& context, Object& 
object)
 
   37        context.apiVersion >= HandlerImpl::minApiVer &&
 
   38            context.apiVersion <= HandlerImpl::maxApiVer,
 
   39        "ripple::RPC::handle : valid API version");
 
   40    HandlerImpl handler(context);
 
   42    auto status = handler.check();
 
   46        handler.writeResult(
object);
 
   50template <
typename HandlerImpl>
 
   56        &handle<Json::Value, HandlerImpl>,
 
   58        HandlerImpl::condition,
 
   59        HandlerImpl::minApiVer,
 
   60        HandlerImpl::maxApiVer};
 
   63Handler 
const handlerArray[]{
 
   67    {
"account_currencies",
 
   86    {
"deposit_authorized",
 
   95    {
"get_aggregate_price",
 
  130    {
"peer_reservations_add",
 
  134    {
"peer_reservations_del",
 
  138    {
"peer_reservations_list",
 
  143    {
"server_definitions",
 
  154    {
"submit_multisigned",
 
  163    {
"validation_create",
 
  168    {
"validator_list_sites",
 
  188    overlappingApiVersion(
 
  195            "ripple::RPC::HandlerTable : valid API version range");
 
  198            "ripple::RPC::HandlerTable : valid max API version");
 
  203            [minVer, maxVer](
auto const& item) {
 
  204                return item.second.minApiVer_ <= maxVer &&
 
  205                    item.second.maxApiVer_ >= minVer;
 
  209    template <std::
size_t N>
 
  210    explicit HandlerTable(Handler 
const (&entries)[N])
 
  212        for (
auto const& entry : entries)
 
  214            if (overlappingApiVersion(
 
  220                    " overlaps with an existing handler");
 
  226        addHandler<LedgerHandler>();
 
  227        addHandler<VersionHandler>();
 
  231    static HandlerTable 
const&
 
  234        static HandlerTable 
const handlerTable(handlerArray);
 
  238    [[nodiscard]] Handler 
const*
 
  249            range.first, 
range.second, [version](
auto const& entry) {
 
  250                return entry.second.minApiVer_ <= version &&
 
  251                    version <= entry.second.maxApiVer_;
 
  254        return i == 
range.second ? nullptr : &i->second;
 
  261        for (
auto const& i : table_)
 
  262            ret.insert(i.second.name_);
 
  268    handler_table_t table_;
 
  270    template <
class HandlerImpl>
 
  274        static_assert(HandlerImpl::minApiVer <= HandlerImpl::maxApiVer);
 
  279        if (overlappingApiVersion(
 
  281                HandlerImpl::minApiVer,
 
  282                HandlerImpl::maxApiVer))
 
  285                " overlaps with an existing handler");
 
  287        table_.
insert({HandlerImpl::name, handlerFrom<HandlerImpl>()});
 
  296    return HandlerTable::instance().getHandler(version, betaEnabled, name);
 
 
  302    return HandlerTable::instance().getHandlerNames();
 
 
@ objectValue
object value (collection of name/value pairs).
 
Status
Return codes from Backend operations.
 
@ NEEDS_NETWORK_CONNECTION
 
static constexpr auto apiMaximumSupportedVersion
 
std::set< char const * > getHandlerNames()
Return names of all methods.
 
Json::Value makeObjectValue(Value const &value, Json::StaticString const &field=jss::message)
Return a Json::objectValue with a single entry.
 
static constexpr auto apiMaximumValidVersion
 
static constexpr auto apiBetaVersion
 
Handler const * getHandler(unsigned version, bool betaEnabled, std::string const &name)
 
static constexpr auto apiMinimumSupportedVersion
 
Json::Value entry(jtx::Env &env, jtx::Account const &account, jtx::Account const &authorize)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
Json::Value doPeers(RPC::JsonContext &)
 
Json::Value doTxHistory(RPC::JsonContext &)
 
Json::Value doLedgerAccept(RPC::JsonContext &)
 
Json::Value doUnsubscribe(RPC::JsonContext &)
 
Json::Value doTxReduceRelay(RPC::JsonContext &)
 
Json::Value doServerState(RPC::JsonContext &)
 
Json::Value doChannelVerify(RPC::JsonContext &)
 
Json::Value doValidationCreate(RPC::JsonContext &)
 
Json::Value doGetAggregatePrice(RPC::JsonContext &context)
oracles: array of {account, oracle_document_id} base_asset: is the asset to be priced quote_asset: is...
 
Json::Value doSubmitMultiSigned(RPC::JsonContext &)
 
Json::Value doLedgerEntry(RPC::JsonContext &)
 
Json::Value doNFTBuyOffers(RPC::JsonContext &)
 
Json::Value doChannelAuthorize(RPC::JsonContext &)
 
Json::Value doNoRippleCheck(RPC::JsonContext &)
 
Json::Value doTransactionEntry(RPC::JsonContext &)
 
Json::Value doConsensusInfo(RPC::JsonContext &context)
 
Json::Value doBookChanges(RPC::JsonContext &context)
 
Json::Value doLedgerRequest(RPC::JsonContext &)
 
Json::Value doSimulate(RPC::JsonContext &)
 
Json::Value doPeerReservationsAdd(RPC::JsonContext &)
 
Json::Value doLedgerCleaner(RPC::JsonContext &)
 
Json::Value doSign(RPC::JsonContext &)
 
Json::Value doAccountTxJson(RPC::JsonContext &context)
 
Json::Value doAccountLines(RPC::JsonContext &context)
 
Json::Value doTxJson(RPC::JsonContext &)
 
Json::Value doAMMInfo(RPC::JsonContext &context)
 
Json::Value doPeerReservationsList(RPC::JsonContext &)
 
Json::Value doServerInfo(RPC::JsonContext &)
 
Json::Value doFee(RPC::JsonContext &context)
 
Json::Value doConnect(RPC::JsonContext &context)
 
Json::Value doNFTSellOffers(RPC::JsonContext &)
 
Json::Value doDepositAuthorized(RPC::JsonContext &context)
 
Json::Value doStop(RPC::JsonContext &)
 
Json::Value doLedgerClosed(RPC::JsonContext &)
 
Json::Value doLogLevel(RPC::JsonContext &)
 
Json::Value doSubmit(RPC::JsonContext &)
 
Json::Value doServerDefinitions(RPC::JsonContext &)
 
Json::Value doSubscribe(RPC::JsonContext &)
 
Json::Value doAccountObjects(RPC::JsonContext &context)
 
Json::Value doFeature(RPC::JsonContext &context)
 
Json::Value doAccountNFTs(RPC::JsonContext &context)
General RPC command that can retrieve objects in the account root.
 
Json::Value doFetchInfo(RPC::JsonContext &context)
 
Json::Value doLedgerHeader(RPC::JsonContext &)
 
Json::Value doRandom(RPC::JsonContext &)
 
Json::Value doGetCounts(RPC::JsonContext &context)
 
Json::Value doManifest(RPC::JsonContext &context)
 
Json::Value doPing(RPC::JsonContext &)
 
Json::Value doBlackList(RPC::JsonContext &context)
 
Json::Value doLedgerData(RPC::JsonContext &)
 
Json::Value doValidatorListSites(RPC::JsonContext &)
 
Json::Value doSignFor(RPC::JsonContext &)
 
Json::Value doLedgerCurrent(RPC::JsonContext &)
 
Json::Value doAccountOffers(RPC::JsonContext &context)
 
Json::Value doValidatorInfo(RPC::JsonContext &)
 
Json::Value doGatewayBalances(RPC::JsonContext &context)
 
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
 
Json::Value doRipplePathFind(RPC::JsonContext &)
 
Json::Value doBookOffers(RPC::JsonContext &context)
 
Json::Value doAccountCurrencies(RPC::JsonContext &context)
 
Json::Value doAccountInfo(RPC::JsonContext &context)
 
Json::Value doLogRotate(RPC::JsonContext &)
 
Json::Value doCanDelete(RPC::JsonContext &context)
 
Json::Value doWalletPropose(RPC::JsonContext &)
 
Json::Value doVaultInfo(RPC::JsonContext &)
 
Json::Value doAccountChannels(RPC::JsonContext &context)
 
Json::Value doPeerReservationsDel(RPC::JsonContext &)
 
Json::Value doValidators(RPC::JsonContext &)
 
Json::Value doOwnerInfo(RPC::JsonContext &)
 
Json::Value doPrint(RPC::JsonContext &)
 
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
 
Json::Value doUnlList(RPC::JsonContext &)
 
Json::Value doPathFind(RPC::JsonContext &)