rippled
Loading...
Searching...
No Matches
jtx/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 <
30 class SField,
31 class StoredValue = typename SField::type::value_type,
32 class OutputValue = StoredValue>
34{
35 using SF = SField;
36 using SV = StoredValue;
37 using OV = OutputValue;
38
39protected:
40 SF const& sfield_;
42
43public:
44 explicit JTxField(SF const& sfield, SV const& value) : sfield_(sfield), value_(value)
45 {
46 }
47
48 virtual ~JTxField() = default;
49
50 virtual OV
51 value() const = 0;
52
53 virtual void
54 operator()(Env&, JTx& jt) const
55 {
56 jt.jv[sfield_.jsonName] = value();
57 }
58};
59
60template <class SField, class StoredValue>
61struct JTxField<SField, StoredValue, StoredValue>
62{
63 using SF = SField;
64 using SV = StoredValue;
65 using OV = SV;
66
67protected:
68 SF const& sfield_;
70
71public:
72 explicit JTxField(SF const& sfield, SV const& value) : sfield_(sfield), value_(value)
73 {
74 }
75
76 void
77 operator()(Env&, JTx& jt) const
78 {
80 }
81};
82
83struct timePointField : public JTxField<SF_UINT32, NetClock::time_point, NetClock::rep>
84{
85 using SF = SF_UINT32;
89
90protected:
91 using base::value_;
92
93public:
94 explicit timePointField(SF const& sfield, SV const& value) : JTxField(sfield, value)
95 {
96 }
97
98 OV
99 value() const override
100 {
101 return value_.time_since_epoch().count();
102 }
103};
104
105struct uint256Field : public JTxField<SF_UINT256, uint256, std::string>
106{
107 using SF = SF_UINT256;
108 using SV = uint256;
111
112protected:
113 using base::value_;
114
115public:
116 explicit uint256Field(SF const& sfield, SV const& value) : JTxField(sfield, value)
117 {
118 }
119
120 OV
121 value() const override
122 {
123 return to_string(value_);
124 }
125};
126
127struct accountIDField : public JTxField<SF_ACCOUNT, AccountID, std::string>
128{
129 using SF = SF_ACCOUNT;
130 using SV = AccountID;
133
134protected:
135 using base::value_;
136
137public:
138 explicit accountIDField(SF const& sfield, SV const& value) : JTxField(sfield, value)
139 {
140 }
141
142 OV
143 value() const override
144 {
145 return toBase58(value_);
146 }
147};
148
149struct stAmountField : public JTxField<SF_AMOUNT, STAmount, Json::Value>
150{
151 using SF = SF_AMOUNT;
152 using SV = STAmount;
155
156protected:
157 using base::value_;
158
159public:
160 explicit stAmountField(SF const& sfield, SV const& value) : JTxField(sfield, value)
161 {
162 }
163
164 OV
165 value() const override
166 {
168 }
169};
170
171struct blobField : public JTxField<SF_VL, std::string>
172{
173 using SF = SF_VL;
176
177 using JTxField::JTxField;
178
179 explicit blobField(SF const& sfield, Slice const& cond) : JTxField(sfield, strHex(cond))
180 {
181 }
182
183 template <size_t N>
184 explicit blobField(SF const& sfield, std::array<std::uint8_t, N> const& c)
185 : blobField(sfield, makeSlice(c))
186 {
187 }
188};
189
190template <class SField, class UnitTag, class ValueType>
191struct valueUnitField : public JTxField<SField, unit::ValueUnit<UnitTag, ValueType>, ValueType>
192{
193 using SF = SField;
195 using OV = ValueType;
197
199
200protected:
201 using base::value_;
202
203public:
204 using JTxField<SF, SV, OV>::JTxField;
205
206 OV
207 value() const override
208 {
209 return value_.value();
210 }
211};
212
213template <class JTxField>
215{
216 using JF = JTxField;
217 using SF = typename JF::SF;
218 using SV = typename JF::SV;
219
220protected:
221 SF const& sfield_;
222
223public:
224 explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
225 {
226 }
227
228 JF
229 operator()(SV const& value) const
230 {
231 return JTxField(sfield_, value);
232 }
233};
234
235template <>
237{
238 using JF = blobField;
239 using SF = JF::SF;
240 using SV = JF::SV;
241
242protected:
243 SF const& sfield_;
244
245public:
246 explicit JTxFieldWrapper(SF const& sfield) : sfield_(sfield)
247 {
248 }
249
250 JF
251 operator()(SV const& cond) const
252 {
253 return JF(sfield_, makeSlice(cond));
254 }
255
256 JF
257 operator()(Slice const& cond) const
258 {
259 return JF(sfield_, cond);
260 }
261
262 template <size_t N>
263 JF
265 {
266 return operator()(makeSlice(c));
267 }
268};
269
270template <class SField, class UnitTag, class ValueType = typename SField::type::value_type>
272
273template <class SField, class StoredValue = typename SField::type::value_type>
275
278auto const data = JTxFieldWrapper<blobField>(sfData);
279
281
282// TODO We only need this long "requires" clause as polyfill, for C++20
283// implementations which are missing <ranges> header. Replace with
284// `std::ranges::range<Input>`, and accordingly use std::ranges::begin/end
285// when we have moved to better compilers.
286template <typename Input>
287auto
288make_vector(Input const& input)
289 requires requires(Input& v) {
290 std::begin(v);
291 std::end(v);
292 }
293{
294 return std::vector(std::begin(input), std::end(input));
295}
296
297// Functions used in debugging
299getAccountOffers(Env& env, AccountID const& acct, bool current = false);
300
301inline Json::Value
302getAccountOffers(Env& env, Account const& acct, bool current = false)
303{
304 return getAccountOffers(env, acct.id(), current);
305}
306
308getAccountLines(Env& env, AccountID const& acctId);
309
310inline Json::Value
311getAccountLines(Env& env, Account const& acct)
312{
313 return getAccountLines(env, acct.id());
314}
315
316template <typename... IOU>
318getAccountLines(Env& env, AccountID const& acctId, IOU... ious)
319{
320 auto jrr = getAccountLines(env, acctId);
321 Json::Value res;
322 for (auto const& line : jrr[jss::lines])
323 {
324 for (auto const& iou : {ious...})
325 {
326 if (line[jss::currency].asString() == to_string(iou.currency))
327 {
328 Json::Value v;
329 v[jss::currency] = line[jss::currency];
330 v[jss::balance] = line[jss::balance];
331 v[jss::limit] = line[jss::limit];
332 v[jss::account] = line[jss::account];
333 res[jss::lines].append(v);
334 }
335 }
336 }
337 if (!res.isNull())
338 return res;
339 return jrr;
340}
341
342[[nodiscard]] bool
343checkArraySize(Json::Value const& val, unsigned int size);
344
345// Helper function that returns the owner count on an account.
347ownerCount(test::jtx::Env const& env, test::jtx::Account const& account);
348
349[[nodiscard]]
350inline bool
351checkVL(Slice const& result, std::string const& expected)
352{
353 Serializer s;
354 s.addRaw(result);
355 return s.getString() == expected;
356}
357
358[[nodiscard]]
359inline bool
360checkVL(std::shared_ptr<SLE const> const& sle, SField const& field, std::string const& expected)
361{
362 return strHex(expected) == strHex(sle->getFieldVL(field));
363}
364
365/* Path finding */
366/******************************************************************************/
367void
368stpath_append_one(STPath& st, Account const& account);
369
370template <class T>
372stpath_append_one(STPath& st, T const& t)
373{
375}
376
377void
379
380template <class T, class... Args>
381void
382stpath_append(STPath& st, T const& t, Args const&... args)
383{
384 stpath_append_one(st, t);
385 if constexpr (sizeof...(args) > 0)
386 stpath_append(st, args...);
387}
388
389template <class... Args>
390void
391stpathset_append(STPathSet& st, STPath const& p, Args const&... args)
392{
393 st.push_back(p);
394 if constexpr (sizeof...(args) > 0)
395 stpathset_append(st, args...);
396}
397
398bool
399equal(STAmount const& sa1, STAmount const& sa2);
400
401// Issue path element
403IPE(Issue const& iss);
404
405template <class... Args>
406STPath
407stpath(Args const&... args)
408{
409 STPath st;
410 stpath_append(st, args...);
411 return st;
412}
413
414template <class... Args>
415bool
416same(STPathSet const& st1, Args const&... args)
417{
418 STPathSet st2;
419 stpathset_append(st2, args...);
420 if (st1.size() != st2.size())
421 return false;
422
423 for (auto const& p : st2)
424 {
425 if (std::find(st1.begin(), st1.end(), p) == st1.end())
426 return false;
427 }
428 return true;
429}
430
431/******************************************************************************/
432
434txfee(Env const& env, std::uint16_t n);
435
437xrpMinusFee(Env const& env, std::int64_t xrpAmount);
438
439bool
441 Env& env,
442 AccountID const& account,
443 STAmount const& value,
444 bool defaultLimits = false);
445
446template <typename... Amts>
447bool
448expectHolding(Env& env, AccountID const& account, STAmount const& value, Amts const&... amts)
449{
450 return expectHolding(env, account, value, false) && expectHolding(env, account, amts...);
451}
452
453bool
454expectHolding(Env& env, AccountID const& account, None const& value);
455
456bool
458 Env& env,
459 AccountID const& account,
460 std::uint16_t size,
461 std::vector<Amounts> const& toMatch = {});
462
464ledgerEntryRoot(Env& env, Account const& acct);
465
468 Env& env,
469 Account const& acct_a,
470 Account const& acct_b,
471 std::string const& currency);
472
474accountBalance(Env& env, Account const& acct);
475
476[[nodiscard]] bool
477expectLedgerEntryRoot(Env& env, Account const& acct, STAmount const& expectedValue);
478
479/* Payment Channel */
480/******************************************************************************/
481namespace paychan {
482
484create(
485 AccountID const& account,
486 AccountID const& to,
487 STAmount const& amount,
488 NetClock::duration const& settleDelay,
489 PublicKey const& pk,
492
493inline Json::Value
495 Account const& account,
496 Account const& to,
497 STAmount const& amount,
498 NetClock::duration const& settleDelay,
499 PublicKey const& pk,
502{
503 return create(account.id(), to.id(), amount, settleDelay, pk, cancelAfter, dstTag);
504}
505
507fund(
508 AccountID const& account,
509 uint256 const& channel,
510 STAmount const& amount,
512
514claim(
515 AccountID const& account,
516 uint256 const& channel,
519 std::optional<Slice> const& signature = std::nullopt,
521
523channel(AccountID const& account, AccountID const& dst, std::uint32_t seqProxyValue);
524
525inline uint256
526channel(Account const& account, Account const& dst, std::uint32_t seqProxyValue)
527{
528 return channel(account.id(), dst.id(), seqProxyValue);
529}
530
532channelBalance(ReadView const& view, uint256 const& chan);
533
534bool
535channelExists(ReadView const& view, uint256 const& chan);
536
537} // namespace paychan
538
539/* Crossing Limits */
540/******************************************************************************/
541
542void
543n_offers(Env& env, std::size_t n, Account const& account, STAmount const& in, STAmount const& out);
544
545/* Pay Strand */
546/***************************************************************/
547
548// Currency path element
550cpe(Currency const& c);
551
552// All path element
554allPathElements(AccountID const& a, Issue const& iss);
555/***************************************************************/
556
557/* Check */
558/***************************************************************/
559namespace check {
560
562template <typename A>
565create(A const& account, A const& dest, STAmount const& sendMax)
566{
567 Json::Value jv;
568 jv[sfAccount.jsonName] = to_string(account);
569 jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none);
570 jv[sfDestination.jsonName] = to_string(dest);
571 jv[sfTransactionType.jsonName] = jss::CheckCreate;
572 return jv;
573}
574
575inline Json::Value
576create(jtx::Account const& account, jtx::Account const& dest, STAmount const& sendMax)
577{
578 return create(account.id(), dest.id(), sendMax);
579}
580
581} // namespace check
582
585
586template <class Suite>
587void
589 Suite& test,
590 jtx::Env& env,
591 std::size_t expectedCount,
592 std::optional<std::size_t> expectedMaxCount,
593 std::size_t expectedInLedger,
594 std::size_t expectedPerLedger,
595 std::uint64_t expectedMinFeeLevel = baseFeeLevel.fee(),
596 std::uint64_t expectedMedFeeLevel = minEscalationFeeLevel.fee(),
598{
599 int const line = location.line();
600 char const* file = location.file_name();
601 FeeLevel64 const expectedMin{expectedMinFeeLevel};
602 FeeLevel64 const expectedMed{expectedMedFeeLevel};
603 auto const metrics = env.app().getTxQ().getMetrics(*env.current());
604 using namespace std::string_literals;
605
607 ? test.pass()
608 : test.fail(
609 "reference: "s + std::to_string(metrics.referenceFeeLevel.value()) + "/" +
611 file,
612 line);
613
614 metrics.txCount == expectedCount
615 ? test.pass()
616 : test.fail(
617 "txCount: "s + std::to_string(metrics.txCount) + "/" + std::to_string(expectedCount),
618 file,
619 line);
620
621 metrics.txQMaxSize == expectedMaxCount
622 ? test.pass()
623 : test.fail(
624 "txQMaxSize: "s + std::to_string(metrics.txQMaxSize.value_or(0)) + "/" +
625 std::to_string(expectedMaxCount.value_or(0)),
626 file,
627 line);
628
629 metrics.txInLedger == expectedInLedger
630 ? test.pass()
631 : test.fail(
632 "txInLedger: "s + std::to_string(metrics.txInLedger) + "/" +
633 std::to_string(expectedInLedger),
634 file,
635 line);
636
637 metrics.txPerLedger == expectedPerLedger
638 ? test.pass()
639 : test.fail(
640 "txPerLedger: "s + std::to_string(metrics.txPerLedger) + "/" +
641 std::to_string(expectedPerLedger),
642 file,
643 line);
644
645 metrics.minProcessingFeeLevel == expectedMin
646 ? test.pass()
647 : test.fail(
648 "minProcessingFeeLevel: "s + std::to_string(metrics.minProcessingFeeLevel.value()) +
649 "/" + std::to_string(expectedMin.value()),
650 file,
651 line);
652
653 metrics.medFeeLevel == expectedMed
654 ? test.pass()
655 : test.fail(
656 "medFeeLevel: "s + std::to_string(metrics.medFeeLevel.value()) + "/" +
657 std::to_string(expectedMed.value()),
658 file,
659 line);
660
661 auto const expectedCurFeeLevel = expectedInLedger > expectedPerLedger
662 ? expectedMed * expectedInLedger * expectedInLedger /
663 (expectedPerLedger * expectedPerLedger)
664 : metrics.referenceFeeLevel;
665
666 metrics.openLedgerFeeLevel == expectedCurFeeLevel
667 ? test.pass()
668 : test.fail(
669 "openLedgerFeeLevel: "s + std::to_string(metrics.openLedgerFeeLevel.value()) + "/" +
670 std::to_string(expectedCurFeeLevel.value()),
671 file,
672 line);
673}
674
675/* LoanBroker */
676/******************************************************************************/
677
678namespace loanBroker {
679
681set(AccountID const& account, uint256 const& vaultId, std::uint32_t flags = 0);
682
683// Use "del" because "delete" is a reserved word in C++.
685del(AccountID const& account, uint256 const& brokerID, std::uint32_t flags = 0);
686
689 AccountID const& account,
690 uint256 const& brokerID,
691 STAmount const& amount,
692 std::uint32_t flags = 0);
693
696 AccountID const& account,
697 uint256 const& brokerID,
698 STAmount const& amount,
699 std::uint32_t flags = 0);
700
701// Must specify at least one of loanBrokerID or amount.
703coverClawback(AccountID const& account, std::uint32_t flags = 0);
704
705auto const loanBrokerID = JTxFieldWrapper<uint256Field>(sfLoanBrokerID);
706
708
709auto const debtMaximum = simpleField<SF_NUMBER>(sfDebtMaximum);
710
712
715
717
718} // namespace loanBroker
719
720/* Loan */
721/******************************************************************************/
722namespace loan {
723
725set(AccountID const& account,
726 uint256 const& loanBrokerID,
727 Number principalRequested,
728 std::uint32_t flags = 0);
729
731
732// For `CounterPartySignature`, use `sig(sfCounterpartySignature, ...)`
733
734auto const loanOriginationFee = simpleField<SF_NUMBER>(sfLoanOriginationFee);
735
736auto const loanServiceFee = simpleField<SF_NUMBER>(sfLoanServiceFee);
737
738auto const latePaymentFee = simpleField<SF_NUMBER>(sfLatePaymentFee);
739
740auto const closePaymentFee = simpleField<SF_NUMBER>(sfClosePaymentFee);
741
743
745
747
749
751 valueUnitWrapper<SF_UINT32, unit::TenthBipsTag>(sfOverpaymentInterestRate);
752
753auto const paymentTotal = simpleField<SF_UINT32>(sfPaymentTotal);
754
755auto const paymentInterval = simpleField<SF_UINT32>(sfPaymentInterval);
756
757auto const gracePeriod = simpleField<SF_UINT32>(sfGracePeriod);
758
760manage(AccountID const& account, uint256 const& loanID, std::uint32_t flags);
761
763del(AccountID const& account, uint256 const& loanID, std::uint32_t flags = 0);
764
766pay(AccountID const& account,
767 uint256 const& loanID,
768 STAmount const& amount,
769 std::uint32_t flags = 0);
770
771} // namespace loan
772
773} // namespace jtx
774} // namespace test
775} // 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:43
std::chrono::time_point< NetClock > time_point
Definition chrono.h:46
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:744
std::vector< STPath >::const_iterator begin() const
Definition STPathSet.h:462
void push_back(STPath const &e)
Definition STPathSet.h:486
std::vector< STPath >::size_type size() const
Definition STPathSet.h:474
std::vector< STPath >::const_iterator end() const
Definition STPathSet.h:468
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:1692
static constexpr FeeLevel64 baseLevel
Fee level for single-signed reference transaction.
Definition TxQ.h:43
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:122
Application & app()
Definition Env.h:259
std::shared_ptr< OpenView const > current() const
Returns the current ledger.
Definition Env.h:329
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:321
constexpr value_type fee() const
Returns the number of drops.
Definition Units.h:276
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)
Json::Value pay(AccountID const &account, uint256 const &loanID, STAmount const &amount, std::uint32_t flags)
auto const overpaymentInterestRate
Json::Value manage(AccountID const &account, uint256 const &loanID, std::uint32_t flags)
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)
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:602
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:531
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:215
TypedField< STInteger< std::uint32_t > > SF_UINT32
Definition SField.h:332
FeeLevel64 referenceFeeLevel
Reference transaction fee level.
Definition TxQ.h:157
A field with a type known at compile time.
Definition SField.h:301
JF operator()(std::array< std::uint8_t, N > const &c) const
JF operator()(SV const &value) const
Generic helper class for helper classes that set a field on a JTx.
JTxField(SF const &sfield, SV const &value)
virtual void operator()(Env &, JTx &jt) const
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)
stAmountField(SF const &sfield, SV const &value)
timePointField(SF const &sfield, SV const &value)
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)