xrpld
Loading...
Searching...
No Matches
DirectoryNode.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
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltDIR_NODE;
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 DirectoryNode");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
52 [[nodiscard]]
54 getOwner() const
55 {
56 if (hasOwner())
57 return this->sle_->at(sfOwner);
58 return std::nullopt;
59 }
60
65 [[nodiscard]]
66 bool
67 hasOwner() const
68 {
69 return this->sle_->isFieldPresent(sfOwner);
70 }
71
76 [[nodiscard]]
79 {
81 return this->sle_->at(sfTakerPaysCurrency);
82 return std::nullopt;
83 }
84
89 [[nodiscard]]
90 bool
92 {
93 return this->sle_->isFieldPresent(sfTakerPaysCurrency);
94 }
95
100 [[nodiscard]]
103 {
104 if (hasTakerPaysIssuer())
105 return this->sle_->at(sfTakerPaysIssuer);
106 return std::nullopt;
107 }
108
113 [[nodiscard]]
114 bool
116 {
117 return this->sle_->isFieldPresent(sfTakerPaysIssuer);
118 }
119
124 [[nodiscard]]
127 {
128 if (hasTakerPaysMPT())
129 return this->sle_->at(sfTakerPaysMPT);
130 return std::nullopt;
131 }
132
137 [[nodiscard]]
138 bool
140 {
141 return this->sle_->isFieldPresent(sfTakerPaysMPT);
142 }
143
148 [[nodiscard]]
151 {
153 return this->sle_->at(sfTakerGetsCurrency);
154 return std::nullopt;
155 }
156
161 [[nodiscard]]
162 bool
164 {
165 return this->sle_->isFieldPresent(sfTakerGetsCurrency);
166 }
167
172 [[nodiscard]]
175 {
176 if (hasTakerGetsIssuer())
177 return this->sle_->at(sfTakerGetsIssuer);
178 return std::nullopt;
179 }
180
185 [[nodiscard]]
186 bool
188 {
189 return this->sle_->isFieldPresent(sfTakerGetsIssuer);
190 }
191
196 [[nodiscard]]
199 {
200 if (hasTakerGetsMPT())
201 return this->sle_->at(sfTakerGetsMPT);
202 return std::nullopt;
203 }
204
209 [[nodiscard]]
210 bool
212 {
213 return this->sle_->isFieldPresent(sfTakerGetsMPT);
214 }
215
220 [[nodiscard]]
223 {
224 if (hasExchangeRate())
225 return this->sle_->at(sfExchangeRate);
226 return std::nullopt;
227 }
228
233 [[nodiscard]]
234 bool
236 {
237 return this->sle_->isFieldPresent(sfExchangeRate);
238 }
239
244 [[nodiscard]]
245 SF_VECTOR256::type::value_type
247 {
248 return this->sle_->at(sfIndexes);
249 }
250
255 [[nodiscard]]
256 SF_UINT256::type::value_type
258 {
259 return this->sle_->at(sfRootIndex);
260 }
261
266 [[nodiscard]]
269 {
270 if (hasIndexNext())
271 return this->sle_->at(sfIndexNext);
272 return std::nullopt;
273 }
274
279 [[nodiscard]]
280 bool
282 {
283 return this->sle_->isFieldPresent(sfIndexNext);
284 }
285
290 [[nodiscard]]
293 {
294 if (hasIndexPrevious())
295 return this->sle_->at(sfIndexPrevious);
296 return std::nullopt;
297 }
298
303 [[nodiscard]]
304 bool
306 {
307 return this->sle_->isFieldPresent(sfIndexPrevious);
308 }
309
314 [[nodiscard]]
317 {
318 if (hasNFTokenID())
319 return this->sle_->at(sfNFTokenID);
320 return std::nullopt;
321 }
322
327 [[nodiscard]]
328 bool
330 {
331 return this->sle_->isFieldPresent(sfNFTokenID);
332 }
333
338 [[nodiscard]]
341 {
342 if (hasPreviousTxnID())
343 return this->sle_->at(sfPreviousTxnID);
344 return std::nullopt;
345 }
346
351 [[nodiscard]]
352 bool
354 {
355 return this->sle_->isFieldPresent(sfPreviousTxnID);
356 }
357
362 [[nodiscard]]
365 {
367 return this->sle_->at(sfPreviousTxnLgrSeq);
368 return std::nullopt;
369 }
370
375 [[nodiscard]]
376 bool
378 {
379 return this->sle_->isFieldPresent(sfPreviousTxnLgrSeq);
380 }
381
386 [[nodiscard]]
389 {
390 if (hasDomainID())
391 return this->sle_->at(sfDomainID);
392 return std::nullopt;
393 }
394
399 [[nodiscard]]
400 bool
402 {
403 return this->sle_->isFieldPresent(sfDomainID);
404 }
405};
406
414class DirectoryNodeBuilder : public LedgerEntryBuilderBase<DirectoryNodeBuilder>
415{
416public:
428
435 {
436 if (sle->at(sfLedgerEntryType) != ltDIR_NODE)
437 {
438 throw std::runtime_error("Invalid ledger entry type for DirectoryNode");
439 }
440 object_ = *sle;
441 }
442
444
451 {
452 object_[sfOwner] = value;
453 return *this;
454 }
455
462 {
463 object_[sfTakerPaysCurrency] = value;
464 return *this;
465 }
466
473 {
474 object_[sfTakerPaysIssuer] = value;
475 return *this;
476 }
477
484 {
485 object_[sfTakerPaysMPT] = value;
486 return *this;
487 }
488
495 {
496 object_[sfTakerGetsCurrency] = value;
497 return *this;
498 }
499
506 {
507 object_[sfTakerGetsIssuer] = value;
508 return *this;
509 }
510
517 {
518 object_[sfTakerGetsMPT] = value;
519 return *this;
520 }
521
528 {
529 object_[sfExchangeRate] = value;
530 return *this;
531 }
532
539 {
540 object_[sfIndexes] = value;
541 return *this;
542 }
543
550 {
551 object_[sfRootIndex] = value;
552 return *this;
553 }
554
561 {
562 object_[sfIndexNext] = value;
563 return *this;
564 }
565
572 {
573 object_[sfIndexPrevious] = value;
574 return *this;
575 }
576
583 {
584 object_[sfNFTokenID] = value;
585 return *this;
586 }
587
594 {
595 object_[sfPreviousTxnID] = value;
596 return *this;
597 }
598
605 {
606 object_[sfPreviousTxnLgrSeq] = value;
607 return *this;
608 }
609
616 {
617 object_[sfDomainID] = value;
618 return *this;
619 }
620
627 build(uint256 const& index)
628 {
629 return DirectoryNode{std::make_shared<SLE>(std::move(object_), index)};
630 }
631};
632
633} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
Builder for DirectoryNode ledger entries.
DirectoryNodeBuilder & setIndexes(std::decay_t< typename SF_VECTOR256::type::value_type > const &value)
Set sfIndexes (SoeRequired).
DirectoryNodeBuilder & setTakerPaysMPT(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Set sfTakerPaysMPT (SoeOptional).
DirectoryNodeBuilder & setTakerGetsIssuer(std::decay_t< typename SF_UINT160::type::value_type > const &value)
Set sfTakerGetsIssuer (SoeOptional).
DirectoryNodeBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfDomainID (SoeOptional).
DirectoryNodeBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeOptional).
DirectoryNodeBuilder & setTakerGetsCurrency(std::decay_t< typename SF_UINT160::type::value_type > const &value)
Set sfTakerGetsCurrency (SoeOptional).
DirectoryNodeBuilder & setIndexNext(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfIndexNext (SoeOptional).
DirectoryNodeBuilder(SLE::const_pointer sle)
Construct a DirectoryNodeBuilder from an existing SLE object.
DirectoryNodeBuilder & setTakerPaysIssuer(std::decay_t< typename SF_UINT160::type::value_type > const &value)
Set sfTakerPaysIssuer (SoeOptional).
DirectoryNodeBuilder & setRootIndex(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfRootIndex (SoeRequired).
DirectoryNodeBuilder & setIndexPrevious(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfIndexPrevious (SoeOptional).
DirectoryNodeBuilder & setNFTokenID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfNFTokenID (SoeOptional).
DirectoryNodeBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeOptional).
DirectoryNodeBuilder(std::decay_t< typename SF_VECTOR256::type::value_type > const &indexes, std::decay_t< typename SF_UINT256::type::value_type > const &rootIndex)
Construct a new DirectoryNodeBuilder with required fields.
DirectoryNodeBuilder & setTakerGetsMPT(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Set sfTakerGetsMPT (SoeOptional).
DirectoryNodeBuilder & setExchangeRate(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfExchangeRate (SoeOptional).
DirectoryNodeBuilder & setTakerPaysCurrency(std::decay_t< typename SF_UINT160::type::value_type > const &value)
Set sfTakerPaysCurrency (SoeOptional).
DirectoryNodeBuilder & setOwner(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
DirectoryNode build(uint256 const &index)
Build and return the completed DirectoryNode wrapper.
Ledger Entry: DirectoryNode.
SF_UINT256::type::value_type getRootIndex() const
Get sfRootIndex (SoeRequired).
protocol_autogen::Optional< SF_UINT64::type::value_type > getIndexNext() const
Get sfIndexNext (SoeOptional).
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getOwner() const
Get sfOwner (SoeOptional).
protocol_autogen::Optional< SF_UINT192::type::value_type > getTakerGetsMPT() const
Get sfTakerGetsMPT (SoeOptional).
bool hasIndexPrevious() const
Check if sfIndexPrevious is present.
protocol_autogen::Optional< SF_UINT64::type::value_type > getIndexPrevious() const
Get sfIndexPrevious (SoeOptional).
bool hasPreviousTxnID() const
Check if sfPreviousTxnID is present.
protocol_autogen::Optional< SF_UINT160::type::value_type > getTakerPaysCurrency() const
Get sfTakerPaysCurrency (SoeOptional).
protocol_autogen::Optional< SF_UINT256::type::value_type > getNFTokenID() const
Get sfNFTokenID (SoeOptional).
bool hasTakerPaysCurrency() const
Check if sfTakerPaysCurrency is present.
bool hasTakerGetsIssuer() const
Check if sfTakerGetsIssuer is present.
DirectoryNode(SLE::const_pointer sle)
Construct a DirectoryNode ledger entry wrapper from an existing SLE object.
bool hasIndexNext() const
Check if sfIndexNext is present.
bool hasTakerGetsMPT() const
Check if sfTakerGetsMPT is present.
bool hasDomainID() const
Check if sfDomainID is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (SoeOptional).
bool hasTakerPaysMPT() const
Check if sfTakerPaysMPT is present.
protocol_autogen::Optional< SF_UINT160::type::value_type > getTakerGetsIssuer() const
Get sfTakerGetsIssuer (SoeOptional).
bool hasPreviousTxnLgrSeq() const
Check if sfPreviousTxnLgrSeq is present.
protocol_autogen::Optional< SF_UINT192::type::value_type > getTakerPaysMPT() const
Get sfTakerPaysMPT (SoeOptional).
bool hasTakerGetsCurrency() const
Check if sfTakerGetsCurrency is present.
SF_VECTOR256::type::value_type getIndexes() const
Get sfIndexes (SoeRequired).
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (SoeOptional).
bool hasExchangeRate() const
Check if sfExchangeRate is present.
bool hasNFTokenID() const
Check if sfNFTokenID is present.
protocol_autogen::Optional< SF_UINT64::type::value_type > getExchangeRate() const
Get sfExchangeRate (SoeOptional).
bool hasOwner() const
Check if sfOwner is present.
protocol_autogen::Optional< SF_UINT160::type::value_type > getTakerGetsCurrency() const
Get sfTakerGetsCurrency (SoeOptional).
bool hasTakerPaysIssuer() const
Check if sfTakerPaysIssuer is present.
protocol_autogen::Optional< SF_UINT160::type::value_type > getTakerPaysIssuer() const
Get sfTakerPaysIssuer (SoeOptional).
static constexpr LedgerEntryType entryType
protocol_autogen::Optional< SF_UINT256::type::value_type > getPreviousTxnID() const
Get sfPreviousTxnID (SoeOptional).
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:562