xrpld
Loading...
Searching...
No Matches
Escrow.h
1// This file is auto-generated. Do not edit.
2#pragma once
3
4#include <xrpl/protocol/STLedgerEntry.h>
5#include <xrpl/protocol/STParsedJSON.h>
6#include <xrpl/protocol/jss.h>
7#include <xrpl/protocol_autogen/LedgerEntryBase.h>
8#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
9#include <xrpl/json/json_value.h>
10
11#include <stdexcept>
12#include <optional>
13
14namespace xrpl::ledger_entries {
15
16class EscrowBuilder;
17
27class Escrow : public LedgerEntryBase
28{
29public:
30 static constexpr LedgerEntryType entryType = ltESCROW;
31
37 : LedgerEntryBase(std::move(sle))
38 {
39 // Verify ledger entry type
40 if (sle_->getType() != entryType)
41 {
42 throw std::runtime_error("Invalid ledger entry type for Escrow");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
52 [[nodiscard]]
53 SF_ACCOUNT::type::value_type
54 getAccount() const
55 {
56 return this->sle_->at(sfAccount);
57 }
58
63 [[nodiscard]]
66 {
67 if (hasSequence())
68 return this->sle_->at(sfSequence);
69 return std::nullopt;
70 }
71
76 [[nodiscard]]
77 bool
79 {
80 return this->sle_->isFieldPresent(sfSequence);
81 }
82
87 [[nodiscard]]
88 SF_ACCOUNT::type::value_type
90 {
91 return this->sle_->at(sfDestination);
92 }
93
98 [[nodiscard]]
99 SF_AMOUNT::type::value_type
100 getAmount() const
101 {
102 return this->sle_->at(sfAmount);
103 }
104
109 [[nodiscard]]
112 {
113 if (hasCondition())
114 return this->sle_->at(sfCondition);
115 return std::nullopt;
116 }
117
122 [[nodiscard]]
123 bool
125 {
126 return this->sle_->isFieldPresent(sfCondition);
127 }
128
133 [[nodiscard]]
136 {
137 if (hasCancelAfter())
138 return this->sle_->at(sfCancelAfter);
139 return std::nullopt;
140 }
141
146 [[nodiscard]]
147 bool
149 {
150 return this->sle_->isFieldPresent(sfCancelAfter);
151 }
152
157 [[nodiscard]]
160 {
161 if (hasFinishAfter())
162 return this->sle_->at(sfFinishAfter);
163 return std::nullopt;
164 }
165
170 [[nodiscard]]
171 bool
173 {
174 return this->sle_->isFieldPresent(sfFinishAfter);
175 }
176
181 [[nodiscard]]
184 {
185 if (hasBytecode())
186 return this->sle_->at(sfBytecode);
187 return std::nullopt;
188 }
189
194 [[nodiscard]]
195 bool
197 {
198 return this->sle_->isFieldPresent(sfBytecode);
199 }
200
205 [[nodiscard]]
207 getData() const
208 {
209 if (hasData())
210 return this->sle_->at(sfData);
211 return std::nullopt;
212 }
213
218 [[nodiscard]]
219 bool
220 hasData() const
221 {
222 return this->sle_->isFieldPresent(sfData);
223 }
224
229 [[nodiscard]]
232 {
233 if (hasSourceTag())
234 return this->sle_->at(sfSourceTag);
235 return std::nullopt;
236 }
237
242 [[nodiscard]]
243 bool
245 {
246 return this->sle_->isFieldPresent(sfSourceTag);
247 }
248
253 [[nodiscard]]
256 {
257 if (hasDestinationTag())
258 return this->sle_->at(sfDestinationTag);
259 return std::nullopt;
260 }
261
266 [[nodiscard]]
267 bool
269 {
270 return this->sle_->isFieldPresent(sfDestinationTag);
271 }
272
277 [[nodiscard]]
278 SF_UINT64::type::value_type
280 {
281 return this->sle_->at(sfOwnerNode);
282 }
283
288 [[nodiscard]]
289 SF_UINT256::type::value_type
291 {
292 return this->sle_->at(sfPreviousTxnID);
293 }
294
299 [[nodiscard]]
300 SF_UINT32::type::value_type
302 {
303 return this->sle_->at(sfPreviousTxnLgrSeq);
304 }
305
310 [[nodiscard]]
313 {
314 if (hasDestinationNode())
315 return this->sle_->at(sfDestinationNode);
316 return std::nullopt;
317 }
318
323 [[nodiscard]]
324 bool
326 {
327 return this->sle_->isFieldPresent(sfDestinationNode);
328 }
329
334 [[nodiscard]]
337 {
338 if (hasTransferRate())
339 return this->sle_->at(sfTransferRate);
340 return std::nullopt;
341 }
342
347 [[nodiscard]]
348 bool
350 {
351 return this->sle_->isFieldPresent(sfTransferRate);
352 }
353
358 [[nodiscard]]
361 {
362 if (hasIssuerNode())
363 return this->sle_->at(sfIssuerNode);
364 return std::nullopt;
365 }
366
371 [[nodiscard]]
372 bool
374 {
375 return this->sle_->isFieldPresent(sfIssuerNode);
376 }
377};
378
386class EscrowBuilder : public LedgerEntryBuilderBase<EscrowBuilder>
387{
388public:
408
415 {
416 if (sle->at(sfLedgerEntryType) != ltESCROW)
417 {
418 throw std::runtime_error("Invalid ledger entry type for Escrow");
419 }
420 object_ = *sle;
421 }
422
426
433 {
434 object_[sfAccount] = value;
435 return *this;
436 }
437
444 {
445 object_[sfSequence] = value;
446 return *this;
447 }
448
455 {
456 object_[sfDestination] = value;
457 return *this;
458 }
459
466 {
467 object_[sfAmount] = value;
468 return *this;
469 }
470
477 {
478 object_[sfCondition] = value;
479 return *this;
480 }
481
488 {
489 object_[sfCancelAfter] = value;
490 return *this;
491 }
492
499 {
500 object_[sfFinishAfter] = value;
501 return *this;
502 }
503
510 {
511 object_[sfBytecode] = value;
512 return *this;
513 }
514
521 {
522 object_[sfData] = value;
523 return *this;
524 }
525
532 {
533 object_[sfSourceTag] = value;
534 return *this;
535 }
536
543 {
544 object_[sfDestinationTag] = value;
545 return *this;
546 }
547
554 {
555 object_[sfOwnerNode] = value;
556 return *this;
557 }
558
565 {
566 object_[sfPreviousTxnID] = value;
567 return *this;
568 }
569
576 {
577 object_[sfPreviousTxnLgrSeq] = value;
578 return *this;
579 }
580
587 {
588 object_[sfDestinationNode] = value;
589 return *this;
590 }
591
598 {
599 object_[sfTransferRate] = value;
600 return *this;
601 }
602
609 {
610 object_[sfIssuerNode] = value;
611 return *this;
612 }
613
619 Escrow
620 build(UInt256 const& index)
621 {
622 return Escrow{std::make_shared<SLE>(std::move(object_), index)};
623 }
624};
625
626} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
Builder for Escrow ledger entries.
Definition Escrow.h:387
EscrowBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (SoeRequired).
Definition Escrow.h:465
EscrowBuilder & setSourceTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSourceTag (SoeOptional).
Definition Escrow.h:531
EscrowBuilder & setDestinationNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfDestinationNode (SoeOptional).
Definition Escrow.h:586
EscrowBuilder & setCancelAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCancelAfter (SoeOptional).
Definition Escrow.h:487
EscrowBuilder & setFinishAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfFinishAfter (SoeOptional).
Definition Escrow.h:498
EscrowBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
Definition Escrow.h:575
EscrowBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (SoeRequired).
Definition Escrow.h:454
EscrowBuilder & setCondition(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfCondition (SoeOptional).
Definition Escrow.h:476
Escrow build(UInt256 const &index)
Build and return the completed Escrow wrapper.
Definition Escrow.h:620
EscrowBuilder & setBytecode(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfBytecode (SoeOptional).
Definition Escrow.h:509
EscrowBuilder(SLE::const_pointer sle)
Construct a EscrowBuilder from an existing SLE object.
Definition Escrow.h:414
EscrowBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (SoeOptional).
Definition Escrow.h:443
EscrowBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition Escrow.h:432
EscrowBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (SoeRequired).
Definition Escrow.h:553
EscrowBuilder & setTransferRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfTransferRate (SoeOptional).
Definition Escrow.h:597
EscrowBuilder(std::decay_t< typename SF_ACCOUNT::type::value_type > const &account, std::decay_t< typename SF_ACCOUNT::type::value_type > const &destination, std::decay_t< typename SF_AMOUNT::type::value_type > const &amount, std::decay_t< typename SF_UINT64::type::value_type > const &ownerNode, std::decay_t< typename SF_UINT256::type::value_type > const &previousTxnID, std::decay_t< typename SF_UINT32::type::value_type > const &previousTxnLgrSeq)
Construct a new EscrowBuilder with required fields.
Definition Escrow.h:398
EscrowBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (SoeOptional).
Definition Escrow.h:520
EscrowBuilder & setIssuerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfIssuerNode (SoeOptional).
Definition Escrow.h:608
EscrowBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeRequired).
Definition Escrow.h:564
EscrowBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (SoeOptional).
Definition Escrow.h:542
Ledger Entry: Escrow.
Definition Escrow.h:28
bool hasDestinationTag() const
Check if sfDestinationTag is present.
Definition Escrow.h:268
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (SoeRequired).
Definition Escrow.h:279
protocol_autogen::Optional< SF_UINT32::type::value_type > getDestinationTag() const
Get sfDestinationTag (SoeOptional).
Definition Escrow.h:255
bool hasCancelAfter() const
Check if sfCancelAfter is present.
Definition Escrow.h:148
protocol_autogen::Optional< SF_UINT32::type::value_type > getCancelAfter() const
Get sfCancelAfter (SoeOptional).
Definition Escrow.h:135
protocol_autogen::Optional< SF_UINT32::type::value_type > getSequence() const
Get sfSequence (SoeOptional).
Definition Escrow.h:65
bool hasData() const
Check if sfData is present.
Definition Escrow.h:220
protocol_autogen::Optional< SF_UINT64::type::value_type > getIssuerNode() const
Get sfIssuerNode (SoeOptional).
Definition Escrow.h:360
bool hasBytecode() const
Check if sfBytecode is present.
Definition Escrow.h:196
protocol_autogen::Optional< SF_VL::type::value_type > getCondition() const
Get sfCondition (SoeOptional).
Definition Escrow.h:111
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (SoeRequired).
Definition Escrow.h:301
bool hasCondition() const
Check if sfCondition is present.
Definition Escrow.h:124
bool hasSequence() const
Check if sfSequence is present.
Definition Escrow.h:78
Escrow(SLE::const_pointer sle)
Construct a Escrow ledger entry wrapper from an existing SLE object.
Definition Escrow.h:36
protocol_autogen::Optional< SF_UINT32::type::value_type > getFinishAfter() const
Get sfFinishAfter (SoeOptional).
Definition Escrow.h:159
SF_AMOUNT::type::value_type getAmount() const
Get sfAmount (SoeRequired).
Definition Escrow.h:100
bool hasTransferRate() const
Check if sfTransferRate is present.
Definition Escrow.h:349
protocol_autogen::Optional< SF_VL::type::value_type > getData() const
Get sfData (SoeOptional).
Definition Escrow.h:207
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (SoeRequired).
Definition Escrow.h:54
bool hasSourceTag() const
Check if sfSourceTag is present.
Definition Escrow.h:244
protocol_autogen::Optional< SF_UINT32::type::value_type > getSourceTag() const
Get sfSourceTag (SoeOptional).
Definition Escrow.h:231
static constexpr LedgerEntryType entryType
Definition Escrow.h:30
protocol_autogen::Optional< SF_UINT32::type::value_type > getTransferRate() const
Get sfTransferRate (SoeOptional).
Definition Escrow.h:336
bool hasFinishAfter() const
Check if sfFinishAfter is present.
Definition Escrow.h:172
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (SoeRequired).
Definition Escrow.h:290
bool hasDestinationNode() const
Check if sfDestinationNode is present.
Definition Escrow.h:325
SF_ACCOUNT::type::value_type getDestination() const
Get sfDestination (SoeRequired).
Definition Escrow.h:89
protocol_autogen::Optional< SF_UINT64::type::value_type > getDestinationNode() const
Get sfDestinationNode (SoeOptional).
Definition Escrow.h:312
bool hasIssuerNode() const
Check if sfIssuerNode is present.
Definition Escrow.h:373
protocol_autogen::Optional< SF_VL::type::value_type > getBytecode() const
Get sfBytecode (SoeOptional).
Definition Escrow.h:183
LedgerEntryBase(SLE::const_pointer sle)
Construct a ledger entry wrapper from an existing SLE object.
SLE::const_pointer sle_
The underlying serialized ledger entry being wrapped.
T make_shared(T... args)
STL namespace.
std::conditional_t< std::is_reference_v< ValueType >, std::optional< std::reference_wrapper< std::remove_reference_t< ValueType > > >, std::optional< ValueType > > Optional
Definition Utils.h:9
BaseUInt< 256 > UInt256
Definition base_uint.h:580
LedgerEntryType
Identifiers for on-ledger objects.