20#ifndef RIPPLE_RPC_RPCHELPERS_H_INCLUDED
21#define RIPPLE_RPC_RPCHELPERS_H_INCLUDED
23#include <xrpld/app/misc/NetworkOPs.h>
24#include <xrpld/app/misc/TxQ.h>
25#include <xrpld/rpc/Context.h>
26#include <xrpld/rpc/Status.h>
27#include <xrpld/rpc/detail/Tuning.h>
29#include <xrpl/beast/core/SemanticVersion.h>
30#include <xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.pb.h>
31#include <xrpl/protocol/ApiVersion.h>
32#include <xrpl/protocol/SecretKey.h>
62 bool bStrict =
false);
74 bool bStrict =
false);
91 ReadView
const& ledger,
106 ReadView
const& ledger,
128getLedger(T& ledger, uint32_t ledgerIndex, Context& context);
159template <
class T,
class R>
167 org::xrpl::rpc::v1::LedgerSpecifier
const& specifier,
211template <
class Object>
217 "ripple::RPC::setVersion : input is valid");
218 auto&&
object = addObject(parent, jss::version);
A Semantic Version number.
std::string print() const
Produce a string from semantic version components.
JSON (JavaScript Object Notation).
Status
Return codes from Backend operations.
beast::SemanticVersion const firstVersion("1.0.0")
API version numbers used in API version 1.
Status ledgerFromRequest(T &ledger, GRPCContext< R > &context)
unsigned int getAPIVersionNumber(Json::Value const &jv, bool betaEnabled)
Retrieve the api version number from the json value.
error_code_i accountFromStringWithCode(AccountID &result, std::string const &strIdent, bool bStrict)
Decode account ID from string.
std::optional< Seed > getSeedFromRPC(Json::Value const ¶ms, Json::Value &error)
beast::SemanticVersion const lastVersion("1.0.0")
static constexpr auto apiMaximumSupportedVersion
std::variant< std::shared_ptr< Ledger const >, Json::Value > getLedgerByContext(RPC::JsonContext &context)
Return a ledger based on ledger_hash or ledger_index, or an RPC error.
bool isAccountObjectsValidType(LedgerEntryType const &type)
Check if the type is a valid filtering type for account_objects method.
static constexpr std::integral_constant< unsigned, Version > apiVersion
bool isRelatedToAccount(ReadView const &ledger, std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Tests if a SLE is owned by accountID.
void injectSLE(Json::Value &jv, SLE const &sle)
Inject JSON describing ledger entry.
Status getLedger(T &ledger, uint256 const &ledgerHash, Context &context)
Get ledger by hash If there is no error in the return value, the ledger pointer will have been filled...
static constexpr auto apiBetaVersion
std::pair< RPC::Status, LedgerEntryType > chooseLedgerEntryType(Json::Value const ¶ms)
bool getAccountObjects(ReadView const &ledger, AccountID const &account, std::optional< std::vector< LedgerEntryType > > const &typeFilter, uint256 dirIndex, uint256 entryIndex, std::uint32_t const limit, Json::Value &jvResult)
Gathers all objects for an account in a ledger.
std::optional< Json::Value > readLimitField(unsigned int &limit, Tuning::LimitRange const &range, JsonContext const &context)
Retrieve the limit value from a JsonContext, or set a default - then restrict the limit by max and mi...
beast::SemanticVersion const goodVersion("1.0.0")
void setVersion(Object &parent, unsigned int apiVersion, bool betaEnabled)
Json::Value accountFromString(AccountID &result, std::string const &strIdent, bool bStrict)
static constexpr auto apiVersionIfUnspecified
Status lookupLedger(std::shared_ptr< ReadView const > &ledger, JsonContext &context, Json::Value &result)
Look up a ledger from a request and fill a Json::Result with the data representing a ledger.
Status ledgerFromSpecifier(T &ledger, org::xrpl::rpc::v1::LedgerSpecifier const &specifier, Context &context)
std::optional< AccountID > accountFromStringStrict(std::string const &account)
Get an AccountID from an account ID or public key.
hash_set< AccountID > parseAccountIds(Json::Value const &jvArray)
static constexpr auto apiInvalidVersion
std::uint64_t getStartHint(std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Gets the start hint for traversing account objects.
static constexpr auto apiMinimumSupportedVersion
bool isHexTxID(std::string const &txid)
std::optional< Seed > parseRippleLibSeed(Json::Value const &value)
std::optional< std::pair< PublicKey, SecretKey > > keypairForSignature(Json::Value const ¶ms, Json::Value &error, unsigned int apiVersion)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
LedgerEntryType
Identifiers for on-ledger objects.
Represents RPC limit parameter values that have a min, default and max.