rippled
Loading...
Searching...
No Matches
utility.h
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#ifndef RIPPLE_TEST_JTX_UTILITY_H_INCLUDED
21#define RIPPLE_TEST_JTX_UTILITY_H_INCLUDED
22
23#include <test/jtx/Account.h>
24
25#include <xrpld/app/ledger/Ledger.h>
26#include <xrpld/rpc/detail/RPCHelpers.h>
27
28#include <xrpl/json/json_value.h>
29#include <xrpl/protocol/STObject.h>
30
31#include <stdexcept>
32
33namespace ripple {
34namespace test {
35namespace jtx {
36
39{
40 template <class String>
41 explicit parse_error(String const& s) : logic_error(s)
42 {
43 }
44};
45
52parse(Json::Value const& jv);
53
57void
58sign(Json::Value& jv, Account const& account);
59
61void
62fill_fee(Json::Value& jv, ReadView const& view);
63
65void
66fill_seq(Json::Value& jv, ReadView const& view);
67
71 std::vector<std::string> const& args,
73 unsigned int apiVersion);
74
75} // namespace jtx
76} // namespace test
77} // namespace ripple
78
79#endif
Represents a JSON value.
Definition: json_value.h:150
A generic endpoint for log messages.
Definition: Journal.h:60
A view into a ledger.
Definition: ReadView.h:52
Immutable cryptographic account descriptor.
Definition: Account.h:39
void fill_seq(Json::Value &jv, ReadView const &view)
Set the sequence number automatically.
Definition: utility.cpp:66
void sign(Json::Value &jv, Account const &account)
Sign automatically.
Definition: utility.cpp:47
Json::Value cmdToJSONRPC(std::vector< std::string > const &args, beast::Journal j, unsigned int apiVersion)
Given a rippled unit test rpc command, return the corresponding JSON.
Definition: utility.cpp:80
STObject parse(Json::Value const &jv)
Convert JSON to STObject.
Definition: utility.cpp:38
void fill_fee(Json::Value &jv, ReadView const &view)
Set the fee automatically.
Definition: utility.cpp:58
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
Thrown when parse fails.
Definition: utility.h:39
parse_error(String const &s)
Definition: utility.h:41