rippled
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
16class AccountSetBuilder;
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,
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
357 {
358 object_[sfEmailHash] = value;
359 return *this;
360 }
361
368 {
369 object_[sfWalletLocator] = value;
370 return *this;
371 }
372
379 {
380 object_[sfWalletSize] = value;
381 return *this;
382 }
383
390 {
391 object_[sfMessageKey] = value;
392 return *this;
393 }
394
401 {
402 object_[sfDomain] = value;
403 return *this;
404 }
405
412 {
413 object_[sfTransferRate] = value;
414 return *this;
415 }
416
423 {
424 object_[sfSetFlag] = value;
425 return *this;
426 }
427
434 {
435 object_[sfClearFlag] = value;
436 return *this;
437 }
438
445 {
446 object_[sfTickSize] = value;
447 return *this;
448 }
449
456 {
457 object_[sfNFTokenMinter] = value;
458 return *this;
459 }
460
468 build(PublicKey const& publicKey, SecretKey const& secretKey)
469 {
470 sign(publicKey, secretKey);
471 return AccountSet{std::make_shared<STTx>(std::move(object_))};
472 }
473};
474
475} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
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.
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.
AccountSetBuilder & 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