20 #include <ripple/rpc/handlers/Handlers.h>
21 #include <ripple/rpc/handlers/Version.h>
22 #include <ripple/rpc/impl/Handler.h>
23 #include <ripple/rpc/impl/RPCHelpers.h>
30 template <
typename Function>
31 Handler::Method<Json::Value>
32 byRef(Function
const& f)
34 return [f](JsonContext& context,
Json::Value& result) {
46 template <
class Object,
class HandlerImpl>
48 handle(JsonContext& context, Object&
object)
50 HandlerImpl handler(context);
52 auto status = handler.check();
56 handler.writeResult(
object);
60 Handler
const handlerArray[]{
64 {
"account_currencies",
82 {
"deposit_authorized",
87 #ifdef RIPPLED_REPORTING
128 {
"peer_reservations_add",
132 {
"peer_reservations_del",
136 {
"peer_reservations_list",
144 {
"submit_multisigned",
157 {
"validation_create",
162 {
"validator_list_sites",
176 template <std::
size_t N>
177 explicit HandlerTable(
const Handler (&entries)[N])
181 auto const& entry = entries[i];
182 assert(table_.find(entry.name_) == table_.end());
183 table_[entry.name_] = entry;
187 addHandler<LedgerHandler>();
188 addHandler<VersionHandler>();
192 static HandlerTable
const&
195 static HandlerTable
const handlerTable(handlerArray);
207 auto i = table_.find(name);
208 return i == table_.end() ? nullptr : &i->second;
216 for (
auto const& i : table_)
224 template <
class HandlerImpl>
228 assert(table_.find(HandlerImpl::name()) == table_.end());
231 h.name_ = HandlerImpl::name();
232 h.valueMethod_ = &handle<Json::Value, HandlerImpl>;
233 h.role_ = HandlerImpl::role();
234 h.condition_ = HandlerImpl::condition();
236 table_[HandlerImpl::name()] = h;
245 return HandlerTable::instance().getHandler(version, betaEnabled, name);
251 return HandlerTable::instance().getHandlerNames();
Json::Value doAccountNFTs(RPC::JsonContext &context)
General RPC command that can retrieve objects in the account root.
Json::Value doFeature(RPC::JsonContext &context)
Json::Value doLedgerAccept(RPC::JsonContext &)
Json::Value doUnlList(RPC::JsonContext &)
Json::Value doGetCounts(RPC::JsonContext &context)
Json::Value doLedgerEntry(RPC::JsonContext &)
Json::Value doLedgerCurrent(RPC::JsonContext &)
Json::Value doAccountCurrencies(RPC::JsonContext &context)
Json::Value doValidationCreate(RPC::JsonContext &)
Json::Value doOwnerInfo(RPC::JsonContext &)
Json::Value doPathFind(RPC::JsonContext &)
Json::Value doDownloadShard(RPC::JsonContext &context)
RPC command that downloads and import shard archives.
Json::Value doAccountInfo(RPC::JsonContext &context)
Json::Value doRipplePathFind(RPC::JsonContext &)
Json::Value doSignFor(RPC::JsonContext &)
Handler const * getHandler(unsigned version, bool betaEnabled, std::string const &name)
Json::Value doAccountObjects(RPC::JsonContext &context)
Json::Value doValidators(RPC::JsonContext &)
Json::Value doValidatorListSites(RPC::JsonContext &)
Json::Value doTxReduceRelay(RPC::JsonContext &)
Json::Value doChannelVerify(RPC::JsonContext &)
@ NEEDS_NETWORK_CONNECTION
Json::Value doPrint(RPC::JsonContext &)
Json::Value doGatewayBalances(RPC::JsonContext &context)
Json::Value doManifest(RPC::JsonContext &)
Json::Value doPeers(RPC::JsonContext &)
Json::Value doSubmitMultiSigned(RPC::JsonContext &)
constexpr unsigned int apiBetaVersion
Json::Value doNFTBuyOffers(RPC::JsonContext &)
Json::Value doCrawlShards(RPC::JsonContext &context)
RPC command that reports stored shards by nodes.
Json::Value doTxHistory(RPC::JsonContext &)
Json::Value doLogLevel(RPC::JsonContext &)
Json::Value doSubmit(RPC::JsonContext &)
@ objectValue
object value (collection of name/value pairs).
Json::Value doPing(RPC::JsonContext &)
Json::Value doLedgerRequest(RPC::JsonContext &)
Json::Value doNFTSellOffers(RPC::JsonContext &)
Json::Value doChannelAuthorize(RPC::JsonContext &)
Json::Value doRandom(RPC::JsonContext &)
Json::Value doValidatorInfo(RPC::JsonContext &)
Json::Value doStop(RPC::JsonContext &)
Json::Value doWalletPropose(RPC::JsonContext &)
Json::Value doCanDelete(RPC::JsonContext &context)
Json::Value doConsensusInfo(RPC::JsonContext &context)
Json::Value doLedgerData(RPC::JsonContext &)
Json::Value doAccountOffers(RPC::JsonContext &context)
Json::Value doLogRotate(RPC::JsonContext &)
Json::Value doNoRippleCheck(RPC::JsonContext &)
Json::Value doLedgerClosed(RPC::JsonContext &)
Json::Value doBookOffers(RPC::JsonContext &context)
Json::Value doPeerReservationsList(RPC::JsonContext &)
Status
Return codes from Backend operations.
Json::Value doTransactionEntry(RPC::JsonContext &)
Json::Value doUnsubscribe(RPC::JsonContext &)
constexpr unsigned int apiMinimumSupportedVersion
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Json::Value doBlackList(RPC::JsonContext &context)
Json::Value doAccountTxJson(RPC::JsonContext &context)
Json::Value doSign(RPC::JsonContext &)
Json::Value doPeerReservationsDel(RPC::JsonContext &)
Json::Value doTxJson(RPC::JsonContext &)
constexpr unsigned int apiMaximumSupportedVersion
Json::Value doNodeToShard(RPC::JsonContext &)
Json::Value makeObjectValue(Value const &value, Json::StaticString const &field=jss::message)
Return a Json::objectValue with a single entry.
Json::Value doAccountChannels(RPC::JsonContext &context)
Json::Value doServerInfo(RPC::JsonContext &)
Json::Value doLedgerHeader(RPC::JsonContext &)
Json::Value doFetchInfo(RPC::JsonContext &context)
Json::Value doServerState(RPC::JsonContext &)
Json::Value doConnect(RPC::JsonContext &context)
Json::Value doLedgerCleaner(RPC::JsonContext &)
std::vector< char const * > getHandlerNames()
Return names of all methods.
Json::Value doDepositAuthorized(RPC::JsonContext &context)
Json::Value doPeerReservationsAdd(RPC::JsonContext &)
Json::Value doBookChanges(RPC::JsonContext &context)
Json::Value doAccountLines(RPC::JsonContext &context)
Json::Value doFee(RPC::JsonContext &context)
Json::Value doSubscribe(RPC::JsonContext &)