xrpld
Loading...
Searching...
No Matches
protocol_autogen/transactions/AccountSet.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 = ttACCOUNT_SET;
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 AccountSet");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
57 {
58 if (hasEmailHash())
59 {
60 return this->tx_->at(sfEmailHash);
61 }
62 return std::nullopt;
63 }
64
69 [[nodiscard]]
70 bool
72 {
73 return this->tx_->isFieldPresent(sfEmailHash);
74 }
75
80 [[nodiscard]]
83 {
84 if (hasWalletLocator())
85 {
86 return this->tx_->at(sfWalletLocator);
87 }
88 return std::nullopt;
89 }
90
95 [[nodiscard]]
96 bool
98 {
99 return this->tx_->isFieldPresent(sfWalletLocator);
100 }
101
106 [[nodiscard]]
109 {
110 if (hasWalletSize())
111 {
112 return this->tx_->at(sfWalletSize);
113 }
114 return std::nullopt;
115 }
116
121 [[nodiscard]]
122 bool
124 {
125 return this->tx_->isFieldPresent(sfWalletSize);
126 }
127
132 [[nodiscard]]
135 {
136 if (hasMessageKey())
137 {
138 return this->tx_->at(sfMessageKey);
139 }
140 return std::nullopt;
141 }
142
147 [[nodiscard]]
148 bool
150 {
151 return this->tx_->isFieldPresent(sfMessageKey);
152 }
153
158 [[nodiscard]]
160 getDomain() const
161 {
162 if (hasDomain())
163 {
164 return this->tx_->at(sfDomain);
165 }
166 return std::nullopt;
167 }
168
173 [[nodiscard]]
174 bool
175 hasDomain() const
176 {
177 return this->tx_->isFieldPresent(sfDomain);
178 }
179
184 [[nodiscard]]
187 {
188 if (hasTransferRate())
189 {
190 return this->tx_->at(sfTransferRate);
191 }
192 return std::nullopt;
193 }
194
199 [[nodiscard]]
200 bool
202 {
203 return this->tx_->isFieldPresent(sfTransferRate);
204 }
205
210 [[nodiscard]]
213 {
214 if (hasSetFlag())
215 {
216 return this->tx_->at(sfSetFlag);
217 }
218 return std::nullopt;
219 }
220
225 [[nodiscard]]
226 bool
228 {
229 return this->tx_->isFieldPresent(sfSetFlag);
230 }
231
236 [[nodiscard]]
239 {
240 if (hasClearFlag())
241 {
242 return this->tx_->at(sfClearFlag);
243 }
244 return std::nullopt;
245 }
246
251 [[nodiscard]]
252 bool
254 {
255 return this->tx_->isFieldPresent(sfClearFlag);
256 }
257
262 [[nodiscard]]
265 {
266 if (hasTickSize())
267 {
268 return this->tx_->at(sfTickSize);
269 }
270 return std::nullopt;
271 }
272
277 [[nodiscard]]
278 bool
280 {
281 return this->tx_->isFieldPresent(sfTickSize);
282 }
283
288 [[nodiscard]]
291 {
292 if (hasNFTokenMinter())
293 {
294 return this->tx_->at(sfNFTokenMinter);
295 }
296 return std::nullopt;
297 }
298
303 [[nodiscard]]
304 bool
306 {
307 return this->tx_->isFieldPresent(sfNFTokenMinter);
308 }
309};
310
318class AccountSetBuilder : public TransactionBuilderBase<AccountSetBuilder>
319{
320public:
327 AccountSetBuilder(SF_ACCOUNT::type::value_type account,
328 std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
330)
331 : TransactionBuilderBase<AccountSetBuilder>(ttACCOUNT_SET, account, sequence, fee)
332 {
333 }
334
341 {
342 if (tx->getTxnType() != ttACCOUNT_SET)
343 {
344 throw std::runtime_error("Invalid transaction type for AccountSetBuilder");
345 }
346 object_ = *tx;
347 }
348
352
359 {
360 object_[sfEmailHash] = value;
361 return *this;
362 }
363
370 {
371 object_[sfWalletLocator] = value;
372 return *this;
373 }
374
381 {
382 object_[sfWalletSize] = value;
383 return *this;
384 }
385
392 {
393 object_[sfMessageKey] = value;
394 return *this;
395 }
396
403 {
404 object_[sfDomain] = value;
405 return *this;
406 }
407
414 {
415 object_[sfTransferRate] = value;
416 return *this;
417 }
418
425 {
426 object_[sfSetFlag] = value;
427 return *this;
428 }
429
436 {
437 object_[sfClearFlag] = value;
438 return *this;
439 }
440
447 {
448 object_[sfTickSize] = value;
449 return *this;
450 }
451
458 {
459 object_[sfNFTokenMinter] = value;
460 return *this;
461 }
462
470 build(PublicKey const& publicKey, SecretKey const& secretKey)
471 {
472 sign(publicKey, secretKey);
473 return AccountSet{std::make_shared<STTx>(std::move(object_))};
474 }
475};
476
477} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:53
A secret key.
Definition SecretKey.h:24
AccountSetBuilder(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 AccountSetBuilder with required fields.
AccountSetBuilder & setMessageKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfMessageKey (SoeOptional).
AccountSetBuilder & setWalletSize(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfWalletSize (SoeOptional).
AccountSetBuilder(std::shared_ptr< STTx const > tx)
Construct a AccountSetBuilder from an existing STTx object.
AccountSetBuilder & setSetFlag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSetFlag (SoeOptional).
AccountSetBuilder & setTransferRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfTransferRate (SoeOptional).
AccountSetBuilder & setNFTokenMinter(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfNFTokenMinter (SoeOptional).
AccountSetBuilder & setEmailHash(std::decay_t< typename SF_UINT128::type::value_type > const &value)
Transaction-specific field setters.
AccountSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the AccountSet wrapper.
AccountSetBuilder & setTickSize(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Set sfTickSize (SoeOptional).
AccountSetBuilder & setClearFlag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfClearFlag (SoeOptional).
AccountSetBuilder & setDomain(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfDomain (SoeOptional).
AccountSetBuilder & setWalletLocator(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfWalletLocator (SoeOptional).
AccountSet(std::shared_ptr< STTx const > tx)
Construct a AccountSet transaction wrapper from an existing STTx object.
bool hasDomain() const
Check if sfDomain is present.
protocol_autogen::Optional< SF_VL::type::value_type > getMessageKey() const
Get sfMessageKey (SoeOptional).
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getNFTokenMinter() const
Get sfNFTokenMinter (SoeOptional).
bool hasClearFlag() const
Check if sfClearFlag is present.
bool hasNFTokenMinter() const
Check if sfNFTokenMinter is present.
bool hasWalletLocator() const
Check if sfWalletLocator is present.
bool hasSetFlag() const
Check if sfSetFlag is present.
bool hasTickSize() const
Check if sfTickSize is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getTransferRate() const
Get sfTransferRate (SoeOptional).
protocol_autogen::Optional< SF_UINT128::type::value_type > getEmailHash() const
Get sfEmailHash (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getWalletSize() const
Get sfWalletSize (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getSetFlag() const
Get sfSetFlag (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getClearFlag() const
Get sfClearFlag (SoeOptional).
protocol_autogen::Optional< SF_UINT256::type::value_type > getWalletLocator() const
Get sfWalletLocator (SoeOptional).
bool hasEmailHash() const
Check if sfEmailHash is present.
bool hasWalletSize() const
Check if sfWalletSize is present.
protocol_autogen::Optional< SF_UINT8::type::value_type > getTickSize() const
Get sfTickSize (SoeOptional).
bool hasTransferRate() const
Check if sfTransferRate is present.
protocol_autogen::Optional< SF_VL::type::value_type > getDomain() const
Get sfDomain (SoeOptional).
bool hasMessageKey() const
Check if sfMessageKey is present.
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.
AccountSetBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
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