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(sfHolderEncryptionKey);
329 return std::nullopt;
330 }
331
336 [[nodiscard]]
337 bool
339 {
340 return this->sle_->isFieldPresent(sfHolderEncryptionKey);
341 }
342
347 [[nodiscard]]
350 {
351 if (hasRecoveryKey())
352 return this->sle_->at(sfRecoveryKey);
353 return std::nullopt;
354 }
355
360 [[nodiscard]]
361 bool
363 {
364 return this->sle_->isFieldPresent(sfRecoveryKey);
365 }
366};
367
375class MPTokenBuilder : public LedgerEntryBuilderBase<MPTokenBuilder>
376{
377public:
395
402 {
403 if (sle->at(sfLedgerEntryType) != ltMPTOKEN)
404 {
405 throw std::runtime_error("Invalid ledger entry type for MPToken");
406 }
407 object_ = *sle;
408 }
409
413
420 {
421 object_[sfAccount] = value;
422 return *this;
423 }
424
431 {
432 object_[sfMPTokenIssuanceID] = value;
433 return *this;
434 }
435
442 {
443 object_[sfMPTAmount] = value;
444 return *this;
445 }
446
453 {
454 object_[sfLockedAmount] = value;
455 return *this;
456 }
457
464 {
465 object_[sfOwnerNode] = value;
466 return *this;
467 }
468
475 {
476 object_[sfPreviousTxnID] = value;
477 return *this;
478 }
479
486 {
487 object_[sfPreviousTxnLgrSeq] = value;
488 return *this;
489 }
490
497 {
498 object_[sfConfidentialBalanceInbox] = value;
499 return *this;
500 }
501
508 {
509 object_[sfConfidentialBalanceSpending] = value;
510 return *this;
511 }
512
519 {
520 object_[sfConfidentialBalanceVersion] = value;
521 return *this;
522 }
523
530 {
531 object_[sfIssuerEncryptedBalance] = value;
532 return *this;
533 }
534
541 {
542 object_[sfAuditorEncryptedBalance] = value;
543 return *this;
544 }
545
552 {
553 object_[sfIssuerKeyMirrorEpoch] = value;
554 return *this;
555 }
556
563 {
564 object_[sfAuditorKeyMirrorEpoch] = value;
565 return *this;
566 }
567
574 {
575 object_[sfHolderEncryptionKey] = value;
576 return *this;
577 }
578
585 {
586 object_[sfRecoveryKey] = value;
587 return *this;
588 }
589
595 MPToken
596 build(UInt256 const& index)
597 {
598 return MPToken{std::make_shared<SLE>(std::move(object_), index)};
599 }
600};
601
602} // 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:376
MPTokenBuilder(SLE::const_pointer sle)
Construct a MPTokenBuilder from an existing SLE object.
Definition MPToken.h:401
MPTokenBuilder & setConfidentialBalanceSpending(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceSpending (SoeOptional).
Definition MPToken.h:507
MPTokenBuilder & setRecoveryKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfRecoveryKey (SoeOptional).
Definition MPToken.h:584
MPTokenBuilder & setAuditorKeyMirrorEpoch(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfAuditorKeyMirrorEpoch (SoeOptional).
Definition MPToken.h:562
MPTokenBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeRequired).
Definition MPToken.h:474
MPTokenBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition MPToken.h:419
MPTokenBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
Definition MPToken.h:485
MPTokenBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (SoeRequired).
Definition MPToken.h:463
MPTokenBuilder & setMPTokenIssuanceID(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Set sfMPTokenIssuanceID (SoeRequired).
Definition MPToken.h:430
MPTokenBuilder & setIssuerEncryptedBalance(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfIssuerEncryptedBalance (SoeOptional).
Definition MPToken.h:529
MPTokenBuilder & setIssuerKeyMirrorEpoch(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfIssuerKeyMirrorEpoch (SoeOptional).
Definition MPToken.h:551
MPTokenBuilder & setLockedAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfLockedAmount (SoeOptional).
Definition MPToken.h:452
MPTokenBuilder & setConfidentialBalanceInbox(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceInbox (SoeOptional).
Definition MPToken.h:496
MPTokenBuilder & setHolderEncryptionKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfHolderEncryptionKey (SoeOptional).
Definition MPToken.h:573
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:386
MPTokenBuilder & setMPTAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfMPTAmount (SoeDefault).
Definition MPToken.h:441
MPTokenBuilder & setAuditorEncryptedBalance(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfAuditorEncryptedBalance (SoeOptional).
Definition MPToken.h:540
MPToken build(UInt256 const &index)
Build and return the completed MPToken wrapper.
Definition MPToken.h:596
MPTokenBuilder & setConfidentialBalanceVersion(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfConfidentialBalanceVersion (SoeDefault).
Definition MPToken.h:518
Ledger Entry: MPToken.
Definition MPToken.h:28
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:338
protocol_autogen::Optional< SF_VL::type::value_type > getHolderEncryptionKey() const
Get sfHolderEncryptionKey (SoeOptional).
Definition MPToken.h:325
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 > getRecoveryKey() const
Get sfRecoveryKey (SoeOptional).
Definition MPToken.h:349
bool hasRecoveryKey() const
Check if sfRecoveryKey is present.
Definition MPToken.h:362
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:580
LedgerEntryType
Identifiers for on-ledger objects.