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 xrpl {
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.
26cash(jtx::Account const& dest, uint256 const& checkId, DeliverMin const& atLeast)
27{
28 Json::Value jv;
29 jv[sfAccount.jsonName] = dest.human();
30 jv[sfDeliverMin.jsonName] = atLeast.value.getJson(JsonOptions::none);
31 jv[sfCheckID.jsonName] = to_string(checkId);
32 jv[sfTransactionType.jsonName] = jss::CheckCash;
33 return jv;
34}
35
36// Cancel a check.
38cancel(jtx::Account const& dest, uint256 const& checkId)
39{
40 Json::Value jv;
41 jv[sfAccount.jsonName] = dest.human();
42 jv[sfCheckID.jsonName] = to_string(checkId);
43 jv[sfTransactionType.jsonName] = jss::CheckCancel;
44 return jv;
45}
46
47} // namespace check
48
49} // namespace jtx
50} // namespace test
51} // namespace xrpl
Represents a JSON value.
Definition json_value.h:131
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Definition STAmount.cpp:721
Immutable cryptographic account descriptor.
Definition Account.h:20
std::string const & human() const
Returns the human readable public key.
Definition Account.h:95
void check(bool condition, std::string const &message)
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
Json::Value cancel(jtx::Account const &dest, uint256 const &checkId)
Cancel a check.
Definition check.cpp:38
auto const amount
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:598
Type used to specify DeliverMin for cashing a check.
Definition check.h:21