xrpld
Loading...
Searching...
No Matches
AccountRoot.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
15
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltACCOUNT_ROOT;
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 AccountRoot");
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]]
64 SF_UINT32::type::value_type
66 {
67 return this->sle_->at(sfSequence);
68 }
69
74 [[nodiscard]]
75 SF_AMOUNT::type::value_type
76 getBalance() const
77 {
78 return this->sle_->at(sfBalance);
79 }
80
85 [[nodiscard]]
86 SF_UINT32::type::value_type
88 {
89 return this->sle_->at(sfOwnerCount);
90 }
91
96 [[nodiscard]]
97 SF_UINT256::type::value_type
99 {
100 return this->sle_->at(sfPreviousTxnID);
101 }
102
107 [[nodiscard]]
108 SF_UINT32::type::value_type
110 {
111 return this->sle_->at(sfPreviousTxnLgrSeq);
112 }
113
118 [[nodiscard]]
121 {
122 if (hasAccountTxnID())
123 return this->sle_->at(sfAccountTxnID);
124 return std::nullopt;
125 }
126
131 [[nodiscard]]
132 bool
134 {
135 return this->sle_->isFieldPresent(sfAccountTxnID);
136 }
137
142 [[nodiscard]]
145 {
146 if (hasRegularKey())
147 return this->sle_->at(sfRegularKey);
148 return std::nullopt;
149 }
150
155 [[nodiscard]]
156 bool
158 {
159 return this->sle_->isFieldPresent(sfRegularKey);
160 }
161
166 [[nodiscard]]
169 {
170 if (hasEmailHash())
171 return this->sle_->at(sfEmailHash);
172 return std::nullopt;
173 }
174
179 [[nodiscard]]
180 bool
182 {
183 return this->sle_->isFieldPresent(sfEmailHash);
184 }
185
190 [[nodiscard]]
193 {
194 if (hasWalletLocator())
195 return this->sle_->at(sfWalletLocator);
196 return std::nullopt;
197 }
198
203 [[nodiscard]]
204 bool
206 {
207 return this->sle_->isFieldPresent(sfWalletLocator);
208 }
209
214 [[nodiscard]]
217 {
218 if (hasWalletSize())
219 return this->sle_->at(sfWalletSize);
220 return std::nullopt;
221 }
222
227 [[nodiscard]]
228 bool
230 {
231 return this->sle_->isFieldPresent(sfWalletSize);
232 }
233
238 [[nodiscard]]
241 {
242 if (hasMessageKey())
243 return this->sle_->at(sfMessageKey);
244 return std::nullopt;
245 }
246
251 [[nodiscard]]
252 bool
254 {
255 return this->sle_->isFieldPresent(sfMessageKey);
256 }
257
262 [[nodiscard]]
265 {
266 if (hasTransferRate())
267 return this->sle_->at(sfTransferRate);
268 return std::nullopt;
269 }
270
275 [[nodiscard]]
276 bool
278 {
279 return this->sle_->isFieldPresent(sfTransferRate);
280 }
281
286 [[nodiscard]]
288 getDomain() const
289 {
290 if (hasDomain())
291 return this->sle_->at(sfDomain);
292 return std::nullopt;
293 }
294
299 [[nodiscard]]
300 bool
301 hasDomain() const
302 {
303 return this->sle_->isFieldPresent(sfDomain);
304 }
305
310 [[nodiscard]]
313 {
314 if (hasTickSize())
315 return this->sle_->at(sfTickSize);
316 return std::nullopt;
317 }
318
323 [[nodiscard]]
324 bool
326 {
327 return this->sle_->isFieldPresent(sfTickSize);
328 }
329
334 [[nodiscard]]
337 {
338 if (hasTicketCount())
339 return this->sle_->at(sfTicketCount);
340 return std::nullopt;
341 }
342
347 [[nodiscard]]
348 bool
350 {
351 return this->sle_->isFieldPresent(sfTicketCount);
352 }
353
358 [[nodiscard]]
361 {
362 if (hasNFTokenMinter())
363 return this->sle_->at(sfNFTokenMinter);
364 return std::nullopt;
365 }
366
371 [[nodiscard]]
372 bool
374 {
375 return this->sle_->isFieldPresent(sfNFTokenMinter);
376 }
377
382 [[nodiscard]]
385 {
386 if (hasMintedNFTokens())
387 return this->sle_->at(sfMintedNFTokens);
388 return std::nullopt;
389 }
390
395 [[nodiscard]]
396 bool
398 {
399 return this->sle_->isFieldPresent(sfMintedNFTokens);
400 }
401
406 [[nodiscard]]
409 {
410 if (hasBurnedNFTokens())
411 return this->sle_->at(sfBurnedNFTokens);
412 return std::nullopt;
413 }
414
419 [[nodiscard]]
420 bool
422 {
423 return this->sle_->isFieldPresent(sfBurnedNFTokens);
424 }
425
430 [[nodiscard]]
433 {
435 return this->sle_->at(sfFirstNFTokenSequence);
436 return std::nullopt;
437 }
438
443 [[nodiscard]]
444 bool
446 {
447 return this->sle_->isFieldPresent(sfFirstNFTokenSequence);
448 }
449
454 [[nodiscard]]
457 {
459 return this->sle_->at(sfSponsoredOwnerCount);
460 return std::nullopt;
461 }
462
467 [[nodiscard]]
468 bool
470 {
471 return this->sle_->isFieldPresent(sfSponsoredOwnerCount);
472 }
473
478 [[nodiscard]]
481 {
483 return this->sle_->at(sfSponsoringOwnerCount);
484 return std::nullopt;
485 }
486
491 [[nodiscard]]
492 bool
494 {
495 return this->sle_->isFieldPresent(sfSponsoringOwnerCount);
496 }
497
502 [[nodiscard]]
505 {
507 return this->sle_->at(sfSponsoringAccountCount);
508 return std::nullopt;
509 }
510
515 [[nodiscard]]
516 bool
518 {
519 return this->sle_->isFieldPresent(sfSponsoringAccountCount);
520 }
521
526 [[nodiscard]]
528 getAMMID() const
529 {
530 if (hasAMMID())
531 return this->sle_->at(sfAMMID);
532 return std::nullopt;
533 }
534
539 [[nodiscard]]
540 bool
541 hasAMMID() const
542 {
543 return this->sle_->isFieldPresent(sfAMMID);
544 }
545
550 [[nodiscard]]
553 {
554 if (hasVaultID())
555 return this->sle_->at(sfVaultID);
556 return std::nullopt;
557 }
558
563 [[nodiscard]]
564 bool
566 {
567 return this->sle_->isFieldPresent(sfVaultID);
568 }
569
574 [[nodiscard]]
577 {
578 if (hasLoanBrokerID())
579 return this->sle_->at(sfLoanBrokerID);
580 return std::nullopt;
581 }
582
587 [[nodiscard]]
588 bool
590 {
591 return this->sle_->isFieldPresent(sfLoanBrokerID);
592 }
593};
594
602class AccountRootBuilder : public LedgerEntryBuilderBase<AccountRootBuilder>
603{
604public:
624
631 {
632 if (sle->at(sfLedgerEntryType) != ltACCOUNT_ROOT)
633 {
634 throw std::runtime_error("Invalid ledger entry type for AccountRoot");
635 }
636 object_ = *sle;
637 }
638
642
649 {
650 object_[sfAccount] = value;
651 return *this;
652 }
653
660 {
661 object_[sfSequence] = value;
662 return *this;
663 }
664
671 {
672 object_[sfBalance] = value;
673 return *this;
674 }
675
682 {
683 object_[sfOwnerCount] = value;
684 return *this;
685 }
686
693 {
694 object_[sfPreviousTxnID] = value;
695 return *this;
696 }
697
704 {
705 object_[sfPreviousTxnLgrSeq] = value;
706 return *this;
707 }
708
715 {
716 object_[sfAccountTxnID] = value;
717 return *this;
718 }
719
726 {
727 object_[sfRegularKey] = value;
728 return *this;
729 }
730
737 {
738 object_[sfEmailHash] = value;
739 return *this;
740 }
741
748 {
749 object_[sfWalletLocator] = value;
750 return *this;
751 }
752
759 {
760 object_[sfWalletSize] = value;
761 return *this;
762 }
763
770 {
771 object_[sfMessageKey] = value;
772 return *this;
773 }
774
781 {
782 object_[sfTransferRate] = value;
783 return *this;
784 }
785
792 {
793 object_[sfDomain] = value;
794 return *this;
795 }
796
803 {
804 object_[sfTickSize] = value;
805 return *this;
806 }
807
814 {
815 object_[sfTicketCount] = value;
816 return *this;
817 }
818
825 {
826 object_[sfNFTokenMinter] = value;
827 return *this;
828 }
829
836 {
837 object_[sfMintedNFTokens] = value;
838 return *this;
839 }
840
847 {
848 object_[sfBurnedNFTokens] = value;
849 return *this;
850 }
851
858 {
859 object_[sfFirstNFTokenSequence] = value;
860 return *this;
861 }
862
869 {
870 object_[sfSponsoredOwnerCount] = value;
871 return *this;
872 }
873
880 {
881 object_[sfSponsoringOwnerCount] = value;
882 return *this;
883 }
884
891 {
892 object_[sfSponsoringAccountCount] = value;
893 return *this;
894 }
895
902 {
903 object_[sfAMMID] = value;
904 return *this;
905 }
906
913 {
914 object_[sfVaultID] = value;
915 return *this;
916 }
917
924 {
925 object_[sfLoanBrokerID] = value;
926 return *this;
927 }
928
935 build(uint256 const& index)
936 {
937 return AccountRoot{std::make_shared<SLE>(std::move(object_), index)};
938 }
939};
940
941} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
Builder for AccountRoot ledger entries.
AccountRootBuilder & setMintedNFTokens(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfMintedNFTokens (SoeDefault).
AccountRootBuilder(SLE::const_pointer sle)
Construct a AccountRootBuilder from an existing SLE object.
AccountRootBuilder & setAccountTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfAccountTxnID (SoeOptional).
AccountRootBuilder & setSponsoringOwnerCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSponsoringOwnerCount (SoeDefault).
AccountRootBuilder & setSponsoringAccountCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSponsoringAccountCount (SoeDefault).
AccountRootBuilder & setNFTokenMinter(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfNFTokenMinter (SoeOptional).
AccountRootBuilder & setMessageKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfMessageKey (SoeOptional).
AccountRootBuilder & setTickSize(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Set sfTickSize (SoeOptional).
AccountRootBuilder & setBurnedNFTokens(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfBurnedNFTokens (SoeDefault).
AccountRootBuilder & setTransferRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfTransferRate (SoeOptional).
AccountRootBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
AccountRootBuilder & setFirstNFTokenSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfFirstNFTokenSequence (SoeOptional).
AccountRootBuilder & setRegularKey(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfRegularKey (SoeOptional).
AccountRootBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeRequired).
AccountRootBuilder & setWalletSize(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfWalletSize (SoeOptional).
AccountRootBuilder & setSponsoredOwnerCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSponsoredOwnerCount (SoeDefault).
AccountRootBuilder & setAMMID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfAMMID (SoeOptional).
AccountRoot build(uint256 const &index)
Build and return the completed AccountRoot wrapper.
AccountRootBuilder & setLoanBrokerID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfLoanBrokerID (SoeOptional).
AccountRootBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (SoeRequired).
AccountRootBuilder(std::decay_t< typename SF_ACCOUNT::type::value_type > const &account, std::decay_t< typename SF_UINT32::type::value_type > const &sequence, std::decay_t< typename SF_AMOUNT::type::value_type > const &balance, std::decay_t< typename SF_UINT32::type::value_type > const &ownerCount, 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 AccountRootBuilder with required fields.
AccountRootBuilder & setEmailHash(std::decay_t< typename SF_UINT128::type::value_type > const &value)
Set sfEmailHash (SoeOptional).
AccountRootBuilder & setTicketCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfTicketCount (SoeOptional).
AccountRootBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
AccountRootBuilder & setDomain(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfDomain (SoeOptional).
AccountRootBuilder & setVaultID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfVaultID (SoeOptional).
AccountRootBuilder & setBalance(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfBalance (SoeRequired).
AccountRootBuilder & setWalletLocator(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfWalletLocator (SoeOptional).
AccountRootBuilder & setOwnerCount(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfOwnerCount (SoeRequired).
Ledger Entry: AccountRoot.
Definition AccountRoot.h:28
bool hasAMMID() const
Check if sfAMMID is present.
SF_AMOUNT::type::value_type getBalance() const
Get sfBalance (SoeRequired).
Definition AccountRoot.h:76
bool hasSponsoringAccountCount() const
Check if sfSponsoringAccountCount is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getSponsoringOwnerCount() const
Get sfSponsoringOwnerCount (SoeDefault).
bool hasSponsoringOwnerCount() const
Check if sfSponsoringOwnerCount is present.
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getRegularKey() const
Get sfRegularKey (SoeOptional).
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getNFTokenMinter() const
Get sfNFTokenMinter (SoeOptional).
bool hasTickSize() const
Check if sfTickSize is present.
protocol_autogen::Optional< SF_UINT256::type::value_type > getAccountTxnID() const
Get sfAccountTxnID (SoeOptional).
SF_UINT32::type::value_type getSequence() const
Get sfSequence (SoeRequired).
Definition AccountRoot.h:65
bool hasBurnedNFTokens() const
Check if sfBurnedNFTokens is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getWalletSize() const
Get sfWalletSize (SoeOptional).
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (SoeRequired).
Definition AccountRoot.h:98
protocol_autogen::Optional< SF_UINT8::type::value_type > getTickSize() const
Get sfTickSize (SoeOptional).
protocol_autogen::Optional< SF_VL::type::value_type > getDomain() const
Get sfDomain (SoeOptional).
bool hasWalletLocator() const
Check if sfWalletLocator is present.
bool hasMintedNFTokens() const
Check if sfMintedNFTokens is present.
static constexpr LedgerEntryType entryType
Definition AccountRoot.h:30
protocol_autogen::Optional< SF_UINT256::type::value_type > getAMMID() const
Get sfAMMID (SoeOptional).
bool hasAccountTxnID() const
Check if sfAccountTxnID is present.
bool hasTicketCount() const
Check if sfTicketCount is present.
bool hasDomain() const
Check if sfDomain is present.
bool hasEmailHash() const
Check if sfEmailHash is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getTicketCount() const
Get sfTicketCount (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getBurnedNFTokens() const
Get sfBurnedNFTokens (SoeDefault).
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (SoeRequired).
Definition AccountRoot.h:54
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (SoeRequired).
protocol_autogen::Optional< SF_UINT32::type::value_type > getFirstNFTokenSequence() const
Get sfFirstNFTokenSequence (SoeOptional).
bool hasWalletSize() const
Check if sfWalletSize is present.
protocol_autogen::Optional< SF_UINT256::type::value_type > getLoanBrokerID() const
Get sfLoanBrokerID (SoeOptional).
bool hasRegularKey() const
Check if sfRegularKey is present.
bool hasLoanBrokerID() const
Check if sfLoanBrokerID is present.
protocol_autogen::Optional< SF_UINT256::type::value_type > getVaultID() const
Get sfVaultID (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getTransferRate() const
Get sfTransferRate (SoeOptional).
bool hasFirstNFTokenSequence() const
Check if sfFirstNFTokenSequence is present.
bool hasMessageKey() const
Check if sfMessageKey is present.
bool hasTransferRate() const
Check if sfTransferRate is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getSponsoringAccountCount() const
Get sfSponsoringAccountCount (SoeDefault).
protocol_autogen::Optional< SF_UINT128::type::value_type > getEmailHash() const
Get sfEmailHash (SoeOptional).
bool hasNFTokenMinter() const
Check if sfNFTokenMinter is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getSponsoredOwnerCount() const
Get sfSponsoredOwnerCount (SoeDefault).
bool hasSponsoredOwnerCount() const
Check if sfSponsoredOwnerCount is present.
SF_UINT32::type::value_type getOwnerCount() const
Get sfOwnerCount (SoeRequired).
Definition AccountRoot.h:87
protocol_autogen::Optional< SF_VL::type::value_type > getMessageKey() const
Get sfMessageKey (SoeOptional).
bool hasVaultID() const
Check if sfVaultID is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getMintedNFTokens() const
Get sfMintedNFTokens (SoeDefault).
protocol_autogen::Optional< SF_UINT256::type::value_type > getWalletLocator() const
Get sfWalletLocator (SoeOptional).
AccountRoot(SLE::const_pointer sle)
Construct a AccountRoot ledger entry wrapper from an existing SLE object.
Definition AccountRoot.h:36
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.
std::uint32_t ownerCount(SLE::const_ref sle, beast::Journal j, std::int32_t ownerCountAdj=0)
Return number of the objects which reserve is covered by the account(sle) (so called "ownercount").
BaseUInt< 256 > uint256
Definition base_uint.h:580