20 #ifndef RIPPLE_RPC_RPCHELPERS_H_INCLUDED
21 #define RIPPLE_RPC_RPCHELPERS_H_INCLUDED
23 #include <ripple/beast/core/SemanticVersion.h>
24 #include <ripple/ledger/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>
32 #include <boost/optional.hpp>
33 #include <org/xrpl/rpc/v1/xrp_ledger.pb.h>
49 boost::optional<AccountID>
60 bool bStrict =
false);
72 bool bStrict =
false);
85 ReadView
const& ledger,
86 AccountID
const& account,
107 getLedger(T& ledger, uint32_t ledgerIndex, Context& context);
138 template <
class T,
class R>
146 org::xrpl::rpc::v1::LedgerSpecifier
const& specifier,
177 boost::optional<Json::Value>
180 Tuning::LimitRange
const&,
183 boost::optional<Seed>
186 boost::optional<Seed>
227 template <
class Object>
231 auto&&
object = addObject(parent, jss::version);
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)
unsigned int getAPIVersionNumber(Json::Value const &jv)
Retrieve the api version number from the json value.
void injectSLE(Json::Value &jv, SLE const &sle)
Inject JSON describing ledger entry.
boost::optional< Seed > parseRippleLibSeed(Json::Value const &value)
std::string print() const
Produce a string from semantic version components.
constexpr unsigned int APINumberVersionSupported
bool getAccountObjects(ReadView const &ledger, AccountID const &account, boost::optional< std::vector< LedgerEntryType >> const &typeFilter, uint256 dirIndex, uint256 const &entryIndex, std::uint32_t const limit, Json::Value &jvResult)
Gathers all objects for an account in a ledger.
constexpr unsigned int APIVersionIfUnspecified
A Semantic Version number.
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.
boost::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...
constexpr unsigned int ApiMinimumSupportedVersion
JSON (JavaScript Object Notation).
error_code_i accountFromStringWithCode(AccountID &result, std::string const &strIdent, bool bStrict)
Decode account ID from string.
constexpr unsigned int ApiMaximumSupportedVersion
boost::optional< AccountID > accountFromStringStrict(std::string const &account)
Get an AccountID from an account ID or public key.
constexpr unsigned int APIInvalidVersion
API version numbers used in later API versions.
Status
Return codes from Backend operations.
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::pair< PublicKey, SecretKey > keypairForSignature(Json::Value const ¶ms, Json::Value &error)
Status ledgerFromSpecifier(T &ledger, org::xrpl::rpc::v1::LedgerSpecifier const &specifier, Context &context)
void setVersion(Object &parent)
hash_set< AccountID > parseAccountIds(Json::Value const &jvArray)
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)
boost::optional< Seed > getSeedFromRPC(Json::Value const ¶ms, Json::Value &error)