rippled
Loading...
Searching...
No Matches
TestHelpers.h
1#ifndef XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED
2#define XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED
3
4#include <test/jtx/Env.h>
5
6#include <xrpld/app/misc/TxQ.h>
7
8#include <xrpl/basics/base_uint.h>
9#include <xrpl/beast/unit_test/suite.h>
10#include <xrpl/json/json_value.h>
11#include <xrpl/protocol/AccountID.h>
12#include <xrpl/protocol/Quality.h>
13#include <xrpl/protocol/STNumber.h>
14#include <xrpl/protocol/TxFlags.h>
15#include <xrpl/protocol/Units.h>
16#include <xrpl/protocol/jss.h>
17
18#include <vector>
19
20#if (defined(__clang_major__) && __clang_major__ < 15)
21#include <experimental/source_location>
23#else
24#include <source_location>
26#endif
27
28namespace xrpl {
29namespace test {
30namespace jtx {
31
37template <
38 class SField,
39 class StoredValue = typename SField::type::value_type,
40 class OutputValue = StoredValue>
42{
43 using SF = SField;
44 using SV = StoredValue;
45 using OV = OutputValue;
46
47protected:
48 SF const& sfield_;
50
51public:
52 explicit JTxField(SF const& sfield, SV const& value)
53 : sfield_(sfield), value_(value)
54 {
55 }
56
57 virtual ~JTxField() = default;
58
59 virtual OV
60 value() const = 0;
61
62 virtual void
63 operator()(Env&, JTx& jt) const
64 {
65 jt.jv[sfield_.jsonName] = value();
66 }
67};
68
69template <class SField, class StoredValue>
70struct JTxField<SField, StoredValue, StoredValue>
71{
72 using SF = SField;
73 using SV = StoredValue;
74 using OV = SV;
75
76protected:
77 SF const& sfield_;
79
80public:
81 explicit JTxField(SF const& sfield, SV const& value)
82 : sfield_(sfield), value_(value)
83 {
84 }
85
86 void
87 operator()(Env&, JTx& jt) const
88 {
90 }
91};
92
94 : public JTxField<SF_UINT32, NetClock::time_point, NetClock::rep>
95{
96 using SF = SF_UINT32;
100
101protected:
102 using base::value_;
103
104public:
105 explicit timePointField(SF const& sfield, SV const& value)
106 : JTxField(sfield, value)
107 {
108 }
109
110 OV
111 value() const override
112 {
113 return value_.time_since_epoch().count();
114 }
115};
116
117struct uint256Field : public JTxField<SF_UINT256, uint256, std::string>
118{
119 using SF = SF_UINT256;
120 using SV = uint256;
123
124protected:
125 using base::value_;
126
127public:
128 explicit uint256Field(SF const& sfield, SV const& value)
129 : JTxField(sfield, value)
130 {
131 }
132
133 OV
134 value() const override
135 {
136 return to_string(value_);
137 }
138};
139
140struct accountIDField : public JTxField<SF_ACCOUNT, AccountID, std::string>
141{
142 using SF = SF_ACCOUNT;
143 using SV = AccountID;
146
147protected:
148 using base::value_;
149
150public:
151 explicit accountIDField(SF const& sfield, SV const& value)
152 : JTxField(sfield, value)
153 {
154 }
155
156 OV
157 value() const override
158 {
159 return toBase58(value_);
160 }
161};
162
163struct stAmountField : public JTxField<SF_AMOUNT, STAmount, Json::Value>
164{
165 using SF = SF_AMOUNT;
166 using SV = STAmount;
169
170protected:
171 using base::value_;
172
173public:
174 explicit stAmountField(SF const& sfield, SV const& value)
175 : JTxField(sfield, value)
176 {
177 }
178
179 OV
180 value() const override
181 {
183 }
184};
185
186struct blobField : public JTxField<SF_VL, std::string>
187{
188 using SF = SF_VL;
191
192 using JTxField::JTxField;
193
194 explicit blobField(SF const& sfield, Slice const& cond)
195 : JTxField(sfield, strHex(cond))
196 {
197 }
198
199 template <size_t N>
200 explicit blobField(SF const& sfield, std::array<std::uint8_t, N> const& c)
201 : blobField(sfield, makeSlice(c))
202 {
203 }
204};
205
206template <class SField, class UnitTag, class ValueType>
208 : public JTxField<SField, unit::ValueUnit<UnitTag, ValueType>, ValueType>
209{
210 using SF = SField;
212 using OV = ValueType;
214
216
217protected:
218 using base::value_;
219
220public:
221 using JTxField<SF, SV, OV>::JTxField;
222
223 OV
224 value() const override
225 {
226 return value_.value();
227 }
228};
229
230template <class JTxField>
232{
233 using JF = JTxField;
234 using SF = typename JF::SF;
235 using SV = typename JF::SV;
236
237protected:
238 SF const& sfield_;
239
240public:
241 explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
242 {
243 }
244
245 JF
246 operator()(SV const& value) const
247 {
248 return JTxField(sfield_, value);
249 }
250};
251
252template <>
254{
255 using JF = blobField;
256 using SF = JF::SF;
257 using SV = JF::SV;
258
259protected:
260 SF const& sfield_;
261
262public:
263 explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
264 {
265 }
266
267 JF
268 operator()(SV const& cond) const
269 {
270 return JF(sfield_, makeSlice(cond));
271 }
272
273 JF
274 operator()(Slice const& cond) const
275 {
276 return JF(sfield_, cond);
277 }
278
279 template <size_t N>
280 JF
282 {
283 return operator()(makeSlice(c));
284 }
285};
286
287template <
288 class SField,
289 class UnitTag,
290 class ValueType = typename SField::type::value_type>
293
294template <class SField, class StoredValue = typename SField::type::value_type>
296
299auto const data = JTxFieldWrapper<blobField>(sfData);
300
302
303// TODO We only need this long "requires" clause as polyfill, for C++20
304// implementations which are missing <ranges> header. Replace with
305// `std::ranges::range<Input>`, and accordingly use std::ranges::begin/end
306// when we have moved to better compilers.
307template <typename Input>
308auto
309make_vector(Input const& input)
310 requires requires(Input& v) {
311 std::begin(v);
312 std::end(v);
313 }
314{
315 return std::vector(std::begin(input), std::end(input));
316}
317
318// Functions used in debugging
320getAccountOffers(Env& env, AccountID const& acct, bool current = false);
321
322inline Json::Value
323getAccountOffers(Env& env, Account const& acct, bool current = false)
324{
325 return getAccountOffers(env, acct.id(), current);
326}
327
329getAccountLines(Env& env, AccountID const& acctId);
330
331inline Json::Value
332getAccountLines(Env& env, Account const& acct)
333{
334 return getAccountLines(env, acct.id());
335}
336
337template <typename... IOU>
339getAccountLines(Env& env, AccountID const& acctId, IOU... ious)
340{
341 auto const jrr = getAccountLines(env, acctId);
342 Json::Value res;
343 for (auto const& line : jrr[jss::lines])
344 {
345 for (auto const& iou : {ious...})
346 {
347 if (line[jss::currency].asString() == to_string(iou.currency))
348 {
349 Json::Value v;
350 v[jss::currency] = line[jss::currency];
351 v[jss::balance] = line[jss::balance];
352 v[jss::limit] = line[jss::limit];
353 v[jss::account] = line[jss::account];
354 res[jss::lines].append(v);
355 }
356 }
357 }
358 if (!res.isNull())
359 return res;
360 return jrr;
361}
362
363[[nodiscard]] bool
364checkArraySize(Json::Value const& val, unsigned int size);
365
366// Helper function that returns the owner count on an account.
368ownerCount(test::jtx::Env const& env, test::jtx::Account const& account);
369
370[[nodiscard]]
371inline bool
372checkVL(Slice const& result, std::string const& expected)
373{
374 Serializer s;
375 s.addRaw(result);
376 return s.getString() == expected;
377}
378
379[[nodiscard]]
380inline bool
383 SField const& field,
384 std::string const& expected)
385{
386 return strHex(expected) == strHex(sle->getFieldVL(field));
387}
388
389/* Path finding */
390/******************************************************************************/
391void
392stpath_append_one(STPath& st, Account const& account);
393
394template <class T>
396stpath_append_one(STPath& st, T const& t)
397{
399}
400
401void
403
404template <class T, class... Args>
405void
406stpath_append(STPath& st, T const& t, Args const&... args)
407{
408 stpath_append_one(st, t);
409 if constexpr (sizeof...(args) > 0)
410 stpath_append(st, args...);
411}
412
413template <class... Args>
414void
415stpathset_append(STPathSet& st, STPath const& p, Args const&... args)
416{
417 st.push_back(p);
418 if constexpr (sizeof...(args) > 0)
419 stpathset_append(st, args...);
420}
421
422bool
423equal(STAmount const& sa1, STAmount const& sa2);
424
425// Issue path element
427IPE(Issue const& iss);
428
429template <class... Args>
430STPath
431stpath(Args const&... args)
432{
433 STPath st;
434 stpath_append(st, args...);
435 return st;
436}
437
438template <class... Args>
439bool
440same(STPathSet const& st1, Args const&... args)
441{
442 STPathSet st2;
443 stpathset_append(st2, args...);
444 if (st1.size() != st2.size())
445 return false;
446
447 for (auto const& p : st2)
448 {
449 if (std::find(st1.begin(), st1.end(), p) == st1.end())
450 return false;
451 }
452 return true;
453}
454
455/******************************************************************************/
456
458txfee(Env const& env, std::uint16_t n);
459
461xrpMinusFee(Env const& env, std::int64_t xrpAmount);
462
463bool
465 Env& env,
466 AccountID const& account,
467 STAmount const& value,
468 bool defaultLimits = false);
469
470template <typename... Amts>
471bool
473 Env& env,
474 AccountID const& account,
475 STAmount const& value,
476 Amts const&... amts)
477{
478 return expectHolding(env, account, value, false) &&
479 expectHolding(env, account, amts...);
480}
481
482bool
483expectHolding(Env& env, AccountID const& account, None const& value);
484
485bool
487 Env& env,
488 AccountID const& account,
489 std::uint16_t size,
490 std::vector<Amounts> const& toMatch = {});
491
493ledgerEntryRoot(Env& env, Account const& acct);
494
497 Env& env,
498 Account const& acct_a,
499 Account const& acct_b,
500 std::string const& currency);
501
503accountBalance(Env& env, Account const& acct);
504
505[[nodiscard]] bool
507 Env& env,
508 Account const& acct,
509 STAmount const& expectedValue);
510
511/* Payment Channel */
512/******************************************************************************/
513namespace paychan {
514
516create(
517 AccountID const& account,
518 AccountID const& to,
519 STAmount const& amount,
520 NetClock::duration const& settleDelay,
521 PublicKey const& pk,
524
525inline Json::Value
527 Account const& account,
528 Account const& to,
529 STAmount const& amount,
530 NetClock::duration const& settleDelay,
531 PublicKey const& pk,
534{
535 return create(
536 account.id(), to.id(), amount, settleDelay, pk, cancelAfter, dstTag);
537}
538
540fund(
541 AccountID const& account,
542 uint256 const& channel,
543 STAmount const& amount,
545
547claim(
548 AccountID const& account,
549 uint256 const& channel,
552 std::optional<Slice> const& signature = std::nullopt,
554
556channel(
557 AccountID const& account,
558 AccountID const& dst,
559 std::uint32_t seqProxyValue);
560
561inline uint256
562channel(Account const& account, Account const& dst, std::uint32_t seqProxyValue)
563{
564 return channel(account.id(), dst.id(), seqProxyValue);
565}
566
568channelBalance(ReadView const& view, uint256 const& chan);
569
570bool
571channelExists(ReadView const& view, uint256 const& chan);
572
573} // namespace paychan
574
575/* Crossing Limits */
576/******************************************************************************/
577
578void
580 Env& env,
581 std::size_t n,
582 Account const& account,
583 STAmount const& in,
584 STAmount const& out);
585
586/* Pay Strand */
587/***************************************************************/
588
589// Currency path element
591cpe(Currency const& c);
592
593// All path element
595allpe(AccountID const& a, Issue const& iss);
596/***************************************************************/
597
598/* Check */
599/***************************************************************/
600namespace check {
601
603// clang-format off
604template <typename A>
607create(A const& account, A const& dest, STAmount const& sendMax)
608{
609 Json::Value jv;
610 jv[sfAccount.jsonName] = to_string(account);
611 jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none);
612 jv[sfDestination.jsonName] = to_string(dest);
613 jv[sfTransactionType.jsonName] = jss::CheckCreate;
614 return jv;
615}
616// clang-format on
617
618inline Json::Value
620 jtx::Account const& account,
621 jtx::Account const& dest,
622 STAmount const& sendMax)
623{
624 return create(account.id(), dest.id(), sendMax);
625}
626
627} // namespace check
628
631
632template <class Suite>
633void
635 Suite& test,
636 jtx::Env& env,
637 std::size_t expectedCount,
638 std::optional<std::size_t> expectedMaxCount,
639 std::size_t expectedInLedger,
640 std::size_t expectedPerLedger,
641 std::uint64_t expectedMinFeeLevel = baseFeeLevel.fee(),
642 std::uint64_t expectedMedFeeLevel = minEscalationFeeLevel.fee(),
643 source_location const location = source_location::current())
644{
645 int line = location.line();
646 char const* file = location.file_name();
647 FeeLevel64 const expectedMin{expectedMinFeeLevel};
648 FeeLevel64 const expectedMed{expectedMedFeeLevel};
649 auto const metrics = env.app().getTxQ().getMetrics(*env.current());
650 using namespace std::string_literals;
651
653 ? test.pass()
654 : test.fail(
655 "reference: "s +
656 std::to_string(metrics.referenceFeeLevel.value()) + "/" +
658 file,
659 line);
660
661 metrics.txCount == expectedCount
662 ? test.pass()
663 : test.fail(
664 "txCount: "s + std::to_string(metrics.txCount) + "/" +
665 std::to_string(expectedCount),
666 file,
667 line);
668
669 metrics.txQMaxSize == expectedMaxCount
670 ? test.pass()
671 : test.fail(
672 "txQMaxSize: "s + std::to_string(metrics.txQMaxSize.value_or(0)) +
673 "/" + std::to_string(expectedMaxCount.value_or(0)),
674 file,
675 line);
676
677 metrics.txInLedger == expectedInLedger
678 ? test.pass()
679 : test.fail(
680 "txInLedger: "s + std::to_string(metrics.txInLedger) + "/" +
681 std::to_string(expectedInLedger),
682 file,
683 line);
684
685 metrics.txPerLedger == expectedPerLedger
686 ? test.pass()
687 : test.fail(
688 "txPerLedger: "s + std::to_string(metrics.txPerLedger) + "/" +
689 std::to_string(expectedPerLedger),
690 file,
691 line);
692
693 metrics.minProcessingFeeLevel == expectedMin
694 ? test.pass()
695 : test.fail(
696 "minProcessingFeeLevel: "s +
697 std::to_string(metrics.minProcessingFeeLevel.value()) + "/" +
698 std::to_string(expectedMin.value()),
699 file,
700 line);
701
702 metrics.medFeeLevel == expectedMed
703 ? test.pass()
704 : test.fail(
705 "medFeeLevel: "s + std::to_string(metrics.medFeeLevel.value()) +
706 "/" + std::to_string(expectedMed.value()),
707 file,
708 line);
709
710 auto const expectedCurFeeLevel = expectedInLedger > expectedPerLedger
711 ? expectedMed * expectedInLedger * expectedInLedger /
712 (expectedPerLedger * expectedPerLedger)
713 : metrics.referenceFeeLevel;
714
715 metrics.openLedgerFeeLevel == expectedCurFeeLevel
716 ? test.pass()
717 : test.fail(
718 "openLedgerFeeLevel: "s +
719 std::to_string(metrics.openLedgerFeeLevel.value()) + "/" +
720 std::to_string(expectedCurFeeLevel.value()),
721 file,
722 line);
723}
724
725/* LoanBroker */
726/******************************************************************************/
727
728namespace loanBroker {
729
731set(AccountID const& account, uint256 const& vaultId, std::uint32_t flags = 0);
732
733// Use "del" because "delete" is a reserved word in C++.
735del(AccountID const& account, uint256 const& brokerID, std::uint32_t flags = 0);
736
739 AccountID const& account,
740 uint256 const& brokerID,
741 STAmount const& amount,
742 std::uint32_t flags = 0);
743
746 AccountID const& account,
747 uint256 const& brokerID,
748 STAmount const& amount,
749 std::uint32_t flags = 0);
750
751// Must specify at least one of loanBrokerID or amount.
753coverClawback(AccountID const& account, std::uint32_t flags = 0);
754
755auto const loanBrokerID = JTxFieldWrapper<uint256Field>(sfLoanBrokerID);
756
759
760auto const debtMaximum = simpleField<SF_NUMBER>(sfDebtMaximum);
761
764
767
769
770} // namespace loanBroker
771
772/* Loan */
773/******************************************************************************/
774namespace loan {
775
777set(AccountID const& account,
778 uint256 const& loanBrokerID,
779 Number principalRequested,
780 std::uint32_t flags = 0);
781
783
784// For `CounterPartySignature`, use `sig(sfCounterpartySignature, ...)`
785
786auto const loanOriginationFee = simpleField<SF_NUMBER>(sfLoanOriginationFee);
787
788auto const loanServiceFee = simpleField<SF_NUMBER>(sfLoanServiceFee);
789
790auto const latePaymentFee = simpleField<SF_NUMBER>(sfLatePaymentFee);
791
792auto const closePaymentFee = simpleField<SF_NUMBER>(sfClosePaymentFee);
793
794auto const overpaymentFee =
796
797auto const interestRate =
799
802
805
807 valueUnitWrapper<SF_UINT32, unit::TenthBipsTag>(sfOverpaymentInterestRate);
808
809auto const paymentTotal = simpleField<SF_UINT32>(sfPaymentTotal);
810
811auto const paymentInterval = simpleField<SF_UINT32>(sfPaymentInterval);
812
813auto const gracePeriod = simpleField<SF_UINT32>(sfGracePeriod);
814
816manage(AccountID const& account, uint256 const& loanID, std::uint32_t flags);
817
819del(AccountID const& account, uint256 const& loanID, std::uint32_t flags = 0);
820
822pay(AccountID const& account,
823 uint256 const& loanID,
824 STAmount const& amount,
825 std::uint32_t flags = 0);
826
827} // namespace loan
828
829} // namespace jtx
830} // namespace test
831} // namespace xrpl
832
833#endif // XRPL_TEST_JTX_TESTHELPERS_H_INCLUDED
T begin(T... args)
Represents a JSON value.
Definition json_value.h:131
Value & append(Value const &value)
Append value to array at the end.
bool isNull() const
isNull() tests to see if this field is null.
virtual TxQ & getTxQ()=0
A currency issued by an account.
Definition Issue.h:14
std::uint32_t rep
Definition chrono.h:47
std::chrono::time_point< NetClock > time_point
Definition chrono.h:50
A public key.
Definition PublicKey.h:43
A view into a ledger.
Definition ReadView.h:32
Identifies fields.
Definition SField.h:127
Json::StaticString const jsonName
Definition SField.h:153
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Definition STAmount.cpp:751
std::vector< STPath >::const_iterator begin() const
Definition STPathSet.h:471
void push_back(STPath const &e)
Definition STPathSet.h:495
std::vector< STPath >::size_type size() const
Definition STPathSet.h:483
std::vector< STPath >::const_iterator end() const
Definition STPathSet.h:477
std::string getString() const
Definition Serializer.h:219
int addRaw(Blob const &vector)
An immutable linear range of bytes.
Definition Slice.h:27
Metrics getMetrics(OpenView const &view) const
Returns fee metrics in reference fee level units.
Definition TxQ.cpp:1756
static constexpr FeeLevel64 baseLevel
Fee level for single-signed reference transaction.
Definition TxQ.h:45
Immutable cryptographic account descriptor.
Definition Account.h:20
AccountID id() const
Returns the Account ID.
Definition Account.h:92
A transaction testing environment.
Definition Env.h:102
Application & app()
Definition Env.h:244
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:314
Converts to IOU Issue or STAmount.
A balance matches.
Definition balance.h:20
Set Expiration on a JTx.
Match set account flags.
Definition flags.h:109
constexpr value_type value() const
Returns the underlying value.
Definition Units.h:325
constexpr value_type fee() const
Returns the number of drops.
Definition Units.h:278
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 allpe(AccountID const &a, Issue const &iss)
void stpathset_append(STPathSet &st, STPath const &p, Args const &... args)
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)
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(), source_location const location=source_location::current())
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:6
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:611
std::string strHex(FwdIt begin, FwdIt end)
Definition strHex.h:11
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition AccountID.cpp:95
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:29
@ current
This was a new validation and was added.
base_uint< 256 > uint256
Definition base_uint.h:539
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:225
TypedField< STInteger< std::uint32_t > > SF_UINT32
Definition SField.h:332
FeeLevel64 referenceFeeLevel
Reference transaction fee level.
Definition TxQ.h:159
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:42
JTxField(SF const &sfield, SV const &value)
Definition TestHelpers.h:52
virtual void operator()(Env &, JTx &jt) const
Definition TestHelpers.h:63
virtual OV value() const =0
virtual ~JTxField()=default
Execution context for applying a JSON transaction.
Definition JTx.h:26
Json::Value jv
Definition JTx.h:27
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)
timePointField(SF const &sfield, SV const &value)
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)