rippled
Loading...
Searching...
No Matches
TestHelpers.h
1#pragma once
2
3#include <test/jtx/Env.h>
4
5#include <xrpld/app/misc/TxQ.h>
6
7#include <xrpl/basics/base_uint.h>
8#include <xrpl/beast/unit_test/suite.h>
9#include <xrpl/json/json_value.h>
10#include <xrpl/protocol/AccountID.h>
11#include <xrpl/protocol/Quality.h>
12#include <xrpl/protocol/STNumber.h>
13#include <xrpl/protocol/TxFlags.h>
14#include <xrpl/protocol/Units.h>
15#include <xrpl/protocol/jss.h>
16
17#include <source_location>
18#include <vector>
19
20namespace xrpl {
21namespace test {
22namespace jtx {
23
29template <class SField, class StoredValue = typename SField::type::value_type, class OutputValue = StoredValue>
31{
32 using SF = SField;
33 using SV = StoredValue;
34 using OV = OutputValue;
35
36protected:
37 SF const& sfield_;
39
40public:
41 explicit JTxField(SF const& sfield, SV const& value) : sfield_(sfield), value_(value)
42 {
43 }
44
45 virtual ~JTxField() = default;
46
47 virtual OV
48 value() const = 0;
49
50 virtual void
51 operator()(Env&, JTx& jt) const
52 {
53 jt.jv[sfield_.jsonName] = value();
54 }
55};
56
57template <class SField, class StoredValue>
58struct JTxField<SField, StoredValue, StoredValue>
59{
60 using SF = SField;
61 using SV = StoredValue;
62 using OV = SV;
63
64protected:
65 SF const& sfield_;
67
68public:
69 explicit JTxField(SF const& sfield, SV const& value) : sfield_(sfield), value_(value)
70 {
71 }
72
73 void
74 operator()(Env&, JTx& jt) const
75 {
77 }
78};
79
80struct timePointField : public JTxField<SF_UINT32, NetClock::time_point, NetClock::rep>
81{
82 using SF = SF_UINT32;
86
87protected:
88 using base::value_;
89
90public:
91 explicit timePointField(SF const& sfield, SV const& value) : JTxField(sfield, value)
92 {
93 }
94
95 OV
96 value() const override
97 {
98 return value_.time_since_epoch().count();
99 }
100};
101
102struct uint256Field : public JTxField<SF_UINT256, uint256, std::string>
103{
104 using SF = SF_UINT256;
105 using SV = uint256;
108
109protected:
110 using base::value_;
111
112public:
113 explicit uint256Field(SF const& sfield, SV const& value) : JTxField(sfield, value)
114 {
115 }
116
117 OV
118 value() const override
119 {
120 return to_string(value_);
121 }
122};
123
124struct accountIDField : public JTxField<SF_ACCOUNT, AccountID, std::string>
125{
126 using SF = SF_ACCOUNT;
127 using SV = AccountID;
130
131protected:
132 using base::value_;
133
134public:
135 explicit accountIDField(SF const& sfield, SV const& value) : JTxField(sfield, value)
136 {
137 }
138
139 OV
140 value() const override
141 {
142 return toBase58(value_);
143 }
144};
145
146struct stAmountField : public JTxField<SF_AMOUNT, STAmount, Json::Value>
147{
148 using SF = SF_AMOUNT;
149 using SV = STAmount;
152
153protected:
154 using base::value_;
155
156public:
157 explicit stAmountField(SF const& sfield, SV const& value) : JTxField(sfield, value)
158 {
159 }
160
161 OV
162 value() const override
163 {
165 }
166};
167
168struct blobField : public JTxField<SF_VL, std::string>
169{
170 using SF = SF_VL;
173
174 using JTxField::JTxField;
175
176 explicit blobField(SF const& sfield, Slice const& cond) : JTxField(sfield, strHex(cond))
177 {
178 }
179
180 template <size_t N>
181 explicit blobField(SF const& sfield, std::array<std::uint8_t, N> const& c) : blobField(sfield, makeSlice(c))
182 {
183 }
184};
185
186template <class SField, class UnitTag, class ValueType>
187struct valueUnitField : public JTxField<SField, unit::ValueUnit<UnitTag, ValueType>, ValueType>
188{
189 using SF = SField;
191 using OV = ValueType;
193
195
196protected:
197 using base::value_;
198
199public:
200 using JTxField<SF, SV, OV>::JTxField;
201
202 OV
203 value() const override
204 {
205 return value_.value();
206 }
207};
208
209template <class JTxField>
211{
212 using JF = JTxField;
213 using SF = typename JF::SF;
214 using SV = typename JF::SV;
215
216protected:
217 SF const& sfield_;
218
219public:
220 explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
221 {
222 }
223
224 JF
225 operator()(SV const& value) const
226 {
227 return JTxField(sfield_, value);
228 }
229};
230
231template <>
233{
234 using JF = blobField;
235 using SF = JF::SF;
236 using SV = JF::SV;
237
238protected:
239 SF const& sfield_;
240
241public:
242 explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
243 {
244 }
245
246 JF
247 operator()(SV const& cond) const
248 {
249 return JF(sfield_, makeSlice(cond));
250 }
251
252 JF
253 operator()(Slice const& cond) const
254 {
255 return JF(sfield_, cond);
256 }
257
258 template <size_t N>
259 JF
261 {
262 return operator()(makeSlice(c));
263 }
264};
265
266template <class SField, class UnitTag, class ValueType = typename SField::type::value_type>
268
269template <class SField, class StoredValue = typename SField::type::value_type>
271
274auto const data = JTxFieldWrapper<blobField>(sfData);
275
277
278// TODO We only need this long "requires" clause as polyfill, for C++20
279// implementations which are missing <ranges> header. Replace with
280// `std::ranges::range<Input>`, and accordingly use std::ranges::begin/end
281// when we have moved to better compilers.
282template <typename Input>
283auto
284make_vector(Input const& input)
285 requires requires(Input& v) {
286 std::begin(v);
287 std::end(v);
288 }
289{
290 return std::vector(std::begin(input), std::end(input));
291}
292
293// Functions used in debugging
295getAccountOffers(Env& env, AccountID const& acct, bool current = false);
296
297inline Json::Value
298getAccountOffers(Env& env, Account const& acct, bool current = false)
299{
300 return getAccountOffers(env, acct.id(), current);
301}
302
304getAccountLines(Env& env, AccountID const& acctId);
305
306inline Json::Value
307getAccountLines(Env& env, Account const& acct)
308{
309 return getAccountLines(env, acct.id());
310}
311
312template <typename... IOU>
314getAccountLines(Env& env, AccountID const& acctId, IOU... ious)
315{
316 auto const jrr = getAccountLines(env, acctId);
317 Json::Value res;
318 for (auto const& line : jrr[jss::lines])
319 {
320 for (auto const& iou : {ious...})
321 {
322 if (line[jss::currency].asString() == to_string(iou.currency))
323 {
324 Json::Value v;
325 v[jss::currency] = line[jss::currency];
326 v[jss::balance] = line[jss::balance];
327 v[jss::limit] = line[jss::limit];
328 v[jss::account] = line[jss::account];
329 res[jss::lines].append(v);
330 }
331 }
332 }
333 if (!res.isNull())
334 return res;
335 return jrr;
336}
337
338[[nodiscard]] bool
339checkArraySize(Json::Value const& val, unsigned int size);
340
341// Helper function that returns the owner count on an account.
343ownerCount(test::jtx::Env const& env, test::jtx::Account const& account);
344
345[[nodiscard]]
346inline bool
347checkVL(Slice const& result, std::string const& expected)
348{
349 Serializer s;
350 s.addRaw(result);
351 return s.getString() == expected;
352}
353
354[[nodiscard]]
355inline bool
356checkVL(std::shared_ptr<SLE const> const& sle, SField const& field, std::string const& expected)
357{
358 return strHex(expected) == strHex(sle->getFieldVL(field));
359}
360
361/* Path finding */
362/******************************************************************************/
363void
364stpath_append_one(STPath& st, Account const& account);
365
366template <class T>
368stpath_append_one(STPath& st, T const& t)
369{
371}
372
373void
375
376template <class T, class... Args>
377void
378stpath_append(STPath& st, T const& t, Args const&... args)
379{
380 stpath_append_one(st, t);
381 if constexpr (sizeof...(args) > 0)
382 stpath_append(st, args...);
383}
384
385template <class... Args>
386void
387stpathset_append(STPathSet& st, STPath const& p, Args const&... args)
388{
389 st.push_back(p);
390 if constexpr (sizeof...(args) > 0)
391 stpathset_append(st, args...);
392}
393
394bool
395equal(STAmount const& sa1, STAmount const& sa2);
396
397// Issue path element
399IPE(Issue const& iss);
400
401template <class... Args>
402STPath
403stpath(Args const&... args)
404{
405 STPath st;
406 stpath_append(st, args...);
407 return st;
408}
409
410template <class... Args>
411bool
412same(STPathSet const& st1, Args const&... args)
413{
414 STPathSet st2;
415 stpathset_append(st2, args...);
416 if (st1.size() != st2.size())
417 return false;
418
419 for (auto const& p : st2)
420 {
421 if (std::find(st1.begin(), st1.end(), p) == st1.end())
422 return false;
423 }
424 return true;
425}
426
427/******************************************************************************/
428
430txfee(Env const& env, std::uint16_t n);
431
433xrpMinusFee(Env const& env, std::int64_t xrpAmount);
434
435bool
436expectHolding(Env& env, AccountID const& account, STAmount const& value, bool defaultLimits = false);
437
438template <typename... Amts>
439bool
440expectHolding(Env& env, AccountID const& account, STAmount const& value, Amts const&... amts)
441{
442 return expectHolding(env, account, value, false) && expectHolding(env, account, amts...);
443}
444
445bool
446expectHolding(Env& env, AccountID const& account, None const& value);
447
448bool
449expectOffers(Env& env, AccountID const& account, std::uint16_t size, std::vector<Amounts> const& toMatch = {});
450
452ledgerEntryRoot(Env& env, Account const& acct);
453
455ledgerEntryState(Env& env, Account const& acct_a, Account const& acct_b, std::string const& currency);
456
458accountBalance(Env& env, Account const& acct);
459
460[[nodiscard]] bool
461expectLedgerEntryRoot(Env& env, Account const& acct, STAmount const& expectedValue);
462
463/* Payment Channel */
464/******************************************************************************/
465namespace paychan {
466
468create(
469 AccountID const& account,
470 AccountID const& to,
471 STAmount const& amount,
472 NetClock::duration const& settleDelay,
473 PublicKey const& pk,
476
477inline Json::Value
479 Account const& account,
480 Account const& to,
481 STAmount const& amount,
482 NetClock::duration const& settleDelay,
483 PublicKey const& pk,
486{
487 return create(account.id(), to.id(), amount, settleDelay, pk, cancelAfter, dstTag);
488}
489
491fund(
492 AccountID const& account,
493 uint256 const& channel,
494 STAmount const& amount,
496
498claim(
499 AccountID const& account,
500 uint256 const& channel,
503 std::optional<Slice> const& signature = std::nullopt,
505
507channel(AccountID const& account, AccountID const& dst, std::uint32_t seqProxyValue);
508
509inline uint256
510channel(Account const& account, Account const& dst, std::uint32_t seqProxyValue)
511{
512 return channel(account.id(), dst.id(), seqProxyValue);
513}
514
516channelBalance(ReadView const& view, uint256 const& chan);
517
518bool
519channelExists(ReadView const& view, uint256 const& chan);
520
521} // namespace paychan
522
523/* Crossing Limits */
524/******************************************************************************/
525
526void
527n_offers(Env& env, std::size_t n, Account const& account, STAmount const& in, STAmount const& out);
528
529/* Pay Strand */
530/***************************************************************/
531
532// Currency path element
534cpe(Currency const& c);
535
536// All path element
538allPathElements(AccountID const& a, Issue const& iss);
539/***************************************************************/
540
541/* Check */
542/***************************************************************/
543namespace check {
544
546// clang-format off
547template <typename A>
550create(A const& account, A const& dest, STAmount const& sendMax)
551{
552 Json::Value jv;
553 jv[sfAccount.jsonName] = to_string(account);
554 jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none);
555 jv[sfDestination.jsonName] = to_string(dest);
556 jv[sfTransactionType.jsonName] = jss::CheckCreate;
557 return jv;
558}
559// clang-format on
560
561inline Json::Value
562create(jtx::Account const& account, jtx::Account const& dest, STAmount const& sendMax)
563{
564 return create(account.id(), dest.id(), sendMax);
565}
566
567} // namespace check
568
571
572template <class Suite>
573void
575 Suite& test,
576 jtx::Env& env,
577 std::size_t expectedCount,
578 std::optional<std::size_t> expectedMaxCount,
579 std::size_t expectedInLedger,
580 std::size_t expectedPerLedger,
581 std::uint64_t expectedMinFeeLevel = baseFeeLevel.fee(),
582 std::uint64_t expectedMedFeeLevel = minEscalationFeeLevel.fee(),
584{
585 int line = location.line();
586 char const* file = location.file_name();
587 FeeLevel64 const expectedMin{expectedMinFeeLevel};
588 FeeLevel64 const expectedMed{expectedMedFeeLevel};
589 auto const metrics = env.app().getTxQ().getMetrics(*env.current());
590 using namespace std::string_literals;
591
592 metrics.referenceFeeLevel == baseFeeLevel ? test.pass()
593 : test.fail(
594 "reference: "s + std::to_string(metrics.referenceFeeLevel.value()) +
596 file,
597 line);
598
599 metrics.txCount == expectedCount
600 ? test.pass()
601 : test.fail("txCount: "s + std::to_string(metrics.txCount) + "/" + std::to_string(expectedCount), file, line);
602
603 metrics.txQMaxSize == expectedMaxCount ? test.pass()
604 : test.fail(
605 "txQMaxSize: "s + std::to_string(metrics.txQMaxSize.value_or(0)) +
606 "/" + std::to_string(expectedMaxCount.value_or(0)),
607 file,
608 line);
609
610 metrics.txInLedger == expectedInLedger
611 ? test.pass()
612 : test.fail(
613 "txInLedger: "s + std::to_string(metrics.txInLedger) + "/" + std::to_string(expectedInLedger),
614 file,
615 line);
616
617 metrics.txPerLedger == expectedPerLedger
618 ? test.pass()
619 : test.fail(
620 "txPerLedger: "s + std::to_string(metrics.txPerLedger) + "/" + std::to_string(expectedPerLedger),
621 file,
622 line);
623
624 metrics.minProcessingFeeLevel == expectedMin
625 ? test.pass()
626 : test.fail(
627 "minProcessingFeeLevel: "s + std::to_string(metrics.minProcessingFeeLevel.value()) + "/" +
628 std::to_string(expectedMin.value()),
629 file,
630 line);
631
632 metrics.medFeeLevel == expectedMed ? test.pass()
633 : test.fail(
634 "medFeeLevel: "s + std::to_string(metrics.medFeeLevel.value()) + "/" +
635 std::to_string(expectedMed.value()),
636 file,
637 line);
638
639 auto const expectedCurFeeLevel = expectedInLedger > expectedPerLedger
640 ? expectedMed * expectedInLedger * expectedInLedger / (expectedPerLedger * expectedPerLedger)
641 : metrics.referenceFeeLevel;
642
643 metrics.openLedgerFeeLevel == expectedCurFeeLevel
644 ? test.pass()
645 : test.fail(
646 "openLedgerFeeLevel: "s + std::to_string(metrics.openLedgerFeeLevel.value()) + "/" +
647 std::to_string(expectedCurFeeLevel.value()),
648 file,
649 line);
650}
651
652/* LoanBroker */
653/******************************************************************************/
654
655namespace loanBroker {
656
658set(AccountID const& account, uint256 const& vaultId, std::uint32_t flags = 0);
659
660// Use "del" because "delete" is a reserved word in C++.
662del(AccountID const& account, uint256 const& brokerID, std::uint32_t flags = 0);
663
665coverDeposit(AccountID const& account, uint256 const& brokerID, STAmount const& amount, std::uint32_t flags = 0);
666
668coverWithdraw(AccountID const& account, uint256 const& brokerID, STAmount const& amount, std::uint32_t flags = 0);
669
670// Must specify at least one of loanBrokerID or amount.
672coverClawback(AccountID const& account, std::uint32_t flags = 0);
673
674auto const loanBrokerID = JTxFieldWrapper<uint256Field>(sfLoanBrokerID);
675
677
678auto const debtMaximum = simpleField<SF_NUMBER>(sfDebtMaximum);
679
681
683
685
686} // namespace loanBroker
687
688/* Loan */
689/******************************************************************************/
690namespace loan {
691
693set(AccountID const& account, uint256 const& loanBrokerID, Number principalRequested, std::uint32_t flags = 0);
694
696
697// For `CounterPartySignature`, use `sig(sfCounterpartySignature, ...)`
698
699auto const loanOriginationFee = simpleField<SF_NUMBER>(sfLoanOriginationFee);
700
701auto const loanServiceFee = simpleField<SF_NUMBER>(sfLoanServiceFee);
702
703auto const latePaymentFee = simpleField<SF_NUMBER>(sfLatePaymentFee);
704
705auto const closePaymentFee = simpleField<SF_NUMBER>(sfClosePaymentFee);
706
708
710
712
714
716
717auto const paymentTotal = simpleField<SF_UINT32>(sfPaymentTotal);
718
719auto const paymentInterval = simpleField<SF_UINT32>(sfPaymentInterval);
720
721auto const gracePeriod = simpleField<SF_UINT32>(sfGracePeriod);
722
724manage(AccountID const& account, uint256 const& loanID, std::uint32_t flags);
725
727del(AccountID const& account, uint256 const& loanID, std::uint32_t flags = 0);
728
730pay(AccountID const& account, uint256 const& loanID, STAmount const& amount, std::uint32_t flags = 0);
731
732} // namespace loan
733
734} // namespace jtx
735} // namespace test
736} // namespace xrpl
T begin(T... args)
Represents a JSON value.
Definition json_value.h:130
Value & append(Value const &value)
Append value to array at the end.
bool isNull() const
isNull() tests to see if this field is null.
A currency issued by an account.
Definition Issue.h:13
std::uint32_t rep
Definition chrono.h:42
std::chrono::time_point< NetClock > time_point
Definition chrono.h:45
Number is a floating point type that can represent a wide range of values.
Definition Number.h:207
A public key.
Definition PublicKey.h:42
A view into a ledger.
Definition ReadView.h:31
Identifies fields.
Definition SField.h:126
Json::StaticString const jsonName
Definition SField.h:154
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Definition STAmount.cpp:721
std::vector< STPath >::const_iterator begin() const
Definition STPathSet.h:449
void push_back(STPath const &e)
Definition STPathSet.h:473
std::vector< STPath >::size_type size() const
Definition STPathSet.h:461
std::vector< STPath >::const_iterator end() const
Definition STPathSet.h:455
std::string getString() const
Definition Serializer.h:212
int addRaw(Blob const &vector)
virtual TxQ & getTxQ()=0
An immutable linear range of bytes.
Definition Slice.h:26
Metrics getMetrics(OpenView const &view) const
Returns fee metrics in reference fee level units.
Definition TxQ.cpp:1603
static constexpr FeeLevel64 baseLevel
Fee level for single-signed reference transaction.
Definition TxQ.h:44
Immutable cryptographic account descriptor.
Definition Account.h:19
AccountID id() const
Returns the Account ID.
Definition Account.h:87
A transaction testing environment.
Definition Env.h:119
Application & app()
Definition Env.h:251
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:319
Converts to IOU Issue or STAmount.
A balance matches.
Definition balance.h:19
Set Expiration on a JTx.
Match set account flags.
Definition flags.h:108
constexpr value_type value() const
Returns the underlying value.
Definition Units.h:317
constexpr value_type fee() const
Returns the number of drops.
Definition Units.h:273
T current(T... args)
T end(T... args)
T find(T... args)
T is_same_v
Json::Value create(A const &account, A const &dest, STAmount const &sendMax)
Create a check.
Json::Value coverDeposit(AccountID const &account, uint256 const &brokerID, STAmount const &amount, uint32_t flags)
Json::Value coverWithdraw(AccountID const &account, uint256 const &brokerID, STAmount const &amount, uint32_t flags)
Json::Value del(AccountID const &account, uint256 const &brokerID, uint32_t flags)
Json::Value coverClawback(AccountID const &account, std::uint32_t flags)
auto const loanOriginationFee
auto const loanServiceFee
Json::Value pay(AccountID const &account, uint256 const &loanID, STAmount const &amount, std::uint32_t flags)
auto const paymentInterval
auto const overpaymentFee
auto const lateInterestRate
auto const latePaymentFee
auto const overpaymentInterestRate
auto const closePaymentFee
Json::Value manage(AccountID const &account, uint256 const &loanID, std::uint32_t flags)
auto const closeInterestRate
Json::Value del(AccountID const &account, uint256 const &loanID, std::uint32_t flags)
STAmount channelBalance(ReadView const &view, uint256 const &chan)
uint256 channel(AccountID const &account, AccountID const &dst, std::uint32_t seqProxyValue)
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)
Json::Value fund(AccountID const &account, uint256 const &channel, STAmount const &amount, std::optional< NetClock::time_point > const &expiration)
bool channelExists(ReadView const &view, uint256 const &chan)
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)
static constexpr FeeLevel64 baseFeeLevel
auto make_vector(Input const &input)
bool expectLedgerEntryRoot(Env &env, Account const &acct, STAmount const &expectedValue)
Json::Value getAccountOffers(Env &env, AccountID const &acct, bool current)
PrettyAmount xrpMinusFee(Env const &env, std::int64_t xrpAmount)
auto const data
General field definitions, or fields used in multiple transaction namespaces.
bool expectOffers(Env &env, AccountID const &account, std::uint16_t size, std::vector< Amounts > const &toMatch)
bool expectHolding(Env &env, AccountID const &account, STAmount const &value, bool defaultLimits)
Json::Value ledgerEntryState(Env &env, Account const &acct_a, Account const &acct_b, std::string const &currency)
bool same(STPathSet const &st1, Args const &... args)
std::uint32_t ownerCount(Env const &env, Account const &account)
XRPAmount txfee(Env const &env, std::uint16_t n)
STPathElement allPathElements(AccountID const &a, Issue const &iss)
void stpathset_append(STPathSet &st, STPath const &p, Args const &... args)
void checkMetrics(Suite &test, jtx::Env &env, std::size_t expectedCount, std::optional< std::size_t > expectedMaxCount, std::size_t expectedInLedger, std::size_t expectedPerLedger, std::uint64_t expectedMinFeeLevel=baseFeeLevel.fee(), std::uint64_t expectedMedFeeLevel=minEscalationFeeLevel.fee(), std::source_location const location=std::source_location::current())
void stpath_append(STPath &st, T const &t, Args const &... args)
Json::Value accountBalance(Env &env, Account const &acct)
STPathElement IPE(Issue const &iss)
STPathElement cpe(Currency const &c)
Json::Value ledgerEntryRoot(Env &env, Account const &acct)
bool equal(STAmount const &sa1, STAmount const &sa2)
auto const amount
bool checkArraySize(Json::Value const &val, unsigned int size)
STPath stpath(Args const &... args)
void stpath_append_one(STPath &st, Account const &account)
void n_offers(Env &env, std::size_t n, Account const &account, STAmount const &in, STAmount const &out)
bool checkVL(Slice const &result, std::string const &expected)
Json::Value getAccountLines(Env &env, AccountID const &acctId)
static constexpr FeeLevel64 minEscalationFeeLevel
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
TypedField< STAmount > SF_AMOUNT
Definition SField.h:346
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:597
std::string strHex(FwdIt begin, FwdIt end)
Definition strHex.h:10
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition AccountID.cpp:92
TypedField< STBlob > SF_VL
Definition SField.h:350
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:28
@ current
This was a new validation and was added.
base_uint< 256 > uint256
Definition base_uint.h:526
TypedField< STBitString< 256 > > SF_UINT256
Definition SField.h:338
TypedField< STAccount > SF_ACCOUNT
Definition SField.h:345
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)
Definition Slice.h:213
TypedField< STInteger< std::uint32_t > > SF_UINT32
Definition SField.h:332
FeeLevel64 referenceFeeLevel
Reference transaction fee level.
Definition TxQ.h:158
A field with a type known at compile time.
Definition SField.h:301
JF operator()(std::array< std::uint8_t, N > const &c) const
JTxFieldWrapper(SF const &sfield)
JF operator()(SV const &value) const
Generic helper class for helper classes that set a field on a JTx.
Definition TestHelpers.h:31
JTxField(SF const &sfield, SV const &value)
Definition TestHelpers.h:41
virtual void operator()(Env &, JTx &jt) const
Definition TestHelpers.h:51
virtual OV value() const =0
virtual ~JTxField()=default
Execution context for applying a JSON transaction.
Definition JTx.h:25
Json::Value jv
Definition JTx.h:26
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...
accountIDField(SF const &sfield, SV const &value)
blobField(SF const &sfield, Slice const &cond)
blobField(SF const &sfield, std::array< std::uint8_t, N > const &c)
OV value() const override
stAmountField(SF const &sfield, SV const &value)
OV value() const override
Definition TestHelpers.h:96
timePointField(SF const &sfield, SV const &value)
Definition TestHelpers.h:91
OV value() const override
uint256Field(SF const &sfield, SV const &value)
unit::ValueUnit< UnitTag, ValueType > SV
T time_since_epoch(T... args)
T to_string(T... args)
T value_or(T... args)