rippled
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
383 {
384 object_[sfAccount] = value;
385 return *this;
386 }
387
394 {
395 object_[sfSequence] = value;
396 return *this;
397 }
398
405 {
406 object_[sfDestination] = value;
407 return *this;
408 }
409
416 {
417 object_[sfAmount] = value;
418 return *this;
419 }
420
427 {
428 object_[sfCondition] = value;
429 return *this;
430 }
431
438 {
439 object_[sfCancelAfter] = value;
440 return *this;
441 }
442
449 {
450 object_[sfFinishAfter] = value;
451 return *this;
452 }
453
460 {
461 object_[sfSourceTag] = value;
462 return *this;
463 }
464
471 {
472 object_[sfDestinationTag] = value;
473 return *this;
474 }
475
482 {
483 object_[sfOwnerNode] = value;
484 return *this;
485 }
486
493 {
494 object_[sfPreviousTxnID] = value;
495 return *this;
496 }
497
504 {
505 object_[sfPreviousTxnLgrSeq] = value;
506 return *this;
507 }
508
515 {
516 object_[sfDestinationNode] = value;
517 return *this;
518 }
519
526 {
527 object_[sfTransferRate] = value;
528 return *this;
529 }
530
537 {
538 object_[sfIssuerNode] = value;
539 return *this;
540 }
541
547 Escrow
548 build(uint256 const& index)
549 {
550 return Escrow{std::make_shared<SLE>(std::move(object_), index)};
551 }
552};
553
554} // namespace xrpl::ledger_entries
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:415
EscrowBuilder & setSourceTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSourceTag (soeOPTIONAL)
Definition Escrow.h:459
EscrowBuilder & setDestinationNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfDestinationNode (soeOPTIONAL)
Definition Escrow.h:514
EscrowBuilder & setCancelAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCancelAfter (soeOPTIONAL)
Definition Escrow.h:437
EscrowBuilder & setFinishAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfFinishAfter (soeOPTIONAL)
Definition Escrow.h:448
EscrowBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (soeREQUIRED)
Definition Escrow.h:503
EscrowBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeREQUIRED)
Definition Escrow.h:404
EscrowBuilder & setCondition(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfCondition (soeOPTIONAL)
Definition Escrow.h:426
EscrowBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (soeOPTIONAL)
Definition Escrow.h:393
EscrowBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition Escrow.h:382
EscrowBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (soeREQUIRED)
Definition Escrow.h:481
Escrow build(uint256 const &index)
Build and return the completed Escrow wrapper.
Definition Escrow.h:548
EscrowBuilder & setTransferRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfTransferRate (soeOPTIONAL)
Definition Escrow.h:525
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:536
EscrowBuilder(std::shared_ptr< SLE const > sle)
Construct a EscrowBuilder from an existing SLE object.
Definition Escrow.h:366
EscrowBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (soeREQUIRED)
Definition Escrow.h:492
EscrowBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (soeOPTIONAL)
Definition Escrow.h:470
Ledger Entry: Escrow.
Definition Escrow.h:28
bool hasDestinationTag() const
Check if sfDestinationTag is present.
Definition Escrow.h:220
Escrow(std::shared_ptr< SLE const > sle)
Construct a Escrow ledger entry wrapper from an existing SLE object.
Definition Escrow.h:36
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
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
Base class for type-safe ledger entry wrappers.
std::shared_ptr< SLE const > sle_
The underlying serialized ledger entry being wrapped.
Base class for all ledger entry builders.
T is_same_v
STL namespace.
LedgerEntryType
Identifiers for on-ledger objects.