rippled
Loading...
Searching...
No Matches
check.cpp
1#include <test/jtx/check.h>
2
3#include <xrpl/protocol/TxFlags.h>
4#include <xrpl/protocol/jss.h>
5
6namespace ripple {
7namespace test {
8namespace jtx {
9
10namespace check {
11
12// Cash a check requiring that a specific amount be delivered.
14cash(jtx::Account const& dest, uint256 const& checkId, STAmount const& amount)
15{
16 Json::Value jv;
17 jv[sfAccount.jsonName] = dest.human();
18 jv[sfAmount.jsonName] = amount.getJson(JsonOptions::none);
19 jv[sfCheckID.jsonName] = to_string(checkId);
20 jv[sfTransactionType.jsonName] = jss::CheckCash;
21 return jv;
22}
23
24// Cash a check requiring that at least a minimum amount be delivered.
27 jtx::Account const& dest,
28 uint256 const& checkId,
29 DeliverMin const& atLeast)
30{
31 Json::Value jv;
32 jv[sfAccount.jsonName] = dest.human();
33 jv[sfDeliverMin.jsonName] = atLeast.value.getJson(JsonOptions::none);
34 jv[sfCheckID.jsonName] = to_string(checkId);
35 jv[sfTransactionType.jsonName] = jss::CheckCash;
36 return jv;
37}
38
39// Cancel a check.
41cancel(jtx::Account const& dest, uint256 const& checkId)
42{
43 Json::Value jv;
44 jv[sfAccount.jsonName] = dest.human();
45 jv[sfCheckID.jsonName] = to_string(checkId);
46 jv[sfTransactionType.jsonName] = jss::CheckCancel;
47 return jv;
48}
49
50} // namespace check
51
52} // namespace jtx
53} // namespace test
54} // namespace ripple
Represents a JSON value.
Definition json_value.h:130
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Definition STAmount.cpp:753
Immutable cryptographic account descriptor.
Definition Account.h:20
std::string const & human() const
Returns the human readable public key.
Definition Account.h:99
void check(bool condition, std::string const &message)
Json::Value cancel(jtx::Account const &dest, uint256 const &checkId)
Cancel a check.
Definition check.cpp:41
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:14
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:611
Type used to specify DeliverMin for cashing a check.
Definition check.h:21