20 #ifndef RIPPLE_RPC_RPCHELPERS_H_INCLUDED
21 #define RIPPLE_RPC_RPCHELPERS_H_INCLUDED
23 #include <ripple/beast/core/SemanticVersion.h>
24 #include <ripple/protocol/TxMeta.h>
26 #include <ripple/app/misc/NetworkOPs.h>
27 #include <ripple/app/misc/TxQ.h>
28 #include <ripple/protocol/SecretKey.h>
29 #include <ripple/rpc/Context.h>
30 #include <ripple/rpc/Status.h>
31 #include <ripple/rpc/impl/Tuning.h>
33 #include <org/xrpl/rpc/v1/xrp_ledger.pb.h>
61 bool bStrict =
false);
73 bool bStrict =
false);
90 ReadView
const& ledger,
92 AccountID
const& accountID);
105 ReadView
const& ledger,
106 AccountID
const& account,
127 getLedger(T& ledger, uint32_t ledgerIndex, Context& context);
158 template <
class T,
class R>
166 org::xrpl::rpc::v1::LedgerSpecifier
const& specifier,
200 Tuning::LimitRange
const&,
251 template <
class Object>
253 setVersion(Object& parent,
unsigned int apiVersion,
bool betaEnabled)
256 auto&&
object = addObject(parent, jss::version);
constexpr unsigned int apiInvalidVersion
API version numbers used in later API versions.
constexpr unsigned int apiVersionIfUnspecified
const beast::SemanticVersion firstVersion("1.0.0")
API version numbers used in API version 1.
const beast::SemanticVersion goodVersion("1.0.0")
bool isHexTxID(std::string const &txid)
void injectSLE(Json::Value &jv, SLE const &sle)
Inject JSON describing ledger entry.
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.
unsigned int getAPIVersionNumber(Json::Value const &jv, bool betaEnabled)
Retrieve the api version number from the json value.
std::string print() const
Produce a string from semantic version components.
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...
A Semantic Version number.
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.
constexpr unsigned int apiBetaVersion
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.
std::optional< Seed > parseRippleLibSeed(Json::Value const &value)
JSON (JavaScript Object Notation).
error_code_i accountFromStringWithCode(AccountID &result, std::string const &strIdent, bool bStrict)
Decode account ID from string.
Status
Return codes from Backend operations.
constexpr unsigned int apiMinimumSupportedVersion
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool isValidated(LedgerMaster &ledgerMaster, ReadView const &ledger, Application &app)
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...
std::pair< RPC::Status, LedgerEntryType > chooseLedgerEntryType(Json::Value const ¶ms)
std::uint64_t getStartHint(std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Gets the start hint for traversing account objects.
std::pair< PublicKey, SecretKey > keypairForSignature(Json::Value const ¶ms, Json::Value &error)
std::optional< Seed > getSeedFromRPC(Json::Value const ¶ms, Json::Value &error)
constexpr unsigned int apiMaximumSupportedVersion
Status ledgerFromSpecifier(T &ledger, org::xrpl::rpc::v1::LedgerSpecifier const &specifier, Context &context)
hash_set< AccountID > parseAccountIds(Json::Value const &jvArray)
std::optional< AccountID > accountFromStringStrict(std::string const &account)
Get an AccountID from an account ID or public key.
const beast::SemanticVersion lastVersion("1.0.0")
Status ledgerFromRequest(T &ledger, GRPCContext< R > &context)
Json::Value accountFromString(AccountID &result, std::string const &strIdent, bool bStrict)
bool isRelatedToAccount(ReadView const &ledger, std::shared_ptr< SLE const > const &sle, AccountID const &accountID)
Tests if a SLE is owned by accountID.
void setVersion(Object &parent, unsigned int apiVersion, bool betaEnabled)