19 #ifndef RIPPLE_TEST_JTX_TESTHELPERS_H_INCLUDED
20 #define RIPPLE_TEST_JTX_TESTHELPERS_H_INCLUDED
22 #include <ripple/basics/base_uint.h>
23 #include <ripple/json/json_value.h>
24 #include <ripple/protocol/AccountID.h>
25 #include <ripple/protocol/Quality.h>
26 #include <ripple/protocol/TxFlags.h>
27 #include <ripple/protocol/jss.h>
28 #include <test/jtx/Env.h>
53 template <
typename...
IOU>
59 for (
auto const& line : jrr[jss::lines])
61 for (
auto const& iou : {ious...})
63 if (line[jss::currency].asString() ==
to_string(iou.currency))
66 v[jss::currency] = line[jss::currency];
67 v[jss::balance] = line[jss::balance];
68 v[jss::limit] = line[jss::limit];
69 v[jss::account] = line[jss::account];
97 template <
class T,
class... Args>
102 if constexpr (
sizeof...(args) > 0)
106 template <
class... Args>
111 if constexpr (
sizeof...(args) > 0)
122 template <
class... Args>
131 template <
class... Args>
140 for (
auto const& p : st2)
161 bool defaultLimits =
false);
163 template <
typename... Amts>
171 return expectLine(env, account, value,
false) &&
191 Account
const& acct_a,
192 Account
const& acct_b,
213 return escrow(account.id(), to.
id(), amount);
235 {0xA0, 0x25, 0x80, 0x20, 0xE3, 0xB0, 0xC4, 0x42, 0x98, 0xFC,
236 0x1C, 0x14, 0x9A, 0xFB, 0xF4, 0xC8, 0x99, 0x6F, 0xB9, 0x24,
237 0x27, 0xAE, 0x41, 0xE4, 0x64, 0x9B, 0x93, 0x4C, 0xA4, 0x95,
238 0x99, 0x1B, 0x78, 0x52, 0xB8, 0x55, 0x81, 0x01, 0x00}};
349 account.id(), to.
id(), amount, settleDelay, pk, cancelAfter, dstTag);
377 return channel(account.id(), dst.
id(), seqProxyValue);
415 template <
typename A>
416 requires std::is_same_v<A, AccountID>
436 return create(account.id(), dest.
id(), sendMax);
445 #endif // RIPPLE_TEST_JTX_TESTHELPERS_H_INCLUDED
Json::Value getAccountOffers(Env &env, AccountID const &acct, bool current)
void operator()(jtx::Env &, jtx::JTx &jt) const
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Json::Value claim(AccountID const &account, uint256 const &channel, std::optional< STAmount > const &balance, std::optional< STAmount > const &amount, std::optional< Slice > const &signature, std::optional< PublicKey > const &pk)
A currency issued by an account.
bool checkArraySize(Json::Value const &val, unsigned int size)
const SF_AMOUNT sfSendMax
condition(Slice const &cond)
bool same(STPathSet const &st1, Args const &... args)
Json::Value finish(AccountID const &account, AccountID const &from, std::uint32_t seq)
const SF_ACCOUNT sfDestination
void stpath_append_one(STPath &st, Account const &account)
Json::Value ledgerEntryState(Env &env, Account const &acct_a, Account const &acct_b, std::string const ¤cy)
Set the "FinishAfter" time tag on a JTx.
An immutable linear range of bytes.
requires std::is_same_v< A, AccountID > Json::Value create(A const &account, A const &dest, STAmount const &sendMax)
Create a check.
Json::Value getJson(JsonOptions) const override
PrettyAmount xrpMinusFee(Env const &env, std::int64_t xrpAmount)
bool channelExists(ReadView const &view, uint256 const &chan)
bool isNull() const
isNull() tests to see if this field is null.
std::vector< STPath >::const_iterator end() const
const Json::StaticString jsonName
void n_offers(Env &env, std::size_t n, Account const &account, STAmount const &in, STAmount const &out)
bool equal(STAmount const &sa1, STAmount const &sa2)
requires(T::ConsequencesFactory==Transactor::Normal) TxConsequences consequences_helper(PreflightContext const &ctx)
AccountID id() const
Returns the Account ID.
const SF_UINT16 sfTransactionType
cancel_time(NetClock::time_point const &value)
T time_since_epoch(T... args)
Value & append(const Value &value)
Append value to array at the end.
uint256 channel(AccountID const &account, AccountID const &dst, std::uint32_t seqProxyValue)
std::vector< STPath >::size_type size() const
void stpath_append(STPath &st, T const &t, Args const &... args)
STPathElement IPE(Issue const &iss)
condition(std::array< std::uint8_t, N > const &c)
void stpathset_append(STPathSet &st, STPath const &p, Args const &... args)
Execution context for applying a JSON transaction.
void operator()(Env &, JTx &jt) const
STPath stpath(Args const &... args)
bool expectOffers(Env &env, AccountID const &account, std::uint16_t size, std::vector< Amounts > const &toMatch)
Set the "CancelAfter" time tag on a JTx.
NetClock::time_point value_
@ current
This was a new validation and was added.
STPathElement cpe(Currency const &c)
STPathElement allpe(AccountID const &a, Issue const &iss)
Json::Value cancel(AccountID const &account, Account const &from, std::uint32_t seq)
finish_time(NetClock::time_point const &value)
void operator()(Env &, JTx &jt) const
STAmount channelBalance(ReadView const &view, uint256 const &chan)
fulfillment(Slice condition)
Set the sequence number on a JTx.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Converts to IOU Issue or STAmount.
std::vector< STPath >::const_iterator begin() const
void operator()(Env &, JTx &jt) const
Json::Value accountBalance(Env &env, Account const &acct)
void fund(jtx::Env &env, jtx::Account const &gw, std::vector< jtx::Account > const &accounts, std::vector< STAmount > const &amts, Fund how)
constexpr std::array< std::uint8_t, 39 > cb1
const SF_UINT32 sfCancelAfter
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
const SF_UINT32 sfFinishAfter
Immutable cryptographic account descriptor.
const SF_ACCOUNT sfAccount
std::string strHex(FwdIt begin, FwdIt end)
NetClock::time_point value_
constexpr std::uint32_t tfUniversal
const std::array< std::uint8_t, 4 > fb1
Json::Value escrow(AccountID const &account, AccountID const &to, STAmount const &amount)
bool expectLedgerEntryRoot(Env &env, Account const &acct, STAmount const &expectedValue)
const SF_VL sfFulfillment
bool expectLine(Env &env, AccountID const &account, STAmount const &value, bool defaultLimits)
Json::Value create(AccountID const &account, AccountID const &to, STAmount const &amount, NetClock::duration const &settleDelay, PublicKey const &pk, std::optional< NetClock::time_point > const &cancelAfter, std::optional< std::uint32_t > const &dstTag)
XRPAmount txfee(Env const &env, std::uint16_t n)
A transaction testing environment.
Json::Value getAccountLines(Env &env, AccountID const &acctId)
Json::Value ledgerEntryRoot(Env &env, Account const &acct)
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...
fulfillment(std::array< std::uint8_t, N > f)
void push_back(STPath const &e)