rippled
Loading...
Searching...
No Matches
Check.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
16class CheckBuilder;
17
27class Check : public LedgerEntryBase
28{
29public:
30 static constexpr LedgerEntryType entryType = ltCHECK;
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 Check");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
52 [[nodiscard]]
53 SF_ACCOUNT::type::value_type
54 getAccount() const
55 {
56 return this->sle_->at(sfAccount);
57 }
58
63 [[nodiscard]]
64 SF_ACCOUNT::type::value_type
66 {
67 return this->sle_->at(sfDestination);
68 }
69
74 [[nodiscard]]
75 SF_AMOUNT::type::value_type
76 getSendMax() const
77 {
78 return this->sle_->at(sfSendMax);
79 }
80
85 [[nodiscard]]
86 SF_UINT32::type::value_type
88 {
89 return this->sle_->at(sfSequence);
90 }
91
96 [[nodiscard]]
97 SF_UINT64::type::value_type
99 {
100 return this->sle_->at(sfOwnerNode);
101 }
102
107 [[nodiscard]]
108 SF_UINT64::type::value_type
110 {
111 return this->sle_->at(sfDestinationNode);
112 }
113
118 [[nodiscard]]
121 {
122 if (hasExpiration())
123 return this->sle_->at(sfExpiration);
124 return std::nullopt;
125 }
126
131 [[nodiscard]]
132 bool
134 {
135 return this->sle_->isFieldPresent(sfExpiration);
136 }
137
142 [[nodiscard]]
145 {
146 if (hasInvoiceID())
147 return this->sle_->at(sfInvoiceID);
148 return std::nullopt;
149 }
150
155 [[nodiscard]]
156 bool
158 {
159 return this->sle_->isFieldPresent(sfInvoiceID);
160 }
161
166 [[nodiscard]]
169 {
170 if (hasSourceTag())
171 return this->sle_->at(sfSourceTag);
172 return std::nullopt;
173 }
174
179 [[nodiscard]]
180 bool
182 {
183 return this->sle_->isFieldPresent(sfSourceTag);
184 }
185
190 [[nodiscard]]
193 {
194 if (hasDestinationTag())
195 return this->sle_->at(sfDestinationTag);
196 return std::nullopt;
197 }
198
203 [[nodiscard]]
204 bool
206 {
207 return this->sle_->isFieldPresent(sfDestinationTag);
208 }
209
214 [[nodiscard]]
215 SF_UINT256::type::value_type
217 {
218 return this->sle_->at(sfPreviousTxnID);
219 }
220
225 [[nodiscard]]
226 SF_UINT32::type::value_type
228 {
229 return this->sle_->at(sfPreviousTxnLgrSeq);
230 }
231};
232
240class CheckBuilder : public LedgerEntryBuilderBase<CheckBuilder>
241{
242public:
266
273 {
274 if (sle->at(sfLedgerEntryType) != ltCHECK)
275 {
276 throw std::runtime_error("Invalid ledger entry type for Check");
277 }
278 object_ = *sle;
279 }
280
289 {
290 object_[sfAccount] = value;
291 return *this;
292 }
293
300 {
301 object_[sfDestination] = value;
302 return *this;
303 }
304
311 {
312 object_[sfSendMax] = value;
313 return *this;
314 }
315
322 {
323 object_[sfSequence] = value;
324 return *this;
325 }
326
333 {
334 object_[sfOwnerNode] = value;
335 return *this;
336 }
337
344 {
345 object_[sfDestinationNode] = value;
346 return *this;
347 }
348
355 {
356 object_[sfExpiration] = value;
357 return *this;
358 }
359
366 {
367 object_[sfInvoiceID] = value;
368 return *this;
369 }
370
377 {
378 object_[sfSourceTag] = value;
379 return *this;
380 }
381
388 {
389 object_[sfDestinationTag] = value;
390 return *this;
391 }
392
399 {
400 object_[sfPreviousTxnID] = value;
401 return *this;
402 }
403
410 {
411 object_[sfPreviousTxnLgrSeq] = value;
412 return *this;
413 }
414
420 Check
421 build(uint256 const& index)
422 {
423 return Check{std::make_shared<SLE>(std::move(object_), index)};
424 }
425};
426
427} // namespace xrpl::ledger_entries
Builder for Check ledger entries.
Definition Check.h:241
CheckBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeREQUIRED)
Definition Check.h:299
CheckBuilder & setDestinationNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfDestinationNode (soeREQUIRED)
Definition Check.h:343
CheckBuilder & setSourceTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSourceTag (soeOPTIONAL)
Definition Check.h:376
CheckBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (soeREQUIRED)
Definition Check.h:332
CheckBuilder & setSendMax(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfSendMax (soeREQUIRED)
Definition Check.h:310
CheckBuilder(std::decay_t< typename SF_ACCOUNT::type::value_type > const &account, std::decay_t< typename SF_ACCOUNT::type::value_type > const &destination, std::decay_t< typename SF_AMOUNT::type::value_type > const &sendMax, std::decay_t< typename SF_UINT32::type::value_type > const &sequence, std::decay_t< typename SF_UINT64::type::value_type > const &ownerNode, std::decay_t< typename SF_UINT64::type::value_type > const &destinationNode, std::decay_t< typename SF_UINT256::type::value_type > const &previousTxnID, std::decay_t< typename SF_UINT32::type::value_type > const &previousTxnLgrSeq)
Construct a new CheckBuilder with required fields.
Definition Check.h:254
CheckBuilder(std::shared_ptr< SLE const > sle)
Construct a CheckBuilder from an existing SLE object.
Definition Check.h:272
CheckBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (soeREQUIRED)
Definition Check.h:409
CheckBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (soeREQUIRED)
Definition Check.h:321
CheckBuilder & setExpiration(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfExpiration (soeOPTIONAL)
Definition Check.h:354
CheckBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (soeREQUIRED)
Definition Check.h:398
Check build(uint256 const &index)
Build and return the completed Check wrapper.
Definition Check.h:421
CheckBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition Check.h:288
CheckBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (soeOPTIONAL)
Definition Check.h:387
CheckBuilder & setInvoiceID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfInvoiceID (soeOPTIONAL)
Definition Check.h:365
Ledger Entry: Check.
Definition Check.h:28
SF_ACCOUNT::type::value_type getDestination() const
Get sfDestination (soeREQUIRED)
Definition Check.h:65
bool hasInvoiceID() const
Check if sfInvoiceID is present.
Definition Check.h:157
SF_UINT32::type::value_type getSequence() const
Get sfSequence (soeREQUIRED)
Definition Check.h:87
bool hasSourceTag() const
Check if sfSourceTag is present.
Definition Check.h:181
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (soeREQUIRED)
Definition Check.h:216
protocol_autogen::Optional< SF_UINT32::type::value_type > getExpiration() const
Get sfExpiration (soeOPTIONAL)
Definition Check.h:120
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (soeREQUIRED)
Definition Check.h:98
Check(std::shared_ptr< SLE const > sle)
Construct a Check ledger entry wrapper from an existing SLE object.
Definition Check.h:36
protocol_autogen::Optional< SF_UINT256::type::value_type > getInvoiceID() const
Get sfInvoiceID (soeOPTIONAL)
Definition Check.h:144
bool hasDestinationTag() const
Check if sfDestinationTag is present.
Definition Check.h:205
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (soeREQUIRED)
Definition Check.h:227
static constexpr LedgerEntryType entryType
Definition Check.h:30
protocol_autogen::Optional< SF_UINT32::type::value_type > getSourceTag() const
Get sfSourceTag (soeOPTIONAL)
Definition Check.h:168
protocol_autogen::Optional< SF_UINT32::type::value_type > getDestinationTag() const
Get sfDestinationTag (soeOPTIONAL)
Definition Check.h:192
SF_AMOUNT::type::value_type getSendMax() const
Get sfSendMax (soeREQUIRED)
Definition Check.h:76
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (soeREQUIRED)
Definition Check.h:54
SF_UINT64::type::value_type getDestinationNode() const
Get sfDestinationNode (soeREQUIRED)
Definition Check.h:109
bool hasExpiration() const
Check if sfExpiration is present.
Definition Check.h:133
Base class for type-safe ledger entry wrappers.
std::shared_ptr< SLE const > sle_
The underlying serialized ledger entry being wrapped.
Base class for all ledger entry builders.
T is_same_v
STL namespace.
LedgerEntryType
Identifiers for on-ledger objects.