rippled
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
16class DirectoryNodeBuilder;
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 {
129 return this->sle_->at(sfTakerGetsCurrency);
130 return std::nullopt;
131 }
132
137 [[nodiscard]]
138 bool
140 {
141 return this->sle_->isFieldPresent(sfTakerGetsCurrency);
142 }
143
148 [[nodiscard]]
151 {
152 if (hasTakerGetsIssuer())
153 return this->sle_->at(sfTakerGetsIssuer);
154 return std::nullopt;
155 }
156
161 [[nodiscard]]
162 bool
164 {
165 return this->sle_->isFieldPresent(sfTakerGetsIssuer);
166 }
167
172 [[nodiscard]]
175 {
176 if (hasExchangeRate())
177 return this->sle_->at(sfExchangeRate);
178 return std::nullopt;
179 }
180
185 [[nodiscard]]
186 bool
188 {
189 return this->sle_->isFieldPresent(sfExchangeRate);
190 }
191
196 [[nodiscard]]
197 SF_VECTOR256::type::value_type
199 {
200 return this->sle_->at(sfIndexes);
201 }
202
207 [[nodiscard]]
208 SF_UINT256::type::value_type
210 {
211 return this->sle_->at(sfRootIndex);
212 }
213
218 [[nodiscard]]
221 {
222 if (hasIndexNext())
223 return this->sle_->at(sfIndexNext);
224 return std::nullopt;
225 }
226
231 [[nodiscard]]
232 bool
234 {
235 return this->sle_->isFieldPresent(sfIndexNext);
236 }
237
242 [[nodiscard]]
245 {
246 if (hasIndexPrevious())
247 return this->sle_->at(sfIndexPrevious);
248 return std::nullopt;
249 }
250
255 [[nodiscard]]
256 bool
258 {
259 return this->sle_->isFieldPresent(sfIndexPrevious);
260 }
261
266 [[nodiscard]]
269 {
270 if (hasNFTokenID())
271 return this->sle_->at(sfNFTokenID);
272 return std::nullopt;
273 }
274
279 [[nodiscard]]
280 bool
282 {
283 return this->sle_->isFieldPresent(sfNFTokenID);
284 }
285
290 [[nodiscard]]
293 {
294 if (hasPreviousTxnID())
295 return this->sle_->at(sfPreviousTxnID);
296 return std::nullopt;
297 }
298
303 [[nodiscard]]
304 bool
306 {
307 return this->sle_->isFieldPresent(sfPreviousTxnID);
308 }
309
314 [[nodiscard]]
317 {
319 return this->sle_->at(sfPreviousTxnLgrSeq);
320 return std::nullopt;
321 }
322
327 [[nodiscard]]
328 bool
330 {
331 return this->sle_->isFieldPresent(sfPreviousTxnLgrSeq);
332 }
333
338 [[nodiscard]]
341 {
342 if (hasDomainID())
343 return this->sle_->at(sfDomainID);
344 return std::nullopt;
345 }
346
351 [[nodiscard]]
352 bool
354 {
355 return this->sle_->isFieldPresent(sfDomainID);
356 }
357};
358
366class DirectoryNodeBuilder : public LedgerEntryBuilderBase<DirectoryNodeBuilder>
367{
368public:
380
387 {
388 if (sle->at(sfLedgerEntryType) != ltDIR_NODE)
389 {
390 throw std::runtime_error("Invalid ledger entry type for DirectoryNode");
391 }
392 object_ = *sle;
393 }
394
403 {
404 object_[sfOwner] = value;
405 return *this;
406 }
407
414 {
415 object_[sfTakerPaysCurrency] = value;
416 return *this;
417 }
418
425 {
426 object_[sfTakerPaysIssuer] = value;
427 return *this;
428 }
429
436 {
437 object_[sfTakerGetsCurrency] = value;
438 return *this;
439 }
440
447 {
448 object_[sfTakerGetsIssuer] = value;
449 return *this;
450 }
451
458 {
459 object_[sfExchangeRate] = value;
460 return *this;
461 }
462
469 {
470 object_[sfIndexes] = value;
471 return *this;
472 }
473
480 {
481 object_[sfRootIndex] = value;
482 return *this;
483 }
484
491 {
492 object_[sfIndexNext] = value;
493 return *this;
494 }
495
502 {
503 object_[sfIndexPrevious] = value;
504 return *this;
505 }
506
513 {
514 object_[sfNFTokenID] = value;
515 return *this;
516 }
517
524 {
525 object_[sfPreviousTxnID] = value;
526 return *this;
527 }
528
535 {
536 object_[sfPreviousTxnLgrSeq] = value;
537 return *this;
538 }
539
546 {
547 object_[sfDomainID] = value;
548 return *this;
549 }
550
557 build(uint256 const& index)
558 {
559 return DirectoryNode{std::make_shared<SLE>(std::move(object_), index)};
560 }
561};
562
563} // namespace xrpl::ledger_entries
Builder for DirectoryNode ledger entries.
DirectoryNodeBuilder & setIndexes(std::decay_t< typename SF_VECTOR256::type::value_type > const &value)
Set sfIndexes (soeREQUIRED)
DirectoryNodeBuilder(std::shared_ptr< SLE const > sle)
Construct a DirectoryNodeBuilder from an existing SLE object.
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 & 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 & 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)
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(std::shared_ptr< SLE const > sle)
Construct a DirectoryNode ledger entry wrapper from an existing SLE object.
bool hasIndexNext() const
Check if sfIndexNext is present.
bool hasDomainID() const
Check if sfDomainID is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT160::type::value_type > getTakerGetsIssuer() const
Get sfTakerGetsIssuer (soeOPTIONAL)
bool hasPreviousTxnLgrSeq() const
Check if sfPreviousTxnLgrSeq is present.
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)
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.