3#include <test/jtx/Env.h>
4#include <test/jtx/amount.h>
5#include <test/jtx/envconfig.h>
6#include <test/jtx/fee.h>
7#include <test/jtx/sig.h>
8#include <test/jtx/ter.h>
10#include <xrpld/core/Config.h>
12#include <xrpl/basics/strHex.h>
13#include <xrpl/beast/unit_test/suite.h>
14#include <xrpl/core/NetworkIDService.h>
15#include <xrpl/json/json_value.h>
16#include <xrpl/protocol/Serializer.h>
17#include <xrpl/protocol/TER.h>
18#include <xrpl/protocol/XRPAmount.h>
19#include <xrpl/protocol/jss.h>
40 cfg->networkId = networkID;
49 "Require txn NetworkID to be specified (or not) depending on the "
50 "network ID of the node");
53 auto const alice =
Account{
"alice"};
63 jv[jss::Destination] = alice.human();
64 jv[jss::TransactionType] =
"Payment";
65 jv[jss::Amount] =
"10000000000";
69 env(jv,
Fee(1000),
Ter(expectedOutcome));
80 jv[jss::Account] = alice.human();
81 jv[jss::TransactionType] = jss::AccountSet;
86 jv[jss::NetworkID] = 0;
91 jv[jss::NetworkID] = 10000;
103 jv[jss::Account] = alice.human();
104 jv[jss::TransactionType] = jss::AccountSet;
108 jv[jss::NetworkID] = 1024;
111 jv[jss::NetworkID] = 1000;
124 jvn[jss::Account] = alice.human();
125 jvn[jss::TransactionType] = jss::AccountSet;
127 jvn[jss::Sequence] = env.
seq(alice);
128 jvn[jss::LastLedgerSequence] = env.
current()->header().seq + 2;
133 env.
rpc(
"submit",
strHex(s.
slice()))[jss::result][jss::engine_result] ==
134 "telREQUIRES_NETWORK_ID");
139 jv[jss::Account] = alice.human();
140 jv[jss::TransactionType] = jss::AccountSet;
143 jv[jss::NetworkID] = 0;
146 jv[jss::NetworkID] = 1024;
150 jv[jss::NetworkID] = 1025;
TestcaseT testcase
Memberspace for declaring test cases.
virtual std::uint32_t getNetworkID() const noexcept=0
Get the configured network ID.
Slice slice() const noexcept
virtual NetworkIDService & getNetworkIDService()=0
static std::unique_ptr< Config > makeNetworkConfig(uint32_t networkID)
void run() override
Runs the suite.
Immutable cryptographic account descriptor.
std::string const & human() const
Returns the human readable public key.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
void fund(bool setDefaultRipple, STAmount const &amount, Account const &account)
std::uint32_t seq(Account const &account) const
Returns the next sequence number on account.
json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
JTx jtnofill(JsonValue &&jv, FN const &... fN)
Create a JTx from parameters.
void memoize(Account const &account)
Associate AccountID with account.
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Set the regular signature on a JTx.
Set the expected result code for a JTx The test will fail if the code doesn't match.
XrpT const XRP
Converts to XRP Issue or STAmount.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
@ telNETWORK_ID_MAKES_TX_NON_CANONICAL
std::string strHex(FwdIt begin, FwdIt end)
std::string to_string(BaseUInt< Bits, Tag > const &a)
TERSubset< CanCvtToTER > TER