xrpld
Loading...
Searching...
No Matches
pay.cpp
1#include <test/jtx/pay.h>
2
3#include <test/jtx/Account.h>
4#include <test/jtx/amount.h>
5
6#include <xrpl/json/json_value.h>
7#include <xrpl/protocol/AccountID.h>
8#include <xrpl/protocol/TxFlags.h>
9#include <xrpl/protocol/jss.h>
10
11namespace xrpl::test::jtx {
12
13json::Value
14pay(AccountID const& account, AccountID const& to, AnyAmount amount)
15{
16 amount.to(to);
17 json::Value jv;
18 jv[jss::Account] = to_string(account);
19 jv[jss::Amount] = amount.value.getJson(JsonOptions::Values::None);
20 jv[jss::Destination] = to_string(to);
21 jv[jss::TransactionType] = jss::Payment;
22 jv[jss::Flags] = tfFullyCanonicalSig;
23 return jv;
24}
26pay(Account const& account, Account const& to, AnyAmount amount)
27{
28 return pay(account.id(), to.id(), amount);
29}
30
31} // namespace xrpl::test::jtx
Represents a JSON value.
Definition json_value.h:130
json::Value getJson(JsonOptions=JsonOptions::Values::None) const override
Definition STAmount.cpp:734
Immutable cryptographic account descriptor.
Definition jtx/Account.h:17
AccountID id() const
Returns the Account ID.
Definition jtx/Account.h:85
json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
Definition pay.cpp:14
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition base_uint.h:633
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:28
constexpr FlagValue tfFullyCanonicalSig
Definition TxFlags.h:42
Amount specifier with an option for any issuer.
void to(AccountID const &id)