rippled
Loading...
Searching...
No Matches
Bridge.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 BridgeBuilder;
17
27class Bridge : public LedgerEntryBase
28{
29public:
30 static constexpr LedgerEntryType entryType = ltBRIDGE;
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 Bridge");
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_AMOUNT::type::value_type
66 {
67 return this->sle_->at(sfSignatureReward);
68 }
69
74 [[nodiscard]]
77 {
79 return this->sle_->at(sfMinAccountCreateAmount);
80 return std::nullopt;
81 }
82
87 [[nodiscard]]
88 bool
90 {
91 return this->sle_->isFieldPresent(sfMinAccountCreateAmount);
92 }
93
98 [[nodiscard]]
99 SF_XCHAIN_BRIDGE::type::value_type
101 {
102 return this->sle_->at(sfXChainBridge);
103 }
104
109 [[nodiscard]]
110 SF_UINT64::type::value_type
112 {
113 return this->sle_->at(sfXChainClaimID);
114 }
115
120 [[nodiscard]]
121 SF_UINT64::type::value_type
123 {
124 return this->sle_->at(sfXChainAccountCreateCount);
125 }
126
131 [[nodiscard]]
132 SF_UINT64::type::value_type
134 {
135 return this->sle_->at(sfXChainAccountClaimCount);
136 }
137
142 [[nodiscard]]
143 SF_UINT64::type::value_type
145 {
146 return this->sle_->at(sfOwnerNode);
147 }
148
153 [[nodiscard]]
154 SF_UINT256::type::value_type
156 {
157 return this->sle_->at(sfPreviousTxnID);
158 }
159
164 [[nodiscard]]
165 SF_UINT32::type::value_type
167 {
168 return this->sle_->at(sfPreviousTxnLgrSeq);
169 }
170};
171
179class BridgeBuilder : public LedgerEntryBuilderBase<BridgeBuilder>
180{
181public:
196 {
197 setAccount(account);
198 setSignatureReward(signatureReward);
199 setXChainBridge(xChainBridge);
200 setXChainClaimID(xChainClaimID);
201 setXChainAccountCreateCount(xChainAccountCreateCount);
202 setXChainAccountClaimCount(xChainAccountClaimCount);
203 setOwnerNode(ownerNode);
204 setPreviousTxnID(previousTxnID);
205 setPreviousTxnLgrSeq(previousTxnLgrSeq);
206 }
207
214 {
215 if (sle->at(sfLedgerEntryType) != ltBRIDGE)
216 {
217 throw std::runtime_error("Invalid ledger entry type for Bridge");
218 }
219 object_ = *sle;
220 }
221
230 {
231 object_[sfAccount] = value;
232 return *this;
233 }
234
241 {
242 object_[sfSignatureReward] = value;
243 return *this;
244 }
245
252 {
253 object_[sfMinAccountCreateAmount] = value;
254 return *this;
255 }
256
263 {
264 object_[sfXChainBridge] = value;
265 return *this;
266 }
267
274 {
275 object_[sfXChainClaimID] = value;
276 return *this;
277 }
278
285 {
286 object_[sfXChainAccountCreateCount] = value;
287 return *this;
288 }
289
296 {
297 object_[sfXChainAccountClaimCount] = value;
298 return *this;
299 }
300
307 {
308 object_[sfOwnerNode] = value;
309 return *this;
310 }
311
318 {
319 object_[sfPreviousTxnID] = value;
320 return *this;
321 }
322
329 {
330 object_[sfPreviousTxnLgrSeq] = value;
331 return *this;
332 }
333
339 Bridge
340 build(uint256 const& index)
341 {
342 return Bridge{std::make_shared<SLE>(std::move(object_), index)};
343 }
344};
345
346} // namespace xrpl::ledger_entries
Builder for Bridge ledger entries.
Definition Bridge.h:180
BridgeBuilder(std::shared_ptr< SLE const > sle)
Construct a BridgeBuilder from an existing SLE object.
Definition Bridge.h:213
BridgeBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (soeREQUIRED)
Definition Bridge.h:317
BridgeBuilder & setXChainClaimID(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfXChainClaimID (soeREQUIRED)
Definition Bridge.h:273
Bridge build(uint256 const &index)
Build and return the completed Bridge wrapper.
Definition Bridge.h:340
BridgeBuilder & setMinAccountCreateAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfMinAccountCreateAmount (soeOPTIONAL)
Definition Bridge.h:251
BridgeBuilder & setXChainBridge(std::decay_t< typename SF_XCHAIN_BRIDGE::type::value_type > const &value)
Set sfXChainBridge (soeREQUIRED)
Definition Bridge.h:262
BridgeBuilder & setAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
Definition Bridge.h:229
BridgeBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (soeREQUIRED)
Definition Bridge.h:306
BridgeBuilder & setSignatureReward(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfSignatureReward (soeREQUIRED)
Definition Bridge.h:240
BridgeBuilder & setXChainAccountCreateCount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfXChainAccountCreateCount (soeREQUIRED)
Definition Bridge.h:284
BridgeBuilder(std::decay_t< typename SF_ACCOUNT::type::value_type > const &account, std::decay_t< typename SF_AMOUNT::type::value_type > const &signatureReward, std::decay_t< typename SF_XCHAIN_BRIDGE::type::value_type > const &xChainBridge, std::decay_t< typename SF_UINT64::type::value_type > const &xChainClaimID, std::decay_t< typename SF_UINT64::type::value_type > const &xChainAccountCreateCount, std::decay_t< typename SF_UINT64::type::value_type > const &xChainAccountClaimCount, 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 BridgeBuilder with required fields.
Definition Bridge.h:194
BridgeBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (soeREQUIRED)
Definition Bridge.h:328
BridgeBuilder & setXChainAccountClaimCount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfXChainAccountClaimCount (soeREQUIRED)
Definition Bridge.h:295
Ledger Entry: Bridge.
Definition Bridge.h:28
Bridge(std::shared_ptr< SLE const > sle)
Construct a Bridge ledger entry wrapper from an existing SLE object.
Definition Bridge.h:36
SF_UINT64::type::value_type getXChainAccountCreateCount() const
Get sfXChainAccountCreateCount (soeREQUIRED)
Definition Bridge.h:122
SF_UINT64::type::value_type getXChainClaimID() const
Get sfXChainClaimID (soeREQUIRED)
Definition Bridge.h:111
bool hasMinAccountCreateAmount() const
Check if sfMinAccountCreateAmount is present.
Definition Bridge.h:89
SF_UINT64::type::value_type getXChainAccountClaimCount() const
Get sfXChainAccountClaimCount (soeREQUIRED)
Definition Bridge.h:133
static constexpr LedgerEntryType entryType
Definition Bridge.h:30
SF_XCHAIN_BRIDGE::type::value_type getXChainBridge() const
Get sfXChainBridge (soeREQUIRED)
Definition Bridge.h:100
SF_ACCOUNT::type::value_type getAccount() const
Get sfAccount (soeREQUIRED)
Definition Bridge.h:54
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getMinAccountCreateAmount() const
Get sfMinAccountCreateAmount (soeOPTIONAL)
Definition Bridge.h:76
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (soeREQUIRED)
Definition Bridge.h:144
SF_AMOUNT::type::value_type getSignatureReward() const
Get sfSignatureReward (soeREQUIRED)
Definition Bridge.h:65
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (soeREQUIRED)
Definition Bridge.h:166
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (soeREQUIRED)
Definition Bridge.h:155
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.