mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
APIv2(DeliverMax): add alias for Amount in Payment transactions (#4733)
Using the "Amount" field in Payment transactions can cause incorrect interpretation. There continue to be problems from the use of this field. "Amount" is rarely the correct field to use; instead, "delivered_amount" (or "DeliveredAmount") should be used. Rename the "Amount" field to "DeliverMax", a less misleading name. With api_version: 2, remove the "Amount" field from Payment transactions. - Input: "DeliverMax" in `tx_json` is an alias for "Amount" - sign - submit (in sign-and-submit mode) - submit_multisigned - sign_for - Output: Add "DeliverMax" where transactions are provided by the API - ledger - tx - tx_history - account_tx - transaction_entry - subscribe (transactions stream) - Output: Remove "Amount" from API version 2 Fix #3484 Fix #3902
This commit is contained in:
@@ -194,8 +194,16 @@ public:
|
||||
// Check stream update for payment transaction
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
return jv[jss::meta]["AffectedNodes"][1u]["CreatedNode"]
|
||||
["NewFields"][jss::Account] ==
|
||||
Account("alice").human();
|
||||
["NewFields"][jss::Account] //
|
||||
== Account("alice").human() &&
|
||||
jv[jss::transaction][jss::TransactionType] //
|
||||
== jss::Payment &&
|
||||
jv[jss::transaction][jss::DeliverMax] //
|
||||
== "10000000010" &&
|
||||
jv[jss::transaction][jss::Fee] //
|
||||
== "10" &&
|
||||
jv[jss::transaction][jss::Sequence] //
|
||||
== 1;
|
||||
}));
|
||||
|
||||
// Check stream update for accountset transaction
|
||||
@@ -211,7 +219,16 @@ public:
|
||||
// Check stream update for payment transaction
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
return jv[jss::meta]["AffectedNodes"][1u]["CreatedNode"]
|
||||
["NewFields"][jss::Account] == Account("bob").human();
|
||||
["NewFields"][jss::Account] //
|
||||
== Account("bob").human() &&
|
||||
jv[jss::transaction][jss::TransactionType] //
|
||||
== jss::Payment &&
|
||||
jv[jss::transaction][jss::DeliverMax] //
|
||||
== "10000000010" &&
|
||||
jv[jss::transaction][jss::Fee] //
|
||||
== "10" &&
|
||||
jv[jss::transaction][jss::Sequence] //
|
||||
== 2;
|
||||
}));
|
||||
|
||||
// Check stream update for accountset transaction
|
||||
|
||||
Reference in New Issue
Block a user