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(sfHolderEncryptionKey);
281 return std::nullopt;
282 }
283
288 [[nodiscard]]
289 bool
291 {
292 return this->sle_->isFieldPresent(sfHolderEncryptionKey);
293 }
294};
295
303class MPTokenBuilder : public LedgerEntryBuilderBase<MPTokenBuilder>
304{
305public:
323
330 {
331 if (sle->at(sfLedgerEntryType) != ltMPTOKEN)
332 {
333 throw std::runtime_error("Invalid ledger entry type for MPToken");
334 }
335 object_ = *sle;
336 }
337
339
346 {
347 object_[sfAccount] = value;
348 return *this;
349 }
350
357 {
358 object_[sfMPTokenIssuanceID] = value;
359 return *this;
360 }
361
368 {
369 object_[sfMPTAmount] = value;
370 return *this;
371 }
372
379 {
380 object_[sfLockedAmount] = value;
381 return *this;
382 }
383
390 {
391 object_[sfOwnerNode] = value;
392 return *this;
393 }
394
401 {
402 object_[sfPreviousTxnID] = value;
403 return *this;
404 }
405
412 {
413 object_[sfPreviousTxnLgrSeq] = value;
414 return *this;
415 }
416
423 {
424 object_[sfConfidentialBalanceInbox] = value;
425 return *this;
426 }
427
434 {
435 object_[sfConfidentialBalanceSpending] = value;
436 return *this;
437 }
438
445 {
446 object_[sfConfidentialBalanceVersion] = value;
447 return *this;
448 }
449
456 {
457 object_[sfIssuerEncryptedBalance] = value;
458 return *this;
459 }
460
467 {
468 object_[sfAuditorEncryptedBalance] = value;
469 return *this;
470 }
471
478 {
479 object_[sfHolderEncryptionKey] = value;
480 return *this;
481 }
482
488 MPToken
489 build(uint256 const& index)
490 {
491 return MPToken{std::make_shared<SLE>(std::move(object_), index)};
492 }
493};
494
495} // 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:304
MPTokenBuilder(SLE::const_pointer sle)
Construct a MPTokenBuilder from an existing SLE object.
Definition MPToken.h:329
MPTokenBuilder & setConfidentialBalanceSpending(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceSpending (SoeOptional).
Definition MPToken.h:433
MPTokenBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeRequired).
Definition MPToken.h:400
MPTokenBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition MPToken.h:345
MPTokenBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeRequired).
Definition MPToken.h:411
MPTokenBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (SoeRequired).
Definition MPToken.h:389
MPTokenBuilder & setMPTokenIssuanceID(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Set sfMPTokenIssuanceID (SoeRequired).
Definition MPToken.h:356
MPTokenBuilder & setIssuerEncryptedBalance(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfIssuerEncryptedBalance (SoeOptional).
Definition MPToken.h:455
MPToken build(uint256 const &index)
Build and return the completed MPToken wrapper.
Definition MPToken.h:489
MPTokenBuilder & setLockedAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfLockedAmount (SoeOptional).
Definition MPToken.h:378
MPTokenBuilder & setConfidentialBalanceInbox(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceInbox (SoeOptional).
Definition MPToken.h:422
MPTokenBuilder & setHolderEncryptionKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfHolderEncryptionKey (SoeOptional).
Definition MPToken.h:477
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:314
MPTokenBuilder & setMPTAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfMPTAmount (SoeDefault).
Definition MPToken.h:367
MPTokenBuilder & setAuditorEncryptedBalance(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfAuditorEncryptedBalance (SoeOptional).
Definition MPToken.h:466
MPTokenBuilder & setConfidentialBalanceVersion(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfConfidentialBalanceVersion (SoeDefault).
Definition MPToken.h:444
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:290
protocol_autogen::Optional< SF_VL::type::value_type > getHolderEncryptionKey() const
Get sfHolderEncryptionKey (SoeOptional).
Definition MPToken.h:277
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_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
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 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
LedgerEntryType
Identifiers for on-ledger objects.
BaseUInt< 256 > uint256
Definition base_uint.h:562