xrpld
Loading...
Searching...
No Matches
RPCHelpers.h
1#pragma once
2
3#include <xrpld/app/misc/TxQ.h>
4#include <xrpld/rpc/Context.h>
5#include <xrpld/rpc/Status.h>
6#include <xrpld/rpc/detail/Tuning.h>
7
8#include <xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.pb.h>
9#include <xrpl/protocol/ApiVersion.h>
10#include <xrpl/protocol/SecretKey.h>
11#include <xrpl/server/NetworkOPs.h>
12
13#include <optional>
14
15namespace xrpl {
16
17class ReadView;
18
19namespace RPC {
20
21struct JsonContext;
22
35std::uint64_t
36getStartHint(SLE::const_ref sle, AccountID const& accountID);
37
49bool
50isRelatedToAccount(ReadView const& ledger, SLE::const_ref sle, AccountID const& accountID);
51
61parseAccountIds(json::Value const& jvArray);
62
76std::optional<json::Value>
77readLimitField(unsigned int& limit, Tuning::LimitRange const& range, JsonContext const& context);
78
90std::optional<Seed>
91getSeedFromRPC(json::Value const& params, json::Value& error);
92
102std::optional<Seed>
103parseXrplLibSeed(json::Value const& params);
104
115std::pair<RPC::Status, LedgerEntryType>
116chooseLedgerEntryType(json::Value const& params);
117
131bool
133
148std::optional<std::pair<PublicKey, SecretKey>>
150 json::Value const& params,
151 json::Value& error,
152 unsigned int apiVersion = kApiVersionIfUnspecified);
153
158 Asset& asset,
159 json::Value const& jv,
160 json::StaticString const& name,
161 beast::Journal j);
162
163} // namespace RPC
164
165} // namespace xrpl
A view into a ledger.
Definition ReadView.h:31
std::shared_ptr< STLedgerEntry const > const & const_ref
API version numbers used in later API versions.
Definition ApiVersion.h:35
hash_set< AccountID > parseAccountIds(json::Value const &jvArray)
Parses an array of account IDs from a JSON value.
bool isRelatedToAccount(ReadView const &ledger, SLE::const_ref sle, AccountID const &accountID)
Tests if a ledger entry (SLE) is owned by the specified account.
std::optional< std::pair< PublicKey, SecretKey > > keypairForSignature(json::Value const &params, json::Value &error, unsigned int apiVersion)
Generates a keypair for signature from RPC parameters.
bool isAccountObjectsValidType(LedgerEntryType const &type)
Checks if the type is a valid filtering type for the account_objects method.
std::optional< Seed > parseXrplLibSeed(json::Value const &value)
Parses a XrplLib seed from RPC parameters.
ErrorCodeI parseSubUnsubJson(Asset &asset, json::Value const &params, json::StaticString const &name, beast::Journal j)
Parse subscribe/unsubscribe parameters.
std::uint64_t getStartHint(SLE::const_ref sle, AccountID const &accountID)
Gets the start hint for traversing account objects.
static constexpr auto kApiVersionIfUnspecified
Definition ApiVersion.h:43
std::optional< Seed > getSeedFromRPC(json::Value const &params, json::Value &error)
Extracts a Seed from RPC parameters.
std::optional< json::Value > readLimitField(unsigned int &limit, Tuning::LimitRange const &range, JsonContext const &context)
Retrieves the limit value from a JsonContext or sets a default.
std::pair< RPC::Status, LedgerEntryType > chooseLedgerEntryType(json::Value const &params)
Chooses the ledger entry type based on RPC parameters.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
ErrorCodeI
Definition ErrorCodes.h:22
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition RangeSet.h:34
std::unordered_set< Value, Hash, Pred, Allocator > hash_set
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:28
LedgerEntryType
Identifiers for on-ledger objects.
Represents RPC limit parameter values that have a min, default and max.