rippled
Loading...
Searching...
No Matches
DeliverMax.cpp
1#include <xrpld/app/misc/DeliverMax.h>
2
3#include <xrpl/protocol/jss.h>
4
5namespace ripple {
6namespace RPC {
7
8void
9insertDeliverMax(Json::Value& tx_json, TxType txnType, unsigned int apiVersion)
10{
11 if (tx_json.isMember(jss::Amount))
12 {
13 if (txnType == ttPAYMENT)
14 {
15 tx_json[jss::DeliverMax] = tx_json[jss::Amount];
16 if (apiVersion > 1)
17 tx_json.removeMember(jss::Amount);
18 }
19 }
20}
21
22} // namespace RPC
23} // namespace ripple
Represents a JSON value.
Definition json_value.h:130
Value removeMember(char const *key)
Remove and return the named member.
bool isMember(char const *key) const
Return true if the object has a member named key.
static constexpr std::integral_constant< unsigned, Version > apiVersion
Definition ApiVersion.h:39
void insertDeliverMax(Json::Value &tx_json, TxType txnType, unsigned int apiVersion)
Copy Amount field to DeliverMax field in transaction output JSON.
Definition DeliverMax.cpp:9
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
TxType
Transaction type identifiers.
Definition TxFormats.h:38