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/jss.h>
27 #include <test/jtx/Env.h>
52 template <
typename...
IOU>
58 for (
auto const& line : jrr[jss::lines])
60 for (
auto const& iou : {ious...})
62 if (line[jss::currency].asString() ==
to_string(iou.currency))
65 v[jss::currency] = line[jss::currency];
66 v[jss::balance] = line[jss::balance];
67 v[jss::limit] = line[jss::limit];
68 v[jss::account] = line[jss::account];
96 template <
class T,
class... Args>
101 if constexpr (
sizeof...(args) > 0)
105 template <
class... Args>
110 if constexpr (
sizeof...(args) > 0)
121 template <
class... Args>
130 template <
class... Args>
139 for (
auto const& p : st2)
160 bool defaultLimits =
false);
162 template <
typename... Amts>
170 return expectLine(env, account, value,
false) &&
190 Account
const& acct_a,
191 Account
const& acct_b,
212 return escrow(account.id(), to.
id(), amount);
234 {0xA0, 0x25, 0x80, 0x20, 0xE3, 0xB0, 0xC4, 0x42, 0x98, 0xFC,
235 0x1C, 0x14, 0x9A, 0xFB, 0xF4, 0xC8, 0x99, 0x6F, 0xB9, 0x24,
236 0x27, 0xAE, 0x41, 0xE4, 0x64, 0x9B, 0x93, 0x4C, 0xA4, 0x95,
237 0x99, 0x1B, 0x78, 0x52, 0xB8, 0x55, 0x81, 0x01, 0x00}};
348 account.id(), to.
id(), amount, settleDelay, pk, cancelAfter, dstTag);
376 return channel(account.id(), dst.
id(), seqProxyValue);
412 #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)
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)
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.
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)
AccountID id() const
Returns the Account ID.
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.
std::string strHex(FwdIt begin, FwdIt end)
NetClock::time_point value_
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)