rippled
Loading...
Searching...
No Matches
RPCLedgerHelpers.h
1#pragma once
2
3#include <xrpld/app/ledger/Ledger.h>
4#include <xrpld/app/misc/TxQ.h>
5#include <xrpld/rpc/Context.h>
6#include <xrpld/rpc/Status.h>
7#include <xrpld/rpc/detail/Tuning.h>
8
9#include <xrpl/proto/org/xrpl/rpc/v1/xrp_ledger.pb.h>
10#include <xrpl/protocol/LedgerShortcut.h>
11#include <xrpl/server/NetworkOPs.h>
12
13#include <optional>
14
15namespace xrpl {
16
17class ReadView;
18class Transaction;
19
20namespace RPC {
21
22struct JsonContext;
23
37template <class T>
39getLedger(T& ledger, uint256 const& ledgerHash, Context const& context);
40
55template <class T>
57getLedger(T& ledger, uint32_t ledgerIndex, Context const& context);
58
73template <class T>
75getLedger(T& ledger, LedgerShortcut shortcut, Context const& context);
76
94
110Status
111lookupLedger(std::shared_ptr<ReadView const>&, JsonContext const&, Json::Value& result);
112
127template <class T, class R>
128Status
129ledgerFromRequest(T& ledger, GRPCContext<R> const& context);
130
143template <class T>
144Status
145ledgerFromSpecifier(T& ledger, org::xrpl::rpc::v1::LedgerSpecifier const& specifier, Context const& context);
146
167Expected<std::shared_ptr<Ledger const>, Json::Value>
168getOrAcquireLedger(RPC::JsonContext const& context);
169
170} // namespace RPC
171
172} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
Status
Return codes from Backend operations.
Status ledgerFromSpecifier(T &ledger, org::xrpl::rpc::v1::LedgerSpecifier const &specifier, Context const &context)
Retrieves a ledger based on a LedgerSpecifier.
Expected< std::shared_ptr< Ledger const >, Json::Value > getOrAcquireLedger(RPC::JsonContext const &context)
Retrieves or acquires a ledger based on the parameters provided in the given JsonContext.
Status ledgerFromRequest(T &ledger, GRPCContext< R > const &context)
Retrieves a ledger from a gRPC request context.
Status lookupLedger(std::shared_ptr< ReadView const > &ledger, JsonContext const &context, Json::Value &result)
Looks up a ledger from a request and fills a Json::Value with ledger data.
Status getLedger(T &ledger, uint256 const &ledgerHash, Context const &context)
Retrieves a ledger by its hash.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
LedgerShortcut
Enumeration of ledger shortcuts for specifying which ledger to use.
base_uint< 256 > uint256
Definition base_uint.h:526