xrpld
Loading...
Searching...
No Matches
FeeSettings.h
1// This file is auto-generated. Do not edit.
2#pragma once
3
4#include <xrpl/protocol/STLedgerEntry.h>
5#include <xrpl/protocol/STParsedJSON.h>
6#include <xrpl/protocol/jss.h>
7#include <xrpl/protocol_autogen/LedgerEntryBase.h>
8#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
9#include <xrpl/json/json_value.h>
10
11#include <stdexcept>
12#include <optional>
13
14namespace xrpl::ledger_entries {
15
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltFEE_SETTINGS;
31
37 : LedgerEntryBase(std::move(sle))
38 {
39 // Verify ledger entry type
40 if (sle_->getType() != entryType)
41 {
42 throw std::runtime_error("Invalid ledger entry type for FeeSettings");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
52 [[nodiscard]]
54 getBaseFee() const
55 {
56 if (hasBaseFee())
57 return this->sle_->at(sfBaseFee);
58 return std::nullopt;
59 }
60
65 [[nodiscard]]
66 bool
67 hasBaseFee() const
68 {
69 return this->sle_->isFieldPresent(sfBaseFee);
70 }
71
76 [[nodiscard]]
79 {
81 return this->sle_->at(sfReferenceFeeUnits);
82 return std::nullopt;
83 }
84
89 [[nodiscard]]
90 bool
92 {
93 return this->sle_->isFieldPresent(sfReferenceFeeUnits);
94 }
95
100 [[nodiscard]]
103 {
104 if (hasReserveBase())
105 return this->sle_->at(sfReserveBase);
106 return std::nullopt;
107 }
108
113 [[nodiscard]]
114 bool
116 {
117 return this->sle_->isFieldPresent(sfReserveBase);
118 }
119
124 [[nodiscard]]
127 {
129 return this->sle_->at(sfReserveIncrement);
130 return std::nullopt;
131 }
132
137 [[nodiscard]]
138 bool
140 {
141 return this->sle_->isFieldPresent(sfReserveIncrement);
142 }
143
148 [[nodiscard]]
151 {
152 if (hasBaseFeeDrops())
153 return this->sle_->at(sfBaseFeeDrops);
154 return std::nullopt;
155 }
156
161 [[nodiscard]]
162 bool
164 {
165 return this->sle_->isFieldPresent(sfBaseFeeDrops);
166 }
167
172 [[nodiscard]]
175 {
177 return this->sle_->at(sfReserveBaseDrops);
178 return std::nullopt;
179 }
180
185 [[nodiscard]]
186 bool
188 {
189 return this->sle_->isFieldPresent(sfReserveBaseDrops);
190 }
191
196 [[nodiscard]]
199 {
201 return this->sle_->at(sfReserveIncrementDrops);
202 return std::nullopt;
203 }
204
209 [[nodiscard]]
210 bool
212 {
213 return this->sle_->isFieldPresent(sfReserveIncrementDrops);
214 }
215
220 [[nodiscard]]
223 {
224 if (hasPreviousTxnID())
225 return this->sle_->at(sfPreviousTxnID);
226 return std::nullopt;
227 }
228
233 [[nodiscard]]
234 bool
236 {
237 return this->sle_->isFieldPresent(sfPreviousTxnID);
238 }
239
244 [[nodiscard]]
247 {
249 return this->sle_->at(sfPreviousTxnLgrSeq);
250 return std::nullopt;
251 }
252
257 [[nodiscard]]
258 bool
260 {
261 return this->sle_->isFieldPresent(sfPreviousTxnLgrSeq);
262 }
263};
264
272class FeeSettingsBuilder : public LedgerEntryBuilderBase<FeeSettingsBuilder>
273{
274public:
282
289 {
290 if (sle->at(sfLedgerEntryType) != ltFEE_SETTINGS)
291 {
292 throw std::runtime_error("Invalid ledger entry type for FeeSettings");
293 }
294 object_ = *sle;
295 }
296
298
305 {
306 object_[sfBaseFee] = value;
307 return *this;
308 }
309
316 {
317 object_[sfReferenceFeeUnits] = value;
318 return *this;
319 }
320
327 {
328 object_[sfReserveBase] = value;
329 return *this;
330 }
331
338 {
339 object_[sfReserveIncrement] = value;
340 return *this;
341 }
342
349 {
350 object_[sfBaseFeeDrops] = value;
351 return *this;
352 }
353
360 {
361 object_[sfReserveBaseDrops] = value;
362 return *this;
363 }
364
371 {
372 object_[sfReserveIncrementDrops] = value;
373 return *this;
374 }
375
382 {
383 object_[sfPreviousTxnID] = value;
384 return *this;
385 }
386
393 {
394 object_[sfPreviousTxnLgrSeq] = value;
395 return *this;
396 }
397
404 build(uint256 const& index)
405 {
406 return FeeSettings{std::make_shared<SLE>(std::move(object_), index)};
407 }
408};
409
410} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
Builder for FeeSettings ledger entries.
FeeSettingsBuilder & setReferenceFeeUnits(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReferenceFeeUnits (SoeOptional).
FeeSettingsBuilder()
Construct a new FeeSettingsBuilder with required fields.
FeeSettingsBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeOptional).
FeeSettingsBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeOptional).
FeeSettingsBuilder & setReserveBaseDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfReserveBaseDrops (SoeOptional).
FeeSettingsBuilder & setReserveBase(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReserveBase (SoeOptional).
FeeSettingsBuilder & setBaseFee(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Ledger entry-specific field setters.
FeeSettingsBuilder(SLE::const_pointer sle)
Construct a FeeSettingsBuilder from an existing SLE object.
FeeSettings build(uint256 const &index)
Build and return the completed FeeSettings wrapper.
FeeSettingsBuilder & setBaseFeeDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfBaseFeeDrops (SoeOptional).
FeeSettingsBuilder & setReserveIncrement(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfReserveIncrement (SoeOptional).
FeeSettingsBuilder & setReserveIncrementDrops(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfReserveIncrementDrops (SoeOptional).
Ledger Entry: FeeSettings.
Definition FeeSettings.h:28
bool hasReferenceFeeUnits() const
Check if sfReferenceFeeUnits is present.
Definition FeeSettings.h:91
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getReserveIncrementDrops() const
Get sfReserveIncrementDrops (SoeOptional).
bool hasReserveIncrementDrops() const
Check if sfReserveIncrementDrops is present.
static constexpr LedgerEntryType entryType
Definition FeeSettings.h:30
protocol_autogen::Optional< SF_UINT256::type::value_type > getPreviousTxnID() const
Get sfPreviousTxnID (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (SoeOptional).
bool hasReserveBase() const
Check if sfReserveBase is present.
bool hasBaseFee() const
Check if sfBaseFee is present.
Definition FeeSettings.h:67
protocol_autogen::Optional< SF_UINT32::type::value_type > getReserveBase() const
Get sfReserveBase (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getReserveIncrement() const
Get sfReserveIncrement (SoeOptional).
FeeSettings(SLE::const_pointer sle)
Construct a FeeSettings ledger entry wrapper from an existing SLE object.
Definition FeeSettings.h:36
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getReserveBaseDrops() const
Get sfReserveBaseDrops (SoeOptional).
bool hasPreviousTxnLgrSeq() const
Check if sfPreviousTxnLgrSeq is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getReferenceFeeUnits() const
Get sfReferenceFeeUnits (SoeOptional).
Definition FeeSettings.h:78
bool hasReserveIncrement() const
Check if sfReserveIncrement is present.
bool hasReserveBaseDrops() const
Check if sfReserveBaseDrops is present.
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getBaseFeeDrops() const
Get sfBaseFeeDrops (SoeOptional).
protocol_autogen::Optional< SF_UINT64::type::value_type > getBaseFee() const
Get sfBaseFee (SoeOptional).
Definition FeeSettings.h:54
bool hasBaseFeeDrops() const
Check if sfBaseFeeDrops is present.
bool hasPreviousTxnID() const
Check if sfPreviousTxnID is present.
LedgerEntryBase(SLE::const_pointer sle)
Construct a ledger entry wrapper from an existing SLE object.
SLE::const_pointer sle_
The underlying serialized ledger entry being wrapped.
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
LedgerEntryType
Identifiers for on-ledger objects.
BaseUInt< 256 > uint256
Definition base_uint.h:562