xrpld
Loading...
Searching...
No Matches
NegativeUNL.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 = ltNEGATIVE_UNL;
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 NegativeUNL");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
53 [[nodiscard]]
56 {
57 if (this->sle_->isFieldPresent(sfDisabledValidators))
58 return this->sle_->getFieldArray(sfDisabledValidators);
59 return std::nullopt;
60 }
61
66 [[nodiscard]]
67 bool
69 {
70 return this->sle_->isFieldPresent(sfDisabledValidators);
71 }
72
77 [[nodiscard]]
80 {
82 return this->sle_->at(sfValidatorToDisable);
83 return std::nullopt;
84 }
85
90 [[nodiscard]]
91 bool
93 {
94 return this->sle_->isFieldPresent(sfValidatorToDisable);
95 }
96
101 [[nodiscard]]
104 {
106 return this->sle_->at(sfValidatorToReEnable);
107 return std::nullopt;
108 }
109
114 [[nodiscard]]
115 bool
117 {
118 return this->sle_->isFieldPresent(sfValidatorToReEnable);
119 }
120
125 [[nodiscard]]
128 {
129 if (hasPreviousTxnID())
130 return this->sle_->at(sfPreviousTxnID);
131 return std::nullopt;
132 }
133
138 [[nodiscard]]
139 bool
141 {
142 return this->sle_->isFieldPresent(sfPreviousTxnID);
143 }
144
149 [[nodiscard]]
152 {
154 return this->sle_->at(sfPreviousTxnLgrSeq);
155 return std::nullopt;
156 }
157
162 [[nodiscard]]
163 bool
165 {
166 return this->sle_->isFieldPresent(sfPreviousTxnLgrSeq);
167 }
168};
169
177class NegativeUNLBuilder : public LedgerEntryBuilderBase<NegativeUNLBuilder>
178{
179public:
187
194 {
195 if (sle->at(sfLedgerEntryType) != ltNEGATIVE_UNL)
196 {
197 throw std::runtime_error("Invalid ledger entry type for NegativeUNL");
198 }
199 object_ = *sle;
200 }
201
203
210 {
211 object_.setFieldArray(sfDisabledValidators, value);
212 return *this;
213 }
214
221 {
222 object_[sfValidatorToDisable] = value;
223 return *this;
224 }
225
232 {
233 object_[sfValidatorToReEnable] = value;
234 return *this;
235 }
236
243 {
244 object_[sfPreviousTxnID] = value;
245 return *this;
246 }
247
254 {
255 object_[sfPreviousTxnLgrSeq] = value;
256 return *this;
257 }
258
265 build(uint256 const& index)
266 {
267 return NegativeUNL{std::make_shared<SLE>(std::move(object_), index)};
268 }
269};
270
271} // namespace xrpl::ledger_entries
std::shared_ptr< STLedgerEntry const > const_pointer
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.
Builder for NegativeUNL ledger entries.
NegativeUNLBuilder()
Construct a new NegativeUNLBuilder with required fields.
NegativeUNLBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (SoeOptional).
NegativeUNLBuilder & setValidatorToDisable(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfValidatorToDisable (SoeOptional).
NegativeUNLBuilder & setDisabledValidators(STArray const &value)
Ledger entry-specific field setters.
NegativeUNLBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (SoeOptional).
NegativeUNLBuilder & setValidatorToReEnable(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfValidatorToReEnable (SoeOptional).
NegativeUNLBuilder(SLE::const_pointer sle)
Construct a NegativeUNLBuilder from an existing SLE object.
NegativeUNL build(uint256 const &index)
Build and return the completed NegativeUNL wrapper.
Ledger Entry: NegativeUNL.
Definition NegativeUNL.h:28
protocol_autogen::Optional< SF_UINT256::type::value_type > getPreviousTxnID() const
Get sfPreviousTxnID (SoeOptional).
protocol_autogen::Optional< SF_VL::type::value_type > getValidatorToDisable() const
Get sfValidatorToDisable (SoeOptional).
Definition NegativeUNL.h:79
bool hasDisabledValidators() const
Check if sfDisabledValidators is present.
Definition NegativeUNL.h:68
bool hasPreviousTxnLgrSeq() const
Check if sfPreviousTxnLgrSeq is present.
bool hasValidatorToDisable() const
Check if sfValidatorToDisable is present.
Definition NegativeUNL.h:92
std::optional< std::reference_wrapper< STArray const > > getDisabledValidators() const
Get sfDisabledValidators (SoeOptional).
Definition NegativeUNL.h:55
bool hasPreviousTxnID() const
Check if sfPreviousTxnID is present.
NegativeUNL(SLE::const_pointer sle)
Construct a NegativeUNL ledger entry wrapper from an existing SLE object.
Definition NegativeUNL.h:36
protocol_autogen::Optional< SF_VL::type::value_type > getValidatorToReEnable() const
Get sfValidatorToReEnable (SoeOptional).
static constexpr LedgerEntryType entryType
Definition NegativeUNL.h:30
protocol_autogen::Optional< SF_UINT32::type::value_type > getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (SoeOptional).
bool hasValidatorToReEnable() const
Check if sfValidatorToReEnable is present.
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