rippled
Loading...
Searching...
No Matches
PayChannel.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 PayChannelBuilder;
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltPAYCHAN;
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 PayChannel");
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]]
77 {
78 if (hasSequence())
79 return this->sle_->at(sfSequence);
80 return std::nullopt;
81 }
82
87 [[nodiscard]]
88 bool
90 {
91 return this->sle_->isFieldPresent(sfSequence);
92 }
93
98 [[nodiscard]]
99 SF_AMOUNT::type::value_type
100 getAmount() const
101 {
102 return this->sle_->at(sfAmount);
103 }
104
109 [[nodiscard]]
110 SF_AMOUNT::type::value_type
112 {
113 return this->sle_->at(sfBalance);
114 }
115
120 [[nodiscard]]
121 SF_VL::type::value_type
123 {
124 return this->sle_->at(sfPublicKey);
125 }
126
131 [[nodiscard]]
132 SF_UINT32::type::value_type
134 {
135 return this->sle_->at(sfSettleDelay);
136 }
137
142 [[nodiscard]]
145 {
146 if (hasExpiration())
147 return this->sle_->at(sfExpiration);
148 return std::nullopt;
149 }
150
155 [[nodiscard]]
156 bool
158 {
159 return this->sle_->isFieldPresent(sfExpiration);
160 }
161
166 [[nodiscard]]
169 {
170 if (hasCancelAfter())
171 return this->sle_->at(sfCancelAfter);
172 return std::nullopt;
173 }
174
179 [[nodiscard]]
180 bool
182 {
183 return this->sle_->isFieldPresent(sfCancelAfter);
184 }
185
190 [[nodiscard]]
193 {
194 if (hasSourceTag())
195 return this->sle_->at(sfSourceTag);
196 return std::nullopt;
197 }
198
203 [[nodiscard]]
204 bool
206 {
207 return this->sle_->isFieldPresent(sfSourceTag);
208 }
209
214 [[nodiscard]]
217 {
218 if (hasDestinationTag())
219 return this->sle_->at(sfDestinationTag);
220 return std::nullopt;
221 }
222
227 [[nodiscard]]
228 bool
230 {
231 return this->sle_->isFieldPresent(sfDestinationTag);
232 }
233
238 [[nodiscard]]
239 SF_UINT64::type::value_type
241 {
242 return this->sle_->at(sfOwnerNode);
243 }
244
249 [[nodiscard]]
250 SF_UINT256::type::value_type
252 {
253 return this->sle_->at(sfPreviousTxnID);
254 }
255
260 [[nodiscard]]
261 SF_UINT32::type::value_type
263 {
264 return this->sle_->at(sfPreviousTxnLgrSeq);
265 }
266
271 [[nodiscard]]
274 {
275 if (hasDestinationNode())
276 return this->sle_->at(sfDestinationNode);
277 return std::nullopt;
278 }
279
284 [[nodiscard]]
285 bool
287 {
288 return this->sle_->isFieldPresent(sfDestinationNode);
289 }
290};
291
299class PayChannelBuilder : public LedgerEntryBuilderBase<PayChannelBuilder>
300{
301public:
327
334 {
335 if (sle->at(sfLedgerEntryType) != ltPAYCHAN)
336 {
337 throw std::runtime_error("Invalid ledger entry type for PayChannel");
338 }
339 object_ = *sle;
340 }
341
350 {
351 object_[sfAccount] = value;
352 return *this;
353 }
354
361 {
362 object_[sfDestination] = value;
363 return *this;
364 }
365
372 {
373 object_[sfSequence] = value;
374 return *this;
375 }
376
383 {
384 object_[sfAmount] = value;
385 return *this;
386 }
387
394 {
395 object_[sfBalance] = value;
396 return *this;
397 }
398
405 {
406 object_[sfPublicKey] = value;
407 return *this;
408 }
409
416 {
417 object_[sfSettleDelay] = value;
418 return *this;
419 }
420
427 {
428 object_[sfExpiration] = value;
429 return *this;
430 }
431
438 {
439 object_[sfCancelAfter] = value;
440 return *this;
441 }
442
449 {
450 object_[sfSourceTag] = value;
451 return *this;
452 }
453
460 {
461 object_[sfDestinationTag] = value;
462 return *this;
463 }
464
471 {
472 object_[sfOwnerNode] = value;
473 return *this;
474 }
475
482 {
483 object_[sfPreviousTxnID] = value;
484 return *this;
485 }
486
493 {
494 object_[sfPreviousTxnLgrSeq] = value;
495 return *this;
496 }
497
504 {
505 object_[sfDestinationNode] = value;
506 return *this;
507 }
508
515 build(uint256 const& index)
516 {
517 return PayChannel{std::make_shared<SLE>(std::move(object_), index)};
518 }
519};
520
521} // namespace xrpl::ledger_entries
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.
Builder for PayChannel ledger entries.
Definition PayChannel.h:300
PayChannelBuilder & setBalance(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfBalance (soeREQUIRED)
Definition PayChannel.h:393
PayChannelBuilder(std::shared_ptr< SLE const > sle)
Construct a PayChannelBuilder from an existing SLE object.
Definition PayChannel.h:333
PayChannel build(uint256 const &index)
Build and return the completed PayChannel wrapper.
Definition PayChannel.h:515
PayChannelBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (soeOPTIONAL)
Definition PayChannel.h:459
PayChannelBuilder & setSourceTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSourceTag (soeOPTIONAL)
Definition PayChannel.h:448
PayChannelBuilder & setSequence(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSequence (soeOPTIONAL)
Definition PayChannel.h:371
PayChannelBuilder & setCancelAfter(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCancelAfter (soeOPTIONAL)
Definition PayChannel.h:437
PayChannelBuilder & setExpiration(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfExpiration (soeOPTIONAL)
Definition PayChannel.h:426
PayChannelBuilder & setDestinationNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfDestinationNode (soeOPTIONAL)
Definition PayChannel.h:503
PayChannelBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition PayChannel.h:349
PayChannelBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (soeREQUIRED)
Definition PayChannel.h:481
PayChannelBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeREQUIRED)
Definition PayChannel.h:360
PayChannelBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (soeREQUIRED)
Definition PayChannel.h:492
PayChannelBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (soeREQUIRED)
Definition PayChannel.h:470
PayChannelBuilder & setPublicKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfPublicKey (soeREQUIRED)
Definition PayChannel.h:404
PayChannelBuilder & setSettleDelay(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfSettleDelay (soeREQUIRED)
Definition PayChannel.h:415
PayChannelBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (soeREQUIRED)
Definition PayChannel.h:382
PayChannelBuilder(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 &amount, std::decay_t< typename SF_AMOUNT::type::value_type > const &balance, std::decay_t< typename SF_VL::type::value_type > const &publicKey, std::decay_t< typename SF_UINT32::type::value_type > const &settleDelay, std::decay_t< typename SF_UINT64::type::value_type > const &ownerNode, 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 PayChannelBuilder with required fields.
Definition PayChannel.h:314
Ledger Entry: PayChannel.
Definition PayChannel.h:28
SF_VL::type::value_type getPublicKey() const
Get sfPublicKey (soeREQUIRED)
Definition PayChannel.h:122
PayChannel(std::shared_ptr< SLE const > sle)
Construct a PayChannel ledger entry wrapper from an existing SLE object.
Definition PayChannel.h:36
SF_UINT32::type::value_type getSettleDelay() const
Get sfSettleDelay (soeREQUIRED)
Definition PayChannel.h:133
bool hasExpiration() const
Check if sfExpiration is present.
Definition PayChannel.h:157
bool hasDestinationNode() const
Check if sfDestinationNode is present.
Definition PayChannel.h:286
bool hasSequence() const
Check if sfSequence is present.
Definition PayChannel.h:89
SF_ACCOUNT::type::value_type getDestination() const
Get sfDestination (soeREQUIRED)
Definition PayChannel.h:65
protocol_autogen::Optional< SF_UINT32::type::value_type > getDestinationTag() const
Get sfDestinationTag (soeOPTIONAL)
Definition PayChannel.h:216
protocol_autogen::Optional< SF_UINT64::type::value_type > getDestinationNode() const
Get sfDestinationNode (soeOPTIONAL)
Definition PayChannel.h:273
bool hasSourceTag() const
Check if sfSourceTag is present.
Definition PayChannel.h:205
protocol_autogen::Optional< SF_UINT32::type::value_type > getSequence() const
Get sfSequence (soeOPTIONAL)
Definition PayChannel.h:76
SF_AMOUNT::type::value_type getBalance() const
Get sfBalance (soeREQUIRED)
Definition PayChannel.h:111
SF_AMOUNT::type::value_type getAmount() const
Get sfAmount (soeREQUIRED)
Definition PayChannel.h:100
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (soeREQUIRED)
Definition PayChannel.h:262
static constexpr LedgerEntryType entryType
Definition PayChannel.h:30
protocol_autogen::Optional< SF_UINT32::type::value_type > getSourceTag() const
Get sfSourceTag (soeOPTIONAL)
Definition PayChannel.h:192
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (soeREQUIRED)
Definition PayChannel.h:240
protocol_autogen::Optional< SF_UINT32::type::value_type > getCancelAfter() const
Get sfCancelAfter (soeOPTIONAL)
Definition PayChannel.h:168
protocol_autogen::Optional< SF_UINT32::type::value_type > getExpiration() const
Get sfExpiration (soeOPTIONAL)
Definition PayChannel.h:144
bool hasCancelAfter() const
Check if sfCancelAfter is present.
Definition PayChannel.h:181
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (soeREQUIRED)
Definition PayChannel.h:54
bool hasDestinationTag() const
Check if sfDestinationTag is present.
Definition PayChannel.h:229
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (soeREQUIRED)
Definition PayChannel.h:251
T is_same_v
STL namespace.
LedgerEntryType
Identifiers for on-ledger objects.