rippled
Loading...
Searching...
No Matches
deposit.cpp
1#include <test/jtx/deposit.h>
2
3#include <xrpl/protocol/jss.h>
4
5namespace xrpl {
6namespace test {
7namespace jtx {
8
9namespace deposit {
10
11// Add DepositPreauth.
13auth(jtx::Account const& account, jtx::Account const& auth)
14{
15 Json::Value jv;
16 jv[sfAccount.jsonName] = account.human();
17 jv[sfAuthorize.jsonName] = auth.human();
18 jv[sfTransactionType.jsonName] = jss::DepositPreauth;
19 return jv;
20}
21
22// Remove DepositPreauth.
24unauth(jtx::Account const& account, jtx::Account const& unauth)
25{
26 Json::Value jv;
27 jv[sfAccount.jsonName] = account.human();
28 jv[sfUnauthorize.jsonName] = unauth.human();
29 jv[sfTransactionType.jsonName] = jss::DepositPreauth;
30 return jv;
31}
32
33// Add DepositPreauth.
36{
37 Json::Value jv;
38 jv[sfAccount.jsonName] = account.human();
39 jv[sfAuthorizeCredentials.jsonName] = Json::arrayValue;
40 auto& arr(jv[sfAuthorizeCredentials.jsonName]);
41 for (auto const& o : auth)
42 {
43 Json::Value j2;
44 j2[jss::Credential] = o.toJson();
45 arr.append(std::move(j2));
46 }
47 jv[sfTransactionType.jsonName] = jss::DepositPreauth;
48 return jv;
49}
50
51// Remove DepositPreauth.
54{
55 Json::Value jv;
56 jv[sfAccount.jsonName] = account.human();
57 jv[sfUnauthorizeCredentials.jsonName] = Json::arrayValue;
58 auto& arr(jv[sfUnauthorizeCredentials.jsonName]);
59 for (auto const& o : auth)
60 {
61 Json::Value j2;
62 j2[jss::Credential] = o.toJson();
63 arr.append(std::move(j2));
64 }
65 jv[sfTransactionType.jsonName] = jss::DepositPreauth;
66 return jv;
67}
68
69} // namespace deposit
70
71} // namespace jtx
72} // namespace test
73} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
Value & append(Value const &value)
Append value to array at the end.
Immutable cryptographic account descriptor.
Definition Account.h:19
@ arrayValue
array value (ordered list)
Definition json_value.h:25
Json::Value authCredentials(jtx::Account const &account, std::vector< AuthorizeCredentials > const &auth)
Definition deposit.cpp:35
Json::Value unauth(Account const &account, Account const &unauth)
Remove pre-authorization for deposit.
Definition deposit.cpp:24
Json::Value unauthCredentials(jtx::Account const &account, std::vector< AuthorizeCredentials > const &auth)
Definition deposit.cpp:53
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5