rippled
ticket.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/ticket.h>
21 #include <ripple/protocol/jss.h>
22 
23 namespace ripple {
24 namespace test {
25 namespace jtx {
26 
27 namespace ticket {
28 
29 namespace detail {
30 
32 create (Account const& account,
33  boost::optional<Account> const& target,
34  boost::optional<std::uint32_t> const& expire)
35 {
36  Json::Value jv;
37  jv[jss::Account] = account.human();
38  jv[jss::TransactionType] = jss::TicketCreate;
39  if (expire)
40  jv["Expiration"] = *expire;
41  if (target)
42  jv["Target"] = target->human();
43  return jv;
44 }
45 
46 } // detail
47 
49 cancel(Account const& account, std::string const & ticketId)
50 {
51  Json::Value jv;
52  jv[jss::TransactionType] = jss::TicketCancel;
53  jv[jss::Account] = account.human();
54  jv["TicketID"] = ticketId;
55  return jv;
56 }
57 
58 } // ticket
59 
60 } // jtx
61 } // test
62 } // ripple
std::string
STL class.
ripple::test::jtx::ticket::cancel
Json::Value cancel(Account const &account, std::string const &ticketId)
Cancel a ticket.
Definition: ticket.cpp:49
ripple::test::jtx::ticket::detail::create
Json::Value create(Account const &account, boost::optional< Account > const &target, boost::optional< std::uint32_t > const &expire)
Definition: ticket.cpp:32
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
Json::Value
Represents a JSON value.
Definition: json_value.h:141