rippled
Loading...
Searching...
No Matches
offer.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#include <test/jtx/offer.h>
21
22#include <xrpl/protocol/jss.h>
23
24namespace ripple {
25namespace test {
26namespace jtx {
27
30 Account const& account,
31 STAmount const& takerPays,
32 STAmount const& takerGets,
34{
35 Json::Value jv;
36 jv[jss::Account] = account.human();
37 jv[jss::TakerPays] = takerPays.getJson(JsonOptions::none);
38 jv[jss::TakerGets] = takerGets.getJson(JsonOptions::none);
39 if (flags)
40 jv[jss::Flags] = flags;
41 jv[jss::TransactionType] = jss::OfferCreate;
42 return jv;
43}
44
46offer_cancel(Account const& account, std::uint32_t offerSeq)
47{
48 Json::Value jv;
49 jv[jss::Account] = account.human();
50 jv[jss::OfferSequence] = offerSeq;
51 jv[jss::TransactionType] = jss::OfferCancel;
52 return jv;
53}
54
55} // namespace jtx
56} // namespace test
57} // namespace ripple
Represents a JSON value.
Definition json_value.h:149
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Definition STAmount.cpp:795
Immutable cryptographic account descriptor.
Definition Account.h:39
Match set account flags.
Definition flags.h:128
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
Definition offer.cpp:29
Json::Value offer_cancel(Account const &account, std::uint32_t offerSeq)
Cancel an offer.
Definition offer.cpp:46
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25