xrpld
Loading...
Searching...
No Matches
SetFee.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 SetFeeBuilder;
17
29class SetFee : public TransactionBase
30{
31public:
32 static constexpr xrpl::TxType txType = ttFEE;
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 SetFee");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
57 {
59 {
60 return this->tx_->at(sfLedgerSequence);
61 }
62 return std::nullopt;
63 }
64
69 [[nodiscard]]
70 bool
72 {
73 return this->tx_->isFieldPresent(sfLedgerSequence);
74 }
75
80 [[nodiscard]]
82 getBaseFee() const
83 {
84 if (hasBaseFee())
85 {
86 return this->tx_->at(sfBaseFee);
87 }
88 return std::nullopt;
89 }
90
95 [[nodiscard]]
96 bool
97 hasBaseFee() const
98 {
99 return this->tx_->isFieldPresent(sfBaseFee);
100 }
101
106 [[nodiscard]]
109 {
111 {
112 return this->tx_->at(sfReferenceFeeUnits);
113 }
114 return std::nullopt;
115 }
116
121 [[nodiscard]]
122 bool
124 {
125 return this->tx_->isFieldPresent(sfReferenceFeeUnits);
126 }
127
132 [[nodiscard]]
135 {
136 if (hasReserveBase())
137 {
138 return this->tx_->at(sfReserveBase);
139 }
140 return std::nullopt;
141 }
142
147 [[nodiscard]]
148 bool
150 {
151 return this->tx_->isFieldPresent(sfReserveBase);
152 }
153
158 [[nodiscard]]
161 {
163 {
164 return this->tx_->at(sfReserveIncrement);
165 }
166 return std::nullopt;
167 }
168
173 [[nodiscard]]
174 bool
176 {
177 return this->tx_->isFieldPresent(sfReserveIncrement);
178 }
179
184 [[nodiscard]]
187 {
188 if (hasBaseFeeDrops())
189 {
190 return this->tx_->at(sfBaseFeeDrops);
191 }
192 return std::nullopt;
193 }
194
199 [[nodiscard]]
200 bool
202 {
203 return this->tx_->isFieldPresent(sfBaseFeeDrops);
204 }
205
210 [[nodiscard]]
213 {
215 {
216 return this->tx_->at(sfReserveBaseDrops);
217 }
218 return std::nullopt;
219 }
220
225 [[nodiscard]]
226 bool
228 {
229 return this->tx_->isFieldPresent(sfReserveBaseDrops);
230 }
231
236 [[nodiscard]]
239 {
241 {
242 return this->tx_->at(sfReserveIncrementDrops);
243 }
244 return std::nullopt;
245 }
246
251 [[nodiscard]]
252 bool
254 {
255 return this->tx_->isFieldPresent(sfReserveIncrementDrops);
256 }
257
262 [[nodiscard]]
265 {
266 if (hasGasLimit())
267 {
268 return this->tx_->at(sfGasLimit);
269 }
270 return std::nullopt;
271 }
272
277 [[nodiscard]]
278 bool
280 {
281 return this->tx_->isFieldPresent(sfGasLimit);
282 }
283
288 [[nodiscard]]
291 {
293 {
294 return this->tx_->at(sfBytecodeSizeLimit);
295 }
296 return std::nullopt;
297 }
298
303 [[nodiscard]]
304 bool
306 {
307 return this->tx_->isFieldPresent(sfBytecodeSizeLimit);
308 }
309
314 [[nodiscard]]
317 {
318 if (hasGasPrice())
319 {
320 return this->tx_->at(sfGasPrice);
321 }
322 return std::nullopt;
323 }
324
329 [[nodiscard]]
330 bool
332 {
333 return this->tx_->isFieldPresent(sfGasPrice);
334 }
335};
336
344class SetFeeBuilder : public TransactionBuilderBase<SetFeeBuilder>
345{
346public:
353 SetFeeBuilder(SF_ACCOUNT::type::value_type account,
354 std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
356)
357 : TransactionBuilderBase<SetFeeBuilder>(ttFEE, account, sequence, fee)
358 {
359 }
360
367 {
368 if (tx->getTxnType() != ttFEE)
369 {
370 throw std::runtime_error("Invalid transaction type for SetFeeBuilder");
371 }
372 object_ = *tx;
373 }
374
378
385 {
386 object_[sfLedgerSequence] = value;
387 return *this;
388 }
389
396 {
397 object_[sfBaseFee] = value;
398 return *this;
399 }
400
407 {
408 object_[sfReferenceFeeUnits] = value;
409 return *this;
410 }
411
418 {
419 object_[sfReserveBase] = value;
420 return *this;
421 }
422
429 {
430 object_[sfReserveIncrement] = value;
431 return *this;
432 }
433
440 {
441 object_[sfBaseFeeDrops] = value;
442 return *this;
443 }
444
451 {
452 object_[sfReserveBaseDrops] = value;
453 return *this;
454 }
455
462 {
463 object_[sfReserveIncrementDrops] = value;
464 return *this;
465 }
466
473 {
474 object_[sfGasLimit] = value;
475 return *this;
476 }
477
484 {
485 object_[sfBytecodeSizeLimit] = value;
486 return *this;
487 }
488
495 {
496 object_[sfGasPrice] = value;
497 return *this;
498 }
499
506 SetFee
507 build(PublicKey const& publicKey, SecretKey const& secretKey)
508 {
509 sign(publicKey, secretKey);
510 return SetFee{std::make_shared<STTx>(std::move(object_))};
511 }
512};
513
514} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:53
A secret key.
Definition SecretKey.h:24
Builder for SetFee transactions.
Definition SetFee.h:345
SetFeeBuilder & setReserveIncrementDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfReserveIncrementDrops (SoeOptional).
Definition SetFee.h:461
SetFeeBuilder & setBaseFeeDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfBaseFeeDrops (SoeOptional).
Definition SetFee.h:439
SetFeeBuilder(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 SetFeeBuilder with required fields.
Definition SetFee.h:353
SetFeeBuilder & setReserveIncrement(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReserveIncrement (SoeOptional).
Definition SetFee.h:428
SetFeeBuilder(std::shared_ptr< STTx const > tx)
Construct a SetFeeBuilder from an existing STTx object.
Definition SetFee.h:366
SetFeeBuilder & setReserveBaseDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfReserveBaseDrops (SoeOptional).
Definition SetFee.h:450
SetFeeBuilder & setReserveBase(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReserveBase (SoeOptional).
Definition SetFee.h:417
SetFeeBuilder & setLedgerSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Transaction-specific field setters.
Definition SetFee.h:384
SetFeeBuilder & setGasPrice(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfGasPrice (SoeOptional).
Definition SetFee.h:494
SetFeeBuilder & setGasLimit(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfGasLimit (SoeOptional).
Definition SetFee.h:472
SetFeeBuilder & setReferenceFeeUnits(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReferenceFeeUnits (SoeOptional).
Definition SetFee.h:406
SetFeeBuilder & setBytecodeSizeLimit(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfBytecodeSizeLimit (SoeOptional).
Definition SetFee.h:483
SetFee build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the SetFee wrapper.
Definition SetFee.h:507
SetFeeBuilder & setBaseFee(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfBaseFee (SoeOptional).
Definition SetFee.h:395
Transaction: SetFee.
Definition SetFee.h:30
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getBaseFeeDrops() const
Get sfBaseFeeDrops (SoeOptional).
Definition SetFee.h:186
bool hasReserveIncrementDrops() const
Check if sfReserveIncrementDrops is present.
Definition SetFee.h:253
bool hasBytecodeSizeLimit() const
Check if sfBytecodeSizeLimit is present.
Definition SetFee.h:305
bool hasGasLimit() const
Check if sfGasLimit is present.
Definition SetFee.h:279
bool hasReserveBase() const
Check if sfReserveBase is present.
Definition SetFee.h:149
SetFee(std::shared_ptr< STTx const > tx)
Construct a SetFee transaction wrapper from an existing STTx object.
Definition SetFee.h:38
protocol_autogen::Optional< SF_UINT32::type::value_type > getReserveIncrement() const
Get sfReserveIncrement (SoeOptional).
Definition SetFee.h:160
protocol_autogen::Optional< SF_UINT32::type::value_type > getGasPrice() const
Get sfGasPrice (SoeOptional).
Definition SetFee.h:316
protocol_autogen::Optional< SF_UINT32::type::value_type > getBytecodeSizeLimit() const
Get sfBytecodeSizeLimit (SoeOptional).
Definition SetFee.h:290
protocol_autogen::Optional< SF_UINT32::type::value_type > getLedgerSequence() const
Get sfLedgerSequence (SoeOptional).
Definition SetFee.h:56
protocol_autogen::Optional< SF_UINT32::type::value_type > getGasLimit() const
Get sfGasLimit (SoeOptional).
Definition SetFee.h:264
bool hasReserveBaseDrops() const
Check if sfReserveBaseDrops is present.
Definition SetFee.h:227
protocol_autogen::Optional< SF_UINT32::type::value_type > getReserveBase() const
Get sfReserveBase (SoeOptional).
Definition SetFee.h:134
protocol_autogen::Optional< SF_UINT64::type::value_type > getBaseFee() const
Get sfBaseFee (SoeOptional).
Definition SetFee.h:82
bool hasReserveIncrement() const
Check if sfReserveIncrement is present.
Definition SetFee.h:175
bool hasBaseFeeDrops() const
Check if sfBaseFeeDrops is present.
Definition SetFee.h:201
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getReserveBaseDrops() const
Get sfReserveBaseDrops (SoeOptional).
Definition SetFee.h:212
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getReserveIncrementDrops() const
Get sfReserveIncrementDrops (SoeOptional).
Definition SetFee.h:238
protocol_autogen::Optional< SF_UINT32::type::value_type > getReferenceFeeUnits() const
Get sfReferenceFeeUnits (SoeOptional).
Definition SetFee.h:108
bool hasReferenceFeeUnits() const
Check if sfReferenceFeeUnits is present.
Definition SetFee.h:123
static constexpr xrpl::TxType txType
Definition SetFee.h:32
bool hasGasPrice() const
Check if sfGasPrice is present.
Definition SetFee.h:331
bool hasBaseFee() const
Check if sfBaseFee is present.
Definition SetFee.h:97
bool hasLedgerSequence() const
Check if sfLedgerSequence is present.
Definition SetFee.h:71
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.
SetFeeBuilder & 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