xrpld
Loading...
Searching...
No Matches
DeliverMax.cpp
1#include <xrpld/app/misc/DeliverMax.h>
2
3#include <xrpl/protocol/TxFormats.h>
4#include <xrpl/protocol/jss.h>
5
6namespace xrpl::RPC {
7
8void
9insertDeliverMax(json::Value& txJson, TxType txnType, unsigned int apiVersion)
10{
11 if (txJson.isMember(jss::Amount))
12 {
13 if (txnType == ttPAYMENT)
14 {
15 txJson[jss::DeliverMax] = txJson[jss::Amount];
16 if (apiVersion > 1)
17 txJson.removeMember(jss::Amount);
18 }
19 }
20}
21
22} // namespace xrpl::RPC
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.
API version numbers used in later API versions.
Definition ApiVersion.h:35
void insertDeliverMax(json::Value &txJson, TxType txnType, unsigned int apiVersion)
Copy Amount field to DeliverMax field in transaction output JSON.
Definition DeliverMax.cpp:9
TxType
Transaction type identifiers.
Definition TxFormats.h:41