xrpld
Loading...
Searching...
No Matches
offer.cpp
1#include <test/jtx/offer.h>
2
3#include <test/jtx/Account.h>
4
5#include <xrpl/json/json_value.h>
6#include <xrpl/protocol/STAmount.h>
7#include <xrpl/protocol/jss.h>
8
9#include <cstdint>
10
11namespace xrpl::test::jtx {
12
13json::Value
15 Account const& account,
16 STAmount const& takerPays,
17 STAmount const& takerGets,
18 std::uint32_t flags)
19{
20 json::Value jv;
21 jv[jss::Account] = account.human();
22 jv[jss::TakerPays] = takerPays.getJson(JsonOptions::Values::None);
23 jv[jss::TakerGets] = takerGets.getJson(JsonOptions::Values::None);
24 if (flags != 0u)
25 jv[jss::Flags] = flags;
26 jv[jss::TransactionType] = jss::OfferCreate;
27 return jv;
28}
29
31offerCancel(Account const& account, std::uint32_t offerSeq)
32{
33 json::Value jv;
34 jv[jss::Account] = account.human();
35 jv[jss::OfferSequence] = offerSeq;
36 jv[jss::TransactionType] = jss::OfferCancel;
37 return jv;
38}
39
40} // 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
json::Value offerCancel(Account const &account, std::uint32_t offerSeq)
Cancel an offer.
Definition offer.cpp:31
json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
Definition offer.cpp:14