rippled
Loading...
Searching...
No Matches
Env_ss.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_ENV_SS_H_INCLUDED
21#define RIPPLE_TEST_JTX_ENV_SS_H_INCLUDED
22
23#include <test/jtx/Env.h>
24
25namespace ripple {
26namespace test {
27namespace jtx {
28
33class Env_ss
34{
35private:
37
38private:
40 {
41 public:
45
46 SignSubmitRunner(Env& env, JTx&& jt) : env_(env), jt_(jt)
47 {
48 }
49
50 void
52 {
53 env_.sign_and_submit(jt_, params);
54 }
55
56 private:
58 JTx const jt_;
59 };
60
61public:
62 Env_ss(Env_ss const&) = delete;
63 Env_ss&
64 operator=(Env_ss const&) = delete;
65
66 Env_ss(Env& env) : env_(env)
67 {
68 }
69
70 template <class JsonValue, class... FN>
71 SignSubmitRunner
72 operator()(JsonValue&& jv, FN const&... fN)
73 {
74 auto jtx = env_.jt(std::forward<JsonValue>(jv), fN...);
75 return SignSubmitRunner(env_, std::move(jtx));
76 }
77};
78
79} // namespace jtx
80} // namespace test
81} // namespace ripple
82
83#endif
Represents a JSON value.
Definition json_value.h:149
SignSubmitRunner & operator=(SignSubmitRunner &&)=delete
void operator()(Json::Value const &params=Json::nullValue)
Definition Env_ss.h:51
SignSubmitRunner(SignSubmitRunner &&)=default
A transaction testing environment wrapper.
Definition Env_ss.h:34
Env_ss & operator=(Env_ss const &)=delete
SignSubmitRunner operator()(JsonValue &&jv, FN const &... fN)
Definition Env_ss.h:72
Env_ss(Env_ss const &)=delete
A transaction testing environment.
Definition Env.h:121
void sign_and_submit(JTx const &jt, Json::Value params=Json::nullValue)
Use the submit RPC command with a provided JTx object.
Definition Env.cpp:405
JTx jt(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
Definition Env.h:508
T is_same_v
@ nullValue
'null' value
Definition json_value.h:38
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
Execution context for applying a JSON transaction.
Definition JTx.h:45