rippled
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};
258
266class SetFeeBuilder : public TransactionBuilderBase<SetFeeBuilder>
267{
268public:
275 SetFeeBuilder(SF_ACCOUNT::type::value_type account,
278)
279 : TransactionBuilderBase<SetFeeBuilder>(ttFEE, account, sequence, fee)
280 {
281 }
282
289 {
290 if (tx->getTxnType() != ttFEE)
291 {
292 throw std::runtime_error("Invalid transaction type for SetFeeBuilder");
293 }
294 object_ = *tx;
295 }
296
305 {
306 object_[sfLedgerSequence] = value;
307 return *this;
308 }
309
316 {
317 object_[sfBaseFee] = value;
318 return *this;
319 }
320
327 {
328 object_[sfReferenceFeeUnits] = value;
329 return *this;
330 }
331
338 {
339 object_[sfReserveBase] = value;
340 return *this;
341 }
342
349 {
350 object_[sfReserveIncrement] = value;
351 return *this;
352 }
353
360 {
361 object_[sfBaseFeeDrops] = value;
362 return *this;
363 }
364
371 {
372 object_[sfReserveBaseDrops] = value;
373 return *this;
374 }
375
382 {
383 object_[sfReserveIncrementDrops] = value;
384 return *this;
385 }
386
393 SetFee
394 build(PublicKey const& publicKey, SecretKey const& secretKey)
395 {
396 sign(publicKey, secretKey);
397 return SetFee{std::make_shared<STTx>(std::move(object_))};
398 }
399};
400
401} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
Builder for SetFee transactions.
Definition SetFee.h:267
SetFeeBuilder & setReserveIncrementDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfReserveIncrementDrops (soeOPTIONAL)
Definition SetFee.h:381
SetFeeBuilder & setBaseFeeDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfBaseFeeDrops (soeOPTIONAL)
Definition SetFee.h:359
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:275
SetFeeBuilder & setReserveIncrement(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReserveIncrement (soeOPTIONAL)
Definition SetFee.h:348
SetFeeBuilder(std::shared_ptr< STTx const > tx)
Construct a SetFeeBuilder from an existing STTx object.
Definition SetFee.h:288
SetFeeBuilder & setReserveBaseDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfReserveBaseDrops (soeOPTIONAL)
Definition SetFee.h:370
SetFeeBuilder & setReserveBase(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReserveBase (soeOPTIONAL)
Definition SetFee.h:337
SetFeeBuilder & setLedgerSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Transaction-specific field setters.
Definition SetFee.h:304
SetFeeBuilder & setReferenceFeeUnits(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReferenceFeeUnits (soeOPTIONAL)
Definition SetFee.h:326
SetFee build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the SetFee wrapper.
Definition SetFee.h:394
SetFeeBuilder & setBaseFee(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfBaseFee (soeOPTIONAL)
Definition SetFee.h:315
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 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 > getLedgerSequence() const
Get sfLedgerSequence (soeOPTIONAL)
Definition SetFee.h:56
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 hasBaseFee() const
Check if sfBaseFee is present.
Definition SetFee.h:97
bool hasLedgerSequence() const
Check if sfLedgerSequence is present.
Definition SetFee.h:71
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.
SetFeeBuilder & 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