20#include <xrpld/app/ledger/LedgerMaster.h>
21#include <xrpld/app/misc/DeliverMax.h>
22#include <xrpld/ledger/ReadView.h>
23#include <xrpld/rpc/Context.h>
24#include <xrpld/rpc/detail/RPCHelpers.h>
26#include <xrpl/protocol/jss.h>
48 jvResult[jss::error] =
"fieldNotFoundTransaction";
55 jvResult[jss::error] =
"notYetImplemented";
64 jvResult[jss::error] =
"malformedRequest";
68 auto [sttx, stobj] = lpLedger->txRead(uTransID);
71 jvResult[jss::error] =
"transactionNotFound";
77 jvResult[jss::tx_json] =
79 jvResult[jss::hash] =
to_string(sttx->getTransactionID());
81 if (!lpLedger->open())
85 bool const validated =
88 jvResult[jss::validated] = validated;
91 jvResult[jss::ledger_index] = lpLedger->seq();
94 jvResult[jss::close_time_iso] =
102 jvResult[jss::tx_json], sttx->getTxnType(), context.
apiVersion);
104 auto const json_meta =
105 (context.
apiVersion > 1 ? jss::meta : jss::metadata);
Value get(UInt index, const Value &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 isNull() const
isNull() tests to see if this field is null.
bool isMember(const char *key) const
Return true if the object has a member named key.
std::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
bool isValidated(ReadView const &ledger)
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
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.
void insertDeliverMax(Json::Value &tx_json, TxType txnType, unsigned int apiVersion)
Copy Amount field to DeliverMax field in transaction output JSON.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Json::Value doTransactionEntry(RPC::JsonContext &)
std::string to_string_iso(date::sys_time< Duration > tp)
std::string to_string(base_uint< Bits, Tag > const &a)
LedgerMaster & ledgerMaster