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 {
127 return view->rules().enabled(
fix1623);
134 return view->rules().enabled(
fix1623);
139 getFix1623Enabled, serializedTx, transactionMeta);
147 TxMeta const& transactionMeta)
149 auto const info = ledger.
info();
150 auto const getFix1623Enabled = [&ledger] {
155 getFix1623Enabled, serializedTx, transactionMeta))
157 auto const getLedgerIndex = [&info] {
return info.seq; };
158 auto const getCloseTime = [&info] {
return info.closeTime; };
161 getLedgerIndex, getCloseTime, serializedTx, transactionMeta);
164 meta[jss::delivered_amount] =
171 meta[jss::delivered_amount] =
Json::Value(
"unavailable");
176 template <
class GetLedgerIndex>
181 TxMeta const& transactionMeta,
182 GetLedgerIndex
const& getLedgerIndex)
186 auto const getCloseTime =
192 getLedgerIndex, getCloseTime, serializedTx, transactionMeta);
202 TxMeta const& transactionMeta,
206 context, serializedTx, transactionMeta, [&ledgerIndex]() {
216 TxMeta const& transactionMeta)
219 meta, context, transaction->getSTransaction(), transactionMeta);
227 TxMeta const& transactionMeta)
232 context, transaction, transactionMeta, [&transactionMeta]() {
238 meta[jss::delivered_amount] =
245 meta[jss::delivered_amount] =
Json::Value(
"unavailable");