20#include <test/jtx/batch.h>
21#include <test/jtx/utility.h>
23#include <xrpl/protocol/Batch.h>
24#include <xrpl/protocol/HashPrefix.h>
25#include <xrpl/protocol/Sign.h>
26#include <xrpl/protocol/jss.h>
40 uint32_t
const& numSigners,
44 return ((numSigners + 2) * feeDrops) + feeDrops * txns;
56 jv[jss::TransactionType] = jss::Batch;
57 jv[jss::Account] = account.human();
59 jv[jss::Sequence] =
seq;
60 jv[jss::Flags] =
flags;
68 auto const index = jt.
jv[jss::RawTransactions].
size();
69 Json::Value& batchTransaction = jt.
jv[jss::RawTransactions][index];
73 batchTransaction[jss::RawTransaction] =
txn_;
84 jt.
jv[jss::SigningPubKey] =
"";
92 STTx const& stx =
STTx{std::move(*st)};
93 auto& js = jt[sfBatchSigners.getJsonName()];
96 auto const& e = mySigners[i];
97 auto& jo = js[i][sfBatchSigner.getJsonName()];
98 jo[jss::Account] = e.acct.human();
99 jo[jss::SigningPubKey] =
strHex(e.sig.pk().slice());
105 jo[sfTxnSignature.getJsonName()] =
113 auto const mySigners =
signers;
118 jt.
jv[jss::SigningPubKey] =
"";
126 STTx const& stx =
STTx{std::move(*st)};
127 auto& bs = jt[sfBatchSigners.getJsonName()];
128 auto const index = jt[sfBatchSigners.jsonName].size();
129 auto& bso = bs[index][sfBatchSigner.getJsonName()];
131 bso[jss::SigningPubKey] =
"";
132 auto& is = bso[sfSigners.getJsonName()];
135 auto const& e = mySigners[i];
136 auto& iso = is[i][sfSigner.getJsonName()];
137 iso[jss::Account] = e.acct.human();
138 iso[jss::SigningPubKey] =
strHex(e.sig.pk().slice());
145 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 > 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.