xrpld
Loading...
Searching...
No Matches
MPToken.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 MPTokenBuilder;
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltMPTOKEN;
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 MPToken");
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_UINT192::type::value_type
66 {
67 return this->sle_->at(sfMPTokenIssuanceID);
68 }
69
74 [[nodiscard]]
77 {
78 if (hasMPTAmount())
79 return this->sle_->at(sfMPTAmount);
80 return std::nullopt;
81 }
82
87 [[nodiscard]]
88 bool
90 {
91 return this->sle_->isFieldPresent(sfMPTAmount);
92 }
93
98 [[nodiscard]]
101 {
102 if (hasLockedAmount())
103 return this->sle_->at(sfLockedAmount);
104 return std::nullopt;
105 }
106
111 [[nodiscard]]
112 bool
114 {
115 return this->sle_->isFieldPresent(sfLockedAmount);
116 }
117
122 [[nodiscard]]
123 SF_UINT64::type::value_type
125 {
126 return this->sle_->at(sfOwnerNode);
127 }
128
133 [[nodiscard]]
134 SF_UINT256::type::value_type
136 {
137 return this->sle_->at(sfPreviousTxnID);
138 }
139
144 [[nodiscard]]
145 SF_UINT32::type::value_type
147 {
148 return this->sle_->at(sfPreviousTxnLgrSeq);
149 }
150
155 [[nodiscard]]
158 {
160 return this->sle_->at(sfConfidentialBalanceInbox);
161 return std::nullopt;
162 }
163
168 [[nodiscard]]
169 bool
171 {
172 return this->sle_->isFieldPresent(sfConfidentialBalanceInbox);
173 }
174
179 [[nodiscard]]
182 {
184 return this->sle_->at(sfConfidentialBalanceSpending);
185 return std::nullopt;
186 }
187
192 [[nodiscard]]
193 bool
195 {
196 return this->sle_->isFieldPresent(sfConfidentialBalanceSpending);
197 }
198
203 [[nodiscard]]
206 {
208 return this->sle_->at(sfConfidentialBalanceVersion);
209 return std::nullopt;
210 }
211
216 [[nodiscard]]
217 bool
219 {
220 return this->sle_->isFieldPresent(sfConfidentialBalanceVersion);
221 }
222
227 [[nodiscard]]
230 {
232 return this->sle_->at(sfIssuerEncryptedBalance);
233 return std::nullopt;
234 }
235
240 [[nodiscard]]
241 bool
243 {
244 return this->sle_->isFieldPresent(sfIssuerEncryptedBalance);
245 }
246
251 [[nodiscard]]
254 {
256 return this->sle_->at(sfAuditorEncryptedBalance);
257 return std::nullopt;
258 }
259
264 [[nodiscard]]
265 bool
267 {
268 return this->sle_->isFieldPresent(sfAuditorEncryptedBalance);
269 }
270
275 [[nodiscard]]
278 {
280 return this->sle_->at(sfIssuerKeyMirrorEpoch);
281 return std::nullopt;
282 }
283
288 [[nodiscard]]
289 bool
291 {
292 return this->sle_->isFieldPresent(sfIssuerKeyMirrorEpoch);
293 }
294
299 [[nodiscard]]
302 {
304 return this->sle_->at(sfAuditorKeyMirrorEpoch);
305 return std::nullopt;
306 }
307
312 [[nodiscard]]
313 bool
315 {
316 return this->sle_->isFieldPresent(sfAuditorKeyMirrorEpoch);
317 }
318
323 [[nodiscard]]
326 {
328 return this->sle_->at(sfIssuerMirrorEncryptionKey);
329 return std::nullopt;
330 }
331
336 [[nodiscard]]
337 bool
339 {
340 return this->sle_->isFieldPresent(sfIssuerMirrorEncryptionKey);
341 }
342
347 [[nodiscard]]
350 {
352 return this->sle_->at(sfHolderEncryptionKey);
353 return std::nullopt;
354 }
355
360 [[nodiscard]]
361 bool
363 {
364 return this->sle_->isFieldPresent(sfHolderEncryptionKey);
365 }
366
371 [[nodiscard]]
374 {
375 if (hasRecoveryKey())
376 return this->sle_->at(sfRecoveryKey);
377 return std::nullopt;
378 }
379
384 [[nodiscard]]
385 bool
387 {
388 return this->sle_->isFieldPresent(sfRecoveryKey);
389 }
390};
391
399class MPTokenBuilder : public LedgerEntryBuilderBase<MPTokenBuilder>
400{
401public:
419
426 {
427 if (sle->at(sfLedgerEntryType) != ltMPTOKEN)
428 {
429 throw std::runtime_error("Invalid ledger entry type for MPToken");
430 }
431 object_ = *sle;
432 }
433
437
444 {
445 object_[sfAccount] = value;
446 return *this;
447 }
448
455 {
456 object_[sfMPTokenIssuanceID] = value;
457 return *this;
458 }
459
466 {
467 object_[sfMPTAmount] = value;
468 return *this;
469 }
470
477 {
478 object_[sfLockedAmount] = value;
479 return *this;
480 }
481
488 {
489 object_[sfOwnerNode] = value;
490 return *this;
491 }
492
499 {
500 object_[sfPreviousTxnID] = value;
501 return *this;
502 }
503
510 {
511 object_[sfPreviousTxnLgrSeq] = value;
512 return *this;
513 }
514
521 {
522 object_[sfConfidentialBalanceInbox] = value;
523 return *this;
524 }
525
532 {
533 object_[sfConfidentialBalanceSpending] = value;
534 return *this;
535 }
536
543 {
544 object_[sfConfidentialBalanceVersion] = value;
545 return *this;
546 }
547
554 {
555 object_[sfIssuerEncryptedBalance] = value;
556 return *this;
557 }
558
565 {
566 object_[sfAuditorEncryptedBalance] = value;
567 return *this;
568 }
569
576 {
577 object_[sfIssuerKeyMirrorEpoch] = value;
578 return *this;
579 }
580
587 {
588 object_[sfAuditorKeyMirrorEpoch] = value;
589 return *this;
590 }
591
598 {
599 object_[sfIssuerMirrorEncryptionKey] = value;
600 return *this;
601 }
602
609 {
610 object_[sfHolderEncryptionKey] = value;
611 return *this;
612 }
613
620 {
621 object_[sfRecoveryKey] = value;
622 return *this;
623 }
624
630 MPToken
631 build(UInt256 const& index)
632 {
633 return MPToken{std::make_shared<SLE>(std::move(object_), index)};
634 }
635};
636
637} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
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.
Builder for MPToken ledger entries.
Definition MPToken.h:400
MPTokenBuilder(SLE::const_pointer sle)
Construct a MPTokenBuilder from an existing SLE object.
Definition MPToken.h:425
MPTokenBuilder & setConfidentialBalanceSpending(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceSpending (SoeOptional).
Definition MPToken.h:531
MPTokenBuilder & setRecoveryKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfRecoveryKey (SoeOptional).
Definition MPToken.h:619
MPTokenBuilder & setIssuerMirrorEncryptionKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfIssuerMirrorEncryptionKey (SoeOptional).
Definition MPToken.h:597
MPTokenBuilder & setAuditorKeyMirrorEpoch(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfAuditorKeyMirrorEpoch (SoeOptional).
Definition MPToken.h:586
MPTokenBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeRequired).
Definition MPToken.h:498
MPTokenBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition MPToken.h:443
MPTokenBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
Definition MPToken.h:509
MPTokenBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (SoeRequired).
Definition MPToken.h:487
MPTokenBuilder & setMPTokenIssuanceID(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Set sfMPTokenIssuanceID (SoeRequired).
Definition MPToken.h:454
MPTokenBuilder & setIssuerEncryptedBalance(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfIssuerEncryptedBalance (SoeOptional).
Definition MPToken.h:553
MPTokenBuilder & setIssuerKeyMirrorEpoch(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfIssuerKeyMirrorEpoch (SoeOptional).
Definition MPToken.h:575
MPTokenBuilder & setLockedAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfLockedAmount (SoeOptional).
Definition MPToken.h:476
MPTokenBuilder & setConfidentialBalanceInbox(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceInbox (SoeOptional).
Definition MPToken.h:520
MPTokenBuilder & setHolderEncryptionKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfHolderEncryptionKey (SoeOptional).
Definition MPToken.h:608
MPTokenBuilder(std::decay_t< typename SF_ACCOUNT::type::value_type > const &account, std::decay_t< typename SF_UINT192::type::value_type > const &mPTokenIssuanceID, 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 MPTokenBuilder with required fields.
Definition MPToken.h:410
MPTokenBuilder & setMPTAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfMPTAmount (SoeDefault).
Definition MPToken.h:465
MPTokenBuilder & setAuditorEncryptedBalance(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfAuditorEncryptedBalance (SoeOptional).
Definition MPToken.h:564
MPToken build(UInt256 const &index)
Build and return the completed MPToken wrapper.
Definition MPToken.h:631
MPTokenBuilder & setConfidentialBalanceVersion(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfConfidentialBalanceVersion (SoeDefault).
Definition MPToken.h:542
Ledger Entry: MPToken.
Definition MPToken.h:28
bool hasIssuerMirrorEncryptionKey() const
Check if sfIssuerMirrorEncryptionKey is present.
Definition MPToken.h:338
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (SoeRequired).
Definition MPToken.h:135
MPToken(SLE::const_pointer sle)
Construct a MPToken ledger entry wrapper from an existing SLE object.
Definition MPToken.h:36
bool hasHolderEncryptionKey() const
Check if sfHolderEncryptionKey is present.
Definition MPToken.h:362
protocol_autogen::Optional< SF_VL::type::value_type > getHolderEncryptionKey() const
Get sfHolderEncryptionKey (SoeOptional).
Definition MPToken.h:349
bool hasAuditorKeyMirrorEpoch() const
Check if sfAuditorKeyMirrorEpoch is present.
Definition MPToken.h:314
SF_UINT192::type::value_type getMPTokenIssuanceID() const
Get sfMPTokenIssuanceID (SoeRequired).
Definition MPToken.h:65
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (SoeRequired).
Definition MPToken.h:54
static constexpr LedgerEntryType entryType
Definition MPToken.h:30
protocol_autogen::Optional< SF_VL::type::value_type > getIssuerMirrorEncryptionKey() const
Get sfIssuerMirrorEncryptionKey (SoeOptional).
Definition MPToken.h:325
protocol_autogen::Optional< SF_VL::type::value_type > getRecoveryKey() const
Get sfRecoveryKey (SoeOptional).
Definition MPToken.h:373
bool hasRecoveryKey() const
Check if sfRecoveryKey is present.
Definition MPToken.h:386
protocol_autogen::Optional< SF_UINT64::type::value_type > getMPTAmount() const
Get sfMPTAmount (SoeDefault).
Definition MPToken.h:76
protocol_autogen::Optional< SF_VL::type::value_type > getAuditorEncryptedBalance() const
Get sfAuditorEncryptedBalance (SoeOptional).
Definition MPToken.h:253
protocol_autogen::Optional< SF_UINT32::type::value_type > getIssuerKeyMirrorEpoch() const
Get sfIssuerKeyMirrorEpoch (SoeOptional).
Definition MPToken.h:277
bool hasMPTAmount() const
Check if sfMPTAmount is present.
Definition MPToken.h:89
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (SoeRequired).
Definition MPToken.h:146
bool hasConfidentialBalanceInbox() const
Check if sfConfidentialBalanceInbox is present.
Definition MPToken.h:170
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (SoeRequired).
Definition MPToken.h:124
bool hasConfidentialBalanceVersion() const
Check if sfConfidentialBalanceVersion is present.
Definition MPToken.h:218
bool hasConfidentialBalanceSpending() const
Check if sfConfidentialBalanceSpending is present.
Definition MPToken.h:194
bool hasLockedAmount() const
Check if sfLockedAmount is present.
Definition MPToken.h:113
protocol_autogen::Optional< SF_VL::type::value_type > getIssuerEncryptedBalance() const
Get sfIssuerEncryptedBalance (SoeOptional).
Definition MPToken.h:229
bool hasIssuerKeyMirrorEpoch() const
Check if sfIssuerKeyMirrorEpoch is present.
Definition MPToken.h:290
protocol_autogen::Optional< SF_UINT32::type::value_type > getAuditorKeyMirrorEpoch() const
Get sfAuditorKeyMirrorEpoch (SoeOptional).
Definition MPToken.h:301
bool hasIssuerEncryptedBalance() const
Check if sfIssuerEncryptedBalance is present.
Definition MPToken.h:242
protocol_autogen::Optional< SF_VL::type::value_type > getConfidentialBalanceInbox() const
Get sfConfidentialBalanceInbox (SoeOptional).
Definition MPToken.h:157
protocol_autogen::Optional< SF_VL::type::value_type > getConfidentialBalanceSpending() const
Get sfConfidentialBalanceSpending (SoeOptional).
Definition MPToken.h:181
bool hasAuditorEncryptedBalance() const
Check if sfAuditorEncryptedBalance is present.
Definition MPToken.h:266
protocol_autogen::Optional< SF_UINT32::type::value_type > getConfidentialBalanceVersion() const
Get sfConfidentialBalanceVersion (SoeDefault).
Definition MPToken.h:205
protocol_autogen::Optional< SF_UINT64::type::value_type > getLockedAmount() const
Get sfLockedAmount (SoeOptional).
Definition MPToken.h:100
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
BaseUInt< 256 > UInt256
Definition base_uint.h:581
LedgerEntryType
Identifiers for on-ledger objects.