xrpld
Loading...
Searching...
No Matches
protocol_autogen/transactions/VaultCreate.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
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttVAULT_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 VaultCreate");
45 }
46 }
47
48 // Transaction-specific field getters
49
55 [[nodiscard]]
56 SF_ISSUE::type::value_type
57 getAsset() const
58 {
59 return this->tx_->at(sfAsset);
60 }
61
66 [[nodiscard]]
69 {
70 if (hasAssetsMaximum())
71 {
72 return this->tx_->at(sfAssetsMaximum);
73 }
74 return std::nullopt;
75 }
76
81 [[nodiscard]]
82 bool
84 {
85 return this->tx_->isFieldPresent(sfAssetsMaximum);
86 }
87
92 [[nodiscard]]
95 {
97 {
98 return this->tx_->at(sfMPTokenMetadata);
99 }
100 return std::nullopt;
101 }
102
107 [[nodiscard]]
108 bool
110 {
111 return this->tx_->isFieldPresent(sfMPTokenMetadata);
112 }
113
118 [[nodiscard]]
121 {
122 if (hasDomainID())
123 {
124 return this->tx_->at(sfDomainID);
125 }
126 return std::nullopt;
127 }
128
133 [[nodiscard]]
134 bool
136 {
137 return this->tx_->isFieldPresent(sfDomainID);
138 }
139
144 [[nodiscard]]
147 {
149 {
150 return this->tx_->at(sfWithdrawalPolicy);
151 }
152 return std::nullopt;
153 }
154
159 [[nodiscard]]
160 bool
162 {
163 return this->tx_->isFieldPresent(sfWithdrawalPolicy);
164 }
165
170 [[nodiscard]]
172 getData() const
173 {
174 if (hasData())
175 {
176 return this->tx_->at(sfData);
177 }
178 return std::nullopt;
179 }
180
185 [[nodiscard]]
186 bool
187 hasData() const
188 {
189 return this->tx_->isFieldPresent(sfData);
190 }
191
196 [[nodiscard]]
198 getScale() const
199 {
200 if (hasScale())
201 {
202 return this->tx_->at(sfScale);
203 }
204 return std::nullopt;
205 }
206
211 [[nodiscard]]
212 bool
213 hasScale() const
214 {
215 return this->tx_->isFieldPresent(sfScale);
216 }
217
222 [[nodiscard]]
225 {
226 if (hasVaultKind())
227 {
228 return this->tx_->at(sfVaultKind);
229 }
230 return std::nullopt;
231 }
232
237 [[nodiscard]]
238 bool
240 {
241 return this->tx_->isFieldPresent(sfVaultKind);
242 }
243
248 [[nodiscard]]
251 {
253 {
254 return this->tx_->at(sfSubscriptionDate);
255 }
256 return std::nullopt;
257 }
258
263 [[nodiscard]]
264 bool
266 {
267 return this->tx_->isFieldPresent(sfSubscriptionDate);
268 }
269
274 [[nodiscard]]
277 {
278 if (hasRedemptionDate())
279 {
280 return this->tx_->at(sfRedemptionDate);
281 }
282 return std::nullopt;
283 }
284
289 [[nodiscard]]
290 bool
292 {
293 return this->tx_->isFieldPresent(sfRedemptionDate);
294 }
295};
296
304class VaultCreateBuilder : public TransactionBuilderBase<VaultCreateBuilder>
305{
306public:
314 VaultCreateBuilder(SF_ACCOUNT::type::value_type account,
317)
318 : TransactionBuilderBase<VaultCreateBuilder>(ttVAULT_CREATE, account, sequence, fee)
319 {
320 setAsset(asset);
321 }
322
329 {
330 if (tx->getTxnType() != ttVAULT_CREATE)
331 {
332 throw std::runtime_error("Invalid transaction type for VaultCreateBuilder");
333 }
334 object_ = *tx;
335 }
336
340
348 {
349 object_[sfAsset] = STIssue(sfAsset, value);
350 return *this;
351 }
352
359 {
360 object_[sfAssetsMaximum] = value;
361 return *this;
362 }
363
370 {
371 object_[sfMPTokenMetadata] = value;
372 return *this;
373 }
374
381 {
382 object_[sfDomainID] = value;
383 return *this;
384 }
385
392 {
393 object_[sfWithdrawalPolicy] = value;
394 return *this;
395 }
396
403 {
404 object_[sfData] = value;
405 return *this;
406 }
407
414 {
415 object_[sfScale] = value;
416 return *this;
417 }
418
425 {
426 object_[sfVaultKind] = value;
427 return *this;
428 }
429
436 {
437 object_[sfSubscriptionDate] = value;
438 return *this;
439 }
440
447 {
448 object_[sfRedemptionDate] = value;
449 return *this;
450 }
451
459 build(PublicKey const& publicKey, SecretKey const& secretKey)
460 {
461 sign(publicKey, secretKey);
462 return VaultCreate{std::make_shared<STTx>(std::move(object_))};
463 }
464};
465
466} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:53
A secret key.
Definition SecretKey.h:24
std::shared_ptr< STTx const > tx_
The underlying transaction object being wrapped.
TransactionBase(std::shared_ptr< STTx const > tx)
Construct a transaction wrapper from an existing STTx object.
VaultCreateBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
VaultCreateBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_ISSUE::type::value_type > const &asset, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new VaultCreateBuilder with required fields.
VaultCreateBuilder & setWithdrawalPolicy(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Set sfWithdrawalPolicy (SoeOptional).
VaultCreateBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfDomainID (SoeOptional).
VaultCreateBuilder & setMPTokenMetadata(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfMPTokenMetadata (SoeOptional).
VaultCreateBuilder & setSubscriptionDate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSubscriptionDate (SoeOptional).
VaultCreateBuilder(std::shared_ptr< STTx const > tx)
Construct a VaultCreateBuilder from an existing STTx object.
VaultCreateBuilder & setRedemptionDate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfRedemptionDate (SoeOptional).
VaultCreateBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (SoeOptional).
VaultCreate build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the VaultCreate wrapper.
VaultCreateBuilder & setScale(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Set sfScale (SoeOptional).
VaultCreateBuilder & setVaultKind(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Set sfVaultKind (SoeOptional).
VaultCreateBuilder & setAssetsMaximum(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfAssetsMaximum (SoeOptional).
VaultCreateBuilder & setAsset(std::decay_t< typename SF_ISSUE::type::value_type > const &value)
Transaction-specific field setters.
bool hasAssetsMaximum() const
Check if sfAssetsMaximum is present.
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (SoeOptional).
bool hasMPTokenMetadata() const
Check if sfMPTokenMetadata is present.
bool hasData() const
Check if sfData is present.
bool hasRedemptionDate() const
Check if sfRedemptionDate is present.
bool hasScale() const
Check if sfScale is present.
protocol_autogen::Optional< SF_VL::type::value_type > getMPTokenMetadata() const
Get sfMPTokenMetadata (SoeOptional).
bool hasVaultKind() const
Check if sfVaultKind is present.
bool hasDomainID() const
Check if sfDomainID is present.
protocol_autogen::Optional< SF_VL::type::value_type > getData() const
Get sfData (SoeOptional).
protocol_autogen::Optional< SF_UINT8::type::value_type > getWithdrawalPolicy() const
Get sfWithdrawalPolicy (SoeOptional).
SF_ISSUE::type::value_type getAsset() const
Get sfAsset (SoeRequired).
protocol_autogen::Optional< SF_UINT8::type::value_type > getVaultKind() const
Get sfVaultKind (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getRedemptionDate() const
Get sfRedemptionDate (SoeOptional).
bool hasWithdrawalPolicy() const
Check if sfWithdrawalPolicy is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getSubscriptionDate() const
Get sfSubscriptionDate (SoeOptional).
protocol_autogen::Optional< SF_UINT8::type::value_type > getScale() const
Get sfScale (SoeOptional).
VaultCreate(std::shared_ptr< STTx const > tx)
Construct a VaultCreate transaction wrapper from an existing STTx object.
protocol_autogen::Optional< SF_NUMBER::type::value_type > getAssetsMaximum() const
Get sfAssetsMaximum (SoeOptional).
bool hasSubscriptionDate() const
Check if sfSubscriptionDate is present.
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
TxType
Transaction type identifiers.
Definition TxFormats.h:45