20 #include <ripple/rpc/DeliveredAmount.h>
22 #include <ripple/app/ledger/LedgerMaster.h>
23 #include <ripple/app/ledger/OpenLedger.h>
24 #include <ripple/app/misc/Transaction.h>
25 #include <ripple/ledger/View.h>
26 #include <ripple/net/RPCErr.h>
27 #include <ripple/protocol/AccountID.h>
28 #include <ripple/protocol/Feature.h>
29 #include <ripple/rpc/Context.h>
30 #include <ripple/rpc/impl/RPCHelpers.h>
31 #include <boost/algorithm/string/case_conv.hpp>
46 template <
class GetLedgerIndex,
class GetCloseTime>
49 GetLedgerIndex
const& getLedgerIndex,
50 GetCloseTime
const& getCloseTime,
52 TxMeta const& transactionMeta)
62 if (serializedTx->isFieldPresent(
sfAmount))
64 using namespace std::chrono_literals;
74 if (getLedgerIndex() >= 4594095 ||
77 return serializedTx->getFieldAmount(
sfAmount);
86 template <
class GetFix1623Enabled>
89 GetFix1623Enabled
const& getFix1623Enabled,
91 TxMeta const& transactionMeta)
97 TxType const tt{serializedTx->getTxnType()};
118 TxMeta const& transactionMeta)
121 auto const getFix1623Enabled = [&context]() ->
bool {
125 return view->rules().enabled(
fix1623);
129 getFix1623Enabled, serializedTx, transactionMeta);
137 TxMeta const& transactionMeta)
139 auto const info = ledger.
info();
140 auto const getFix1623Enabled = [&ledger] {
145 getFix1623Enabled, serializedTx, transactionMeta))
147 auto const getLedgerIndex = [&info] {
return info.seq; };
148 auto const getCloseTime = [&info] {
return info.closeTime; };
151 getLedgerIndex, getCloseTime, serializedTx, transactionMeta);
154 meta[jss::delivered_amount] =
161 meta[jss::delivered_amount] =
Json::Value(
"unavailable");
166 template <
class GetLedgerIndex>
171 TxMeta const& transactionMeta,
172 GetLedgerIndex
const& getLedgerIndex)
176 auto const getCloseTime =
178 &getLedgerIndex]() -> boost::optional<NetClock::time_point> {
182 getLedgerIndex, getCloseTime, serializedTx, transactionMeta);
192 TxMeta const& transactionMeta,
196 context, serializedTx, transactionMeta, [&ledgerIndex]() {
206 TxMeta const& transactionMeta)
208 auto const serializedTx = transaction->getSTransaction();
212 context, serializedTx, transactionMeta, [&transaction]() {
213 return transaction->getLedger();
218 meta[jss::delivered_amount] =
225 meta[jss::delivered_amount] =
Json::Value(
"unavailable");