rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/MPTokenIssuanceCreate.h
1// This file is auto-generated. Do not edit.
2#pragma once
3
4#include <xrpl/protocol/STTx.h>
5#include <xrpl/protocol/STParsedJSON.h>
6#include <xrpl/protocol/jss.h>
7#include <xrpl/protocol_autogen/TransactionBase.h>
8#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
9#include <xrpl/json/json_value.h>
10
11#include <stdexcept>
12#include <optional>
13
14namespace xrpl::transactions {
15
16class MPTokenIssuanceCreateBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttMPTOKEN_ISSUANCE_CREATE;
33
39 : TransactionBase(std::move(tx))
40 {
41 // Verify transaction type
42 if (tx_->getTxnType() != txType)
43 {
44 throw std::runtime_error("Invalid transaction type for MPTokenIssuanceCreate");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
57 {
58 if (hasAssetScale())
59 {
60 return this->tx_->at(sfAssetScale);
61 }
62 return std::nullopt;
63 }
64
69 [[nodiscard]]
70 bool
72 {
73 return this->tx_->isFieldPresent(sfAssetScale);
74 }
75
80 [[nodiscard]]
83 {
84 if (hasTransferFee())
85 {
86 return this->tx_->at(sfTransferFee);
87 }
88 return std::nullopt;
89 }
90
95 [[nodiscard]]
96 bool
98 {
99 return this->tx_->isFieldPresent(sfTransferFee);
100 }
101
106 [[nodiscard]]
109 {
110 if (hasMaximumAmount())
111 {
112 return this->tx_->at(sfMaximumAmount);
113 }
114 return std::nullopt;
115 }
116
121 [[nodiscard]]
122 bool
124 {
125 return this->tx_->isFieldPresent(sfMaximumAmount);
126 }
127
132 [[nodiscard]]
135 {
136 if (hasMPTokenMetadata())
137 {
138 return this->tx_->at(sfMPTokenMetadata);
139 }
140 return std::nullopt;
141 }
142
147 [[nodiscard]]
148 bool
150 {
151 return this->tx_->isFieldPresent(sfMPTokenMetadata);
152 }
153
158 [[nodiscard]]
161 {
162 if (hasDomainID())
163 {
164 return this->tx_->at(sfDomainID);
165 }
166 return std::nullopt;
167 }
168
173 [[nodiscard]]
174 bool
176 {
177 return this->tx_->isFieldPresent(sfDomainID);
178 }
179
184 [[nodiscard]]
187 {
188 if (hasMutableFlags())
189 {
190 return this->tx_->at(sfMutableFlags);
191 }
192 return std::nullopt;
193 }
194
199 [[nodiscard]]
200 bool
202 {
203 return this->tx_->isFieldPresent(sfMutableFlags);
204 }
205};
206
214class MPTokenIssuanceCreateBuilder : public TransactionBuilderBase<MPTokenIssuanceCreateBuilder>
215{
216public:
223 MPTokenIssuanceCreateBuilder(SF_ACCOUNT::type::value_type account,
226)
227 : TransactionBuilderBase<MPTokenIssuanceCreateBuilder>(ttMPTOKEN_ISSUANCE_CREATE, account, sequence, fee)
228 {
229 }
230
237 {
238 if (tx->getTxnType() != ttMPTOKEN_ISSUANCE_CREATE)
239 {
240 throw std::runtime_error("Invalid transaction type for MPTokenIssuanceCreateBuilder");
241 }
242 object_ = *tx;
243 }
244
253 {
254 object_[sfAssetScale] = value;
255 return *this;
256 }
257
264 {
265 object_[sfTransferFee] = value;
266 return *this;
267 }
268
275 {
276 object_[sfMaximumAmount] = value;
277 return *this;
278 }
279
286 {
287 object_[sfMPTokenMetadata] = value;
288 return *this;
289 }
290
297 {
298 object_[sfDomainID] = value;
299 return *this;
300 }
301
308 {
309 object_[sfMutableFlags] = value;
310 return *this;
311 }
312
320 build(PublicKey const& publicKey, SecretKey const& secretKey)
321 {
322 sign(publicKey, secretKey);
324 }
325};
326
327} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
MPTokenIssuanceCreateBuilder & setMutableFlags(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfMutableFlags (soeOPTIONAL)
MPTokenIssuanceCreate build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the MPTokenIssuanceCreate wrapper.
MPTokenIssuanceCreateBuilder & setAssetScale(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Transaction-specific field setters.
MPTokenIssuanceCreateBuilder(SF_ACCOUNT::type::value_type account, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new MPTokenIssuanceCreateBuilder with required fields.
MPTokenIssuanceCreateBuilder(std::shared_ptr< STTx const > tx)
Construct a MPTokenIssuanceCreateBuilder from an existing STTx object.
MPTokenIssuanceCreateBuilder & setMaximumAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfMaximumAmount (soeOPTIONAL)
MPTokenIssuanceCreateBuilder & setMPTokenMetadata(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfMPTokenMetadata (soeOPTIONAL)
MPTokenIssuanceCreateBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfDomainID (soeOPTIONAL)
MPTokenIssuanceCreateBuilder & setTransferFee(std::decay_t< typename SF_UINT16::type::value_type > const &value)
Set sfTransferFee (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (soeOPTIONAL)
MPTokenIssuanceCreate(std::shared_ptr< STTx const > tx)
Construct a MPTokenIssuanceCreate transaction wrapper from an existing STTx object.
protocol_autogen::Optional< SF_VL::type::value_type > getMPTokenMetadata() const
Get sfMPTokenMetadata (soeOPTIONAL)
bool hasMPTokenMetadata() const
Check if sfMPTokenMetadata is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getMutableFlags() const
Get sfMutableFlags (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT8::type::value_type > getAssetScale() const
Get sfAssetScale (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT16::type::value_type > getTransferFee() const
Get sfTransferFee (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT64::type::value_type > getMaximumAmount() const
Get sfMaximumAmount (soeOPTIONAL)
Base class for all transaction wrapper types.
std::shared_ptr< STTx const > tx_
The underlying transaction object being wrapped.
Base class for all transaction builders.
MPTokenIssuanceCreateBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
Sign the transaction with the given keys.
T is_same_v
STL namespace.
TxType
Transaction type identifiers.
Definition TxFormats.h:39