rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/NFTokenMint.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 NFTokenMintBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttNFTOKEN_MINT;
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 NFTokenMint");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
55 SF_UINT32::type::value_type
57 {
58 return this->tx_->at(sfNFTokenTaxon);
59 }
60
65 [[nodiscard]]
68 {
69 if (hasTransferFee())
70 {
71 return this->tx_->at(sfTransferFee);
72 }
73 return std::nullopt;
74 }
75
80 [[nodiscard]]
81 bool
83 {
84 return this->tx_->isFieldPresent(sfTransferFee);
85 }
86
91 [[nodiscard]]
93 getIssuer() const
94 {
95 if (hasIssuer())
96 {
97 return this->tx_->at(sfIssuer);
98 }
99 return std::nullopt;
100 }
101
106 [[nodiscard]]
107 bool
108 hasIssuer() const
109 {
110 return this->tx_->isFieldPresent(sfIssuer);
111 }
112
117 [[nodiscard]]
119 getURI() const
120 {
121 if (hasURI())
122 {
123 return this->tx_->at(sfURI);
124 }
125 return std::nullopt;
126 }
127
132 [[nodiscard]]
133 bool
134 hasURI() const
135 {
136 return this->tx_->isFieldPresent(sfURI);
137 }
138
143 [[nodiscard]]
145 getAmount() const
146 {
147 if (hasAmount())
148 {
149 return this->tx_->at(sfAmount);
150 }
151 return std::nullopt;
152 }
153
158 [[nodiscard]]
159 bool
160 hasAmount() const
161 {
162 return this->tx_->isFieldPresent(sfAmount);
163 }
164
169 [[nodiscard]]
172 {
173 if (hasDestination())
174 {
175 return this->tx_->at(sfDestination);
176 }
177 return std::nullopt;
178 }
179
184 [[nodiscard]]
185 bool
187 {
188 return this->tx_->isFieldPresent(sfDestination);
189 }
190
195 [[nodiscard]]
198 {
199 if (hasExpiration())
200 {
201 return this->tx_->at(sfExpiration);
202 }
203 return std::nullopt;
204 }
205
210 [[nodiscard]]
211 bool
213 {
214 return this->tx_->isFieldPresent(sfExpiration);
215 }
216};
217
225class NFTokenMintBuilder : public TransactionBuilderBase<NFTokenMintBuilder>
226{
227public:
235 NFTokenMintBuilder(SF_ACCOUNT::type::value_type account,
238)
239 : TransactionBuilderBase<NFTokenMintBuilder>(ttNFTOKEN_MINT, account, sequence, fee)
240 {
241 setNFTokenTaxon(nFTokenTaxon);
242 }
243
250 {
251 if (tx->getTxnType() != ttNFTOKEN_MINT)
252 {
253 throw std::runtime_error("Invalid transaction type for NFTokenMintBuilder");
254 }
255 object_ = *tx;
256 }
257
266 {
267 object_[sfNFTokenTaxon] = value;
268 return *this;
269 }
270
277 {
278 object_[sfTransferFee] = value;
279 return *this;
280 }
281
288 {
289 object_[sfIssuer] = value;
290 return *this;
291 }
292
299 {
300 object_[sfURI] = value;
301 return *this;
302 }
303
310 {
311 object_[sfAmount] = value;
312 return *this;
313 }
314
321 {
322 object_[sfDestination] = value;
323 return *this;
324 }
325
332 {
333 object_[sfExpiration] = value;
334 return *this;
335 }
336
344 build(PublicKey const& publicKey, SecretKey const& secretKey)
345 {
346 sign(publicKey, secretKey);
347 return NFTokenMint{std::make_shared<STTx>(std::move(object_))};
348 }
349};
350
351} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
NFTokenMintBuilder & setExpiration(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfExpiration (soeOPTIONAL)
NFTokenMintBuilder & setIssuer(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfIssuer (soeOPTIONAL)
NFTokenMint build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the NFTokenMint wrapper.
NFTokenMintBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeOPTIONAL)
NFTokenMintBuilder & setNFTokenTaxon(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Transaction-specific field setters.
NFTokenMintBuilder(std::shared_ptr< STTx const > tx)
Construct a NFTokenMintBuilder from an existing STTx object.
NFTokenMintBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (soeOPTIONAL)
NFTokenMintBuilder & setTransferFee(std::decay_t< typename SF_UINT16::type::value_type > const &value)
Set sfTransferFee (soeOPTIONAL)
NFTokenMintBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT32::type::value_type > const &nFTokenTaxon, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new NFTokenMintBuilder with required fields.
NFTokenMintBuilder & setURI(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfURI (soeOPTIONAL)
bool hasTransferFee() const
Check if sfTransferFee is present.
bool hasAmount() const
Check if sfAmount is present.
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getIssuer() const
Get sfIssuer (soeOPTIONAL)
NFTokenMint(std::shared_ptr< STTx const > tx)
Construct a NFTokenMint transaction wrapper from an existing STTx object.
protocol_autogen::Optional< SF_UINT16::type::value_type > getTransferFee() const
Get sfTransferFee (soeOPTIONAL)
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getDestination() const
Get sfDestination (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT32::type::value_type > getExpiration() const
Get sfExpiration (soeOPTIONAL)
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getAmount() const
Get sfAmount (soeOPTIONAL)
bool hasExpiration() const
Check if sfExpiration is present.
SF_UINT32::type::value_type getNFTokenTaxon() const
Get sfNFTokenTaxon (soeREQUIRED)
bool hasDestination() const
Check if sfDestination is present.
bool hasIssuer() const
Check if sfIssuer is present.
protocol_autogen::Optional< SF_VL::type::value_type > getURI() const
Get sfURI (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.
NFTokenMintBuilder & 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