1#include <test/jtx/batch.h>
2#include <test/jtx/utility.h>
4#include <xrpl/protocol/Batch.h>
5#include <xrpl/protocol/HashPrefix.h>
6#include <xrpl/protocol/Sign.h>
7#include <xrpl/protocol/jss.h>
21 uint32_t
const& numSigners,
25 return ((numSigners + 2) * feeDrops) + feeDrops * txns;
37 jv[jss::TransactionType] = jss::Batch;
38 jv[jss::Account] = account.human();
40 jv[jss::Sequence] =
seq;
41 jv[jss::Flags] =
flags;
49 auto const index = jt.
jv[jss::RawTransactions].
size();
50 Json::Value& batchTransaction = jt.
jv[jss::RawTransactions][index];
54 batchTransaction[jss::RawTransaction] =
txn_;
65 jt.
jv[jss::SigningPubKey] =
"";
73 STTx const& stx =
STTx{std::move(*st)};
74 auto& js = jt[sfBatchSigners.getJsonName()];
77 auto const& e = mySigners[i];
78 auto& jo = js[i][sfBatchSigner.getJsonName()];
79 jo[jss::Account] = e.acct.human();
80 jo[jss::SigningPubKey] =
strHex(e.sig.pk().slice());
86 jo[sfTxnSignature.getJsonName()] =
99 jt.
jv[jss::SigningPubKey] =
"";
107 STTx const& stx =
STTx{std::move(*st)};
108 auto& bs = jt[sfBatchSigners.getJsonName()];
109 auto const index = jt[sfBatchSigners.jsonName].size();
110 auto& bso = bs[index][sfBatchSigner.getJsonName()];
112 bso[jss::SigningPubKey] =
"";
113 auto& is = bso[sfSigners.getJsonName()];
116 auto const& e = mySigners[i];
117 auto& iso = is[i][sfSigner.getJsonName()];
118 iso[jss::Account] = e.acct.human();
119 iso[jss::SigningPubKey] =
strHex(e.sig.pk().slice());
126 iso[sfTxnSignature.getJsonName()] =
UInt size() const
Number of values in array or object.
log_os< char > log
Logging output stream.
std::uint32_t getFlags() const
std::vector< uint256 > const & getBatchTransactionIDs() const
Retrieves a batch of transaction IDs from the STTx.
Slice slice() const noexcept
An immutable linear range of bytes.
Immutable cryptographic account descriptor.
std::string const & human() const
Returns the human readable public key.
A transaction testing environment.
beast::unit_test::suite & test
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
void operator()(Env &, JTx &jtx) const
void operator()(Env &, JTx &jt) const
std::vector< Reg > signers
Set a batch signature on a JTx.
void operator()(Env &, JTx &jt) const
std::vector< Reg > signers
@ arrayValue
array value (ordered list)
Json::Value outer(jtx::Account const &account, uint32_t seq, STAmount const &fee, std::uint32_t flags)
Batch.
XRPAmount calcBatchFee(jtx::Env const &env, uint32_t const &numSigners, uint32_t const &txns=0)
Calculate Batch Fee.
STObject parse(Json::Value const &jv)
Convert JSON to STObject.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void finishMultiSigningData(AccountID const &signingID, Serializer &s)
void serializeBatch(Serializer &msg, std::uint32_t const &flags, std::vector< uint256 > const &txids)
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &message)
Generate a signature for a message.
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
std::string strHex(FwdIt begin, FwdIt end)
std::string to_string(base_uint< Bits, Tag > const &a)
void Rethrow()
Rethrow the exception currently being handled.
Execution context for applying a JSON transaction.
Set the sequence number on a JTx.