20 #include <ripple/app/ledger/LedgerMaster.h>
21 #include <ripple/app/main/Application.h>
22 #include <ripple/app/misc/DeliverMax.h>
23 #include <ripple/ledger/ReadView.h>
24 #include <ripple/protocol/jss.h>
25 #include <ripple/rpc/Context.h>
26 #include <ripple/rpc/impl/RPCHelpers.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);
void insertDeliverMax(Json::Value &tx_json, TxType txnType, unsigned int apiVersion)
Copy Amount field to DeliverMax field in transaction output JSON.
Value get(UInt index, const Value &defaultValue) const
If the array contains at least index+1 elements, returns the element value, otherwise returns default...
LedgerMaster & ledgerMaster
std::string to_string_iso(date::sys_time< Duration > tp)
bool isNull() const
isNull() tests to see if this field is null.
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.
virtual tx_type txRead(key_type const &key) const =0
Read a transaction from the tx map.
bool isMember(const char *key) const
Return true if the object has a member named key.
Json::Value doTransactionEntry(RPC::JsonContext &)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
bool isValidated(ReadView const &ledger)
LedgerIndex seq() const
Returns the sequence number of the base ledger.
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
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.
virtual bool open() const =0
Returns true if this reflects an open ledger.
std::string asString() const
Returns the unquoted string value.