1#include <xrpld/app/ledger/LedgerMaster.h>
2#include <xrpld/app/misc/DeliverMax.h>
3#include <xrpld/rpc/Context.h>
4#include <xrpld/rpc/detail/RPCLedgerHelpers.h>
6#include <xrpl/basics/base_uint.h>
7#include <xrpl/basics/chrono.h>
8#include <xrpl/json/json_value.h>
9#include <xrpl/ledger/ReadView.h>
10#include <xrpl/protocol/jss.h>
34 jvResult[jss::error] =
"fieldNotFoundTransaction";
41 jvResult[jss::error] =
"notYetImplemented";
50 jvResult[jss::error] =
"malformedRequest";
54 auto [sttx, stobj] = lpLedger->txRead(uTransID);
57 jvResult[jss::error] =
"transactionNotFound";
64 jvResult[jss::hash] =
to_string(sttx->getTransactionID());
66 if (!lpLedger->open())
68 jvResult[jss::ledger_hash] =
74 jvResult[jss::validated] = validated;
77 jvResult[jss::ledger_index] = lpLedger->seq();
79 jvResult[jss::close_time_iso] =
toStringIso(*closeTime);
89 auto const jsonMeta = (context.
apiVersion > 1 ? jss::meta : jss::metadata);
bool isNull() const
isNull() tests to see if this field is null.
Value get(UInt index, Value const &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
std::string asString() const
Returns the unquoted string value.
bool isMember(char const *key) const
Return true if the object has a member named key.
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
std::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
bool isValidated(ReadView const &ledger)
void insertDeliverMax(json::Value &txJson, TxType txnType, unsigned int apiVersion)
Copy Amount field to DeliverMax field in transaction output JSON.
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.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
json::Value doTransactionEntry(RPC::JsonContext &)
std::string to_string(BaseUInt< Bits, Tag > const &a)
std::string toStringIso(date::sys_time< Duration > tp)
LedgerMaster & ledgerMaster