xrpld
Loading...
Searching...
No Matches
sig.cpp
1#include <test/jtx/sig.h>
2
3#include <test/jtx/Env.h>
4#include <test/jtx/JTx.h>
5#include <test/jtx/utility.h>
6
7namespace xrpl::test::jtx {
8
9void
11{
12 if (!manual_)
13 return;
14 if (subField_ == nullptr)
15 jt.fillSig = false;
16 if (account_)
17 {
18 // VFALCO Inefficient pre-C++14
19 auto const account = *account_;
20 auto callback = [subField = subField_, account](Env&, JTx& jtx) {
21 // Where to put the signature. Supports sfCounterPartySignature.
22 auto& sigObject = subField ? jtx[*subField] : jtx.jv;
23
24 jtx::sign(jtx.jv, account, sigObject);
25 };
26 if (subField_ == nullptr)
27 {
28 jt.mainSigners.emplace_back(callback);
29 }
30 else
31 {
32 jt.postSigners.emplace_back(callback);
33 }
34 }
35}
36
37} // namespace xrpl::test::jtx
A transaction testing environment.
Definition Env.h:143
std::optional< Account > account_
Account that will generate the signature.
Definition sig.h:26
SField const *const subField_
Alternative transaction object field in which to place the signature.
Definition sig.h:20
void operator()(Env &, JTx &jt) const
Definition sig.cpp:10
void sign(json::Value &jv, Account const &account, json::Value &sigObject)
Sign automatically into a specific Json field of the jv object.
Definition utility.cpp:40
Execution context for applying a JSON transaction.
Definition JTx.h:23
std::vector< std::function< void(Env &, JTx &)> > postSigners
Definition JTx.h:38
std::vector< std::function< void(Env &, JTx &)> > mainSigners
Definition JTx.h:35