xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
jtx
impl
check.cpp
1
#include <test/jtx/check.h>
2
3
#include <test/jtx/Account.h>
4
5
#include <xrpl/basics/base_uint.h>
6
#include <xrpl/json/json_value.h>
7
#include <xrpl/protocol/SField.h>
8
#include <xrpl/protocol/STAmount.h>
9
#include <xrpl/protocol/jss.h>
10
11
namespace
xrpl::test::jtx::check
{
12
13
// Cash a check requiring that a specific amount be delivered.
14
json::Value
15
cash
(
jtx::Account
const
& dest,
UInt256
const
& checkId,
STAmount
const
& amount)
16
{
17
json::Value
jv;
18
jv[sfAccount.jsonName] = dest.
human
();
19
jv[sfAmount.jsonName] = amount.
getJson
(
JsonOptions::Values::None
);
20
jv[sfCheckID.jsonName] =
to_string
(checkId);
21
jv[sfTransactionType.jsonName] = jss::CheckCash;
22
return
jv;
23
}
24
25
// Cash a check requiring that at least a minimum amount be delivered.
26
json::Value
27
cash
(
jtx::Account
const
& dest,
UInt256
const
& checkId,
DeliverMin
const
& atLeast)
28
{
29
json::Value
jv;
30
jv[sfAccount.jsonName] = dest.
human
();
31
jv[sfDeliverMin.jsonName] = atLeast.
value
.
getJson
(
JsonOptions::Values::None
);
32
jv[sfCheckID.jsonName] =
to_string
(checkId);
33
jv[sfTransactionType.jsonName] = jss::CheckCash;
34
return
jv;
35
}
36
37
// Cancel a check.
38
json::Value
39
cancel
(
jtx::Account
const
& dest,
UInt256
const
& checkId)
40
{
41
json::Value
jv;
42
jv[sfAccount.jsonName] = dest.
human
();
43
jv[sfCheckID.jsonName] =
to_string
(checkId);
44
jv[sfTransactionType.jsonName] = jss::CheckCancel;
45
return
jv;
46
}
47
48
}
// namespace xrpl::test::jtx::check
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::STAmount
Definition
STAmount.h:46
xrpl::STAmount::getJson
json::Value getJson(JsonOptions=JsonOptions::Values::None) const override
Definition
STAmount.cpp:735
xrpl::test::jtx::Account
Immutable cryptographic account descriptor.
Definition
jtx/Account.h:21
xrpl::test::jtx::Account::human
std::string const & human() const
Returns the human readable public key.
Definition
jtx/Account.h:113
xrpl::test::jtx::check
Check operations.
Definition
check.h:18
xrpl::test::jtx::check::cancel
json::Value cancel(jtx::Account const &dest, UInt256 const &checkId)
Cancel a check.
Definition
check.cpp:39
xrpl::test::jtx::check::cash
json::Value cash(jtx::Account const &dest, UInt256 const &checkId, STAmount const &amount)
Cash a check requiring that a specific amount be delivered.
Definition
check.cpp:15
xrpl::to_string
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition
base_uint.h:657
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::JsonOptions::Values::None
@ None
Definition
STBase.h:27
xrpl::test::jtx::check::DeliverMin
Type used to specify DeliverMin for cashing a check.
Definition
check.h:30
xrpl::test::jtx::check::DeliverMin::value
STAmount value
Definition
check.h:31
Generated by
1.17.0