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 (hasSourceTag())
186 return this->sle_->at(sfSourceTag);
187 return std::nullopt;
188 }
189
194 [[nodiscard]]
195 bool
197 {
198 return this->sle_->isFieldPresent(sfSourceTag);
199 }
200
205 [[nodiscard]]
208 {
209 if (hasDestinationTag())
210 return this->sle_->at(sfDestinationTag);
211 return std::nullopt;
212 }
213
218 [[nodiscard]]
219 bool
221 {
222 return this->sle_->isFieldPresent(sfDestinationTag);
223 }
224
229 [[nodiscard]]
230 SF_UINT64::type::value_type
232 {
233 return this->sle_->at(sfOwnerNode);
234 }
235
240 [[nodiscard]]
241 SF_UINT256::type::value_type
243 {
244 return this->sle_->at(sfPreviousTxnID);
245 }
246
251 [[nodiscard]]
252 SF_UINT32::type::value_type
254 {
255 return this->sle_->at(sfPreviousTxnLgrSeq);
256 }
257
262 [[nodiscard]]
265 {
266 if (hasDestinationNode())
267 return this->sle_->at(sfDestinationNode);
268 return std::nullopt;
269 }
270
275 [[nodiscard]]
276 bool
278 {
279 return this->sle_->isFieldPresent(sfDestinationNode);
280 }
281
286 [[nodiscard]]
289 {
290 if (hasTransferRate())
291 return this->sle_->at(sfTransferRate);
292 return std::nullopt;
293 }
294
299 [[nodiscard]]
300 bool
302 {
303 return this->sle_->isFieldPresent(sfTransferRate);
304 }
305
310 [[nodiscard]]
313 {
314 if (hasIssuerNode())
315 return this->sle_->at(sfIssuerNode);
316 return std::nullopt;
317 }
318
323 [[nodiscard]]
324 bool
326 {
327 return this->sle_->isFieldPresent(sfIssuerNode);
328 }
329};
330
338class EscrowBuilder : public LedgerEntryBuilderBase<EscrowBuilder>
339{
340public:
360
367 {
368 if (sle->at(sfLedgerEntryType) != ltESCROW)
369 {
370 throw std::runtime_error("Invalid ledger entry type for Escrow");
371 }
372 object_ = *sle;
373 }
374
378
385 {
386 object_[sfAccount] = value;
387 return *this;
388 }
389
396 {
397 object_[sfSequence] = value;
398 return *this;
399 }
400
407 {
408 object_[sfDestination] = value;
409 return *this;
410 }
411
418 {
419 object_[sfAmount] = value;
420 return *this;
421 }
422
429 {
430 object_[sfCondition] = value;
431 return *this;
432 }
433
440 {
441 object_[sfCancelAfter] = value;
442 return *this;
443 }
444
451 {
452 object_[sfFinishAfter] = value;
453 return *this;
454 }
455
462 {
463 object_[sfSourceTag] = value;
464 return *this;
465 }
466
473 {
474 object_[sfDestinationTag] = value;
475 return *this;
476 }
477
484 {
485 object_[sfOwnerNode] = value;
486 return *this;
487 }
488
495 {
496 object_[sfPreviousTxnID] = value;
497 return *this;
498 }
499
506 {
507 object_[sfPreviousTxnLgrSeq] = value;
508 return *this;
509 }
510
517 {
518 object_[sfDestinationNode] = value;
519 return *this;
520 }
521
528 {
529 object_[sfTransferRate] = value;
530 return *this;
531 }
532
539 {
540 object_[sfIssuerNode] = value;
541 return *this;
542 }
543
549 Escrow
550 build(uint256 const& index)
551 {
552 return Escrow{std::make_shared<SLE>(std::move(object_), index)};
553 }
554};
555
556} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
Builder for Escrow ledger entries.
Definition Escrow.h:339
EscrowBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (SoeRequired).
Definition Escrow.h:417
EscrowBuilder & setSourceTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSourceTag (SoeOptional).
Definition Escrow.h:461
EscrowBuilder & setDestinationNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfDestinationNode (SoeOptional).
Definition Escrow.h:516
EscrowBuilder & setCancelAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCancelAfter (SoeOptional).
Definition Escrow.h:439
EscrowBuilder & setFinishAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfFinishAfter (SoeOptional).
Definition Escrow.h:450
EscrowBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
Definition Escrow.h:505
EscrowBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (SoeRequired).
Definition Escrow.h:406
EscrowBuilder & setCondition(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfCondition (SoeOptional).
Definition Escrow.h:428
EscrowBuilder(SLE::const_pointer sle)
Construct a EscrowBuilder from an existing SLE object.
Definition Escrow.h:366
EscrowBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (SoeOptional).
Definition Escrow.h:395
EscrowBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition Escrow.h:384
EscrowBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (SoeRequired).
Definition Escrow.h:483
Escrow build(uint256 const &index)
Build and return the completed Escrow wrapper.
Definition Escrow.h:550
EscrowBuilder & setTransferRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfTransferRate (SoeOptional).
Definition Escrow.h:527
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:350
EscrowBuilder & setIssuerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfIssuerNode (SoeOptional).
Definition Escrow.h:538
EscrowBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeRequired).
Definition Escrow.h:494
EscrowBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (SoeOptional).
Definition Escrow.h:472
Ledger Entry: Escrow.
Definition Escrow.h:28
bool hasDestinationTag() const
Check if sfDestinationTag is present.
Definition Escrow.h:220
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (SoeRequired).
Definition Escrow.h:231
protocol_autogen::Optional< SF_UINT32::type::value_type > getDestinationTag() const
Get sfDestinationTag (SoeOptional).
Definition Escrow.h:207
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
protocol_autogen::Optional< SF_UINT64::type::value_type > getIssuerNode() const
Get sfIssuerNode (SoeOptional).
Definition Escrow.h:312
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:253
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:301
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:196
protocol_autogen::Optional< SF_UINT32::type::value_type > getSourceTag() const
Get sfSourceTag (SoeOptional).
Definition Escrow.h:183
static constexpr LedgerEntryType entryType
Definition Escrow.h:30
protocol_autogen::Optional< SF_UINT32::type::value_type > getTransferRate() const
Get sfTransferRate (SoeOptional).
Definition Escrow.h:288
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:242
bool hasDestinationNode() const
Check if sfDestinationNode is present.
Definition Escrow.h:277
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:264
bool hasIssuerNode() const
Check if sfIssuerNode is present.
Definition Escrow.h:325
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
LedgerEntryType
Identifiers for on-ledger objects.
BaseUInt< 256 > uint256
Definition base_uint.h:580