xrpld
Loading...
Searching...
No Matches
protocol_autogen/transactions/LoanBrokerSet.h
1// This file is auto-generated. Do not edit.
2#pragma once
3
4#include <xrpl/protocol/STTx.h>
5#include <xrpl/protocol/STParsedJSON.h>
6#include <xrpl/protocol/jss.h>
7#include <xrpl/protocol_autogen/TransactionBase.h>
8#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
9#include <xrpl/json/json_value.h>
10
11#include <stdexcept>
12#include <optional>
13
14namespace xrpl::transactions {
15
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttLOAN_BROKER_SET;
33
39 : TransactionBase(std::move(tx))
40 {
41 // Verify transaction type
42 if (tx_->getTxnType() != txType)
43 {
44 throw std::runtime_error("Invalid transaction type for LoanBrokerSet");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
55 SF_UINT256::type::value_type
56 getVaultID() const
57 {
58 return this->tx_->at(sfVaultID);
59 }
60
65 [[nodiscard]]
68 {
69 if (hasLoanBrokerID())
70 {
71 return this->tx_->at(sfLoanBrokerID);
72 }
73 return std::nullopt;
74 }
75
80 [[nodiscard]]
81 bool
83 {
84 return this->tx_->isFieldPresent(sfLoanBrokerID);
85 }
86
91 [[nodiscard]]
93 getData() const
94 {
95 if (hasData())
96 {
97 return this->tx_->at(sfData);
98 }
99 return std::nullopt;
100 }
101
106 [[nodiscard]]
107 bool
108 hasData() const
109 {
110 return this->tx_->isFieldPresent(sfData);
111 }
112
117 [[nodiscard]]
120 {
122 {
123 return this->tx_->at(sfManagementFeeRate);
124 }
125 return std::nullopt;
126 }
127
132 [[nodiscard]]
133 bool
135 {
136 return this->tx_->isFieldPresent(sfManagementFeeRate);
137 }
138
143 [[nodiscard]]
146 {
147 if (hasDebtMaximum())
148 {
149 return this->tx_->at(sfDebtMaximum);
150 }
151 return std::nullopt;
152 }
153
158 [[nodiscard]]
159 bool
161 {
162 return this->tx_->isFieldPresent(sfDebtMaximum);
163 }
164
169 [[nodiscard]]
172 {
174 {
175 return this->tx_->at(sfCoverRateMinimum);
176 }
177 return std::nullopt;
178 }
179
184 [[nodiscard]]
185 bool
187 {
188 return this->tx_->isFieldPresent(sfCoverRateMinimum);
189 }
190
195 [[nodiscard]]
198 {
200 {
201 return this->tx_->at(sfCoverRateLiquidation);
202 }
203 return std::nullopt;
204 }
205
210 [[nodiscard]]
211 bool
213 {
214 return this->tx_->isFieldPresent(sfCoverRateLiquidation);
215 }
216
221 [[nodiscard]]
224 {
225 if (hasDomainID())
226 {
227 return this->tx_->at(sfDomainID);
228 }
229 return std::nullopt;
230 }
231
236 [[nodiscard]]
237 bool
239 {
240 return this->tx_->isFieldPresent(sfDomainID);
241 }
242};
243
251class LoanBrokerSetBuilder : public TransactionBuilderBase<LoanBrokerSetBuilder>
252{
253public:
261 LoanBrokerSetBuilder(SF_ACCOUNT::type::value_type account,
264)
265 : TransactionBuilderBase<LoanBrokerSetBuilder>(ttLOAN_BROKER_SET, account, sequence, fee)
266 {
267 setVaultID(vaultID);
268 }
269
276 {
277 if (tx->getTxnType() != ttLOAN_BROKER_SET)
278 {
279 throw std::runtime_error("Invalid transaction type for LoanBrokerSetBuilder");
280 }
281 object_ = *tx;
282 }
283
287
294 {
295 object_[sfVaultID] = value;
296 return *this;
297 }
298
305 {
306 object_[sfLoanBrokerID] = value;
307 return *this;
308 }
309
316 {
317 object_[sfData] = value;
318 return *this;
319 }
320
327 {
328 object_[sfManagementFeeRate] = value;
329 return *this;
330 }
331
338 {
339 object_[sfDebtMaximum] = value;
340 return *this;
341 }
342
349 {
350 object_[sfCoverRateMinimum] = value;
351 return *this;
352 }
353
360 {
361 object_[sfCoverRateLiquidation] = value;
362 return *this;
363 }
364
371 {
372 object_[sfDomainID] = value;
373 return *this;
374 }
375
383 build(PublicKey const& publicKey, SecretKey const& secretKey)
384 {
385 sign(publicKey, secretKey);
386 return LoanBrokerSet{std::make_shared<STTx>(std::move(object_))};
387 }
388};
389
390} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:53
A secret key.
Definition SecretKey.h:24
LoanBrokerSetBuilder & setLoanBrokerID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfLoanBrokerID (SoeOptional).
LoanBrokerSetBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (SoeOptional).
LoanBrokerSetBuilder & setVaultID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
LoanBrokerSetBuilder & setCoverRateLiquidation(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCoverRateLiquidation (SoeOptional).
LoanBrokerSetBuilder(std::shared_ptr< STTx const > tx)
Construct a LoanBrokerSetBuilder from an existing STTx object.
LoanBrokerSetBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT256::type::value_type > const &vaultID, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new LoanBrokerSetBuilder with required fields.
LoanBrokerSetBuilder & setManagementFeeRate(std::decay_t< typename SF_UINT16::type::value_type > const &value)
Set sfManagementFeeRate (SoeOptional).
LoanBrokerSetBuilder & setDebtMaximum(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfDebtMaximum (SoeOptional).
LoanBrokerSetBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfDomainID (SoeOptional).
LoanBrokerSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the LoanBrokerSet wrapper.
LoanBrokerSetBuilder & setCoverRateMinimum(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCoverRateMinimum (SoeOptional).
bool hasDebtMaximum() const
Check if sfDebtMaximum is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getCoverRateMinimum() const
Get sfCoverRateMinimum (SoeOptional).
SF_UINT256::type::value_type getVaultID() const
Get sfVaultID (SoeRequired).
LoanBrokerSet(std::shared_ptr< STTx const > tx)
Construct a LoanBrokerSet transaction wrapper from an existing STTx object.
bool hasManagementFeeRate() const
Check if sfManagementFeeRate is present.
bool hasLoanBrokerID() const
Check if sfLoanBrokerID is present.
protocol_autogen::Optional< SF_UINT256::type::value_type > getLoanBrokerID() const
Get sfLoanBrokerID (SoeOptional).
protocol_autogen::Optional< SF_UINT32::type::value_type > getCoverRateLiquidation() const
Get sfCoverRateLiquidation (SoeOptional).
protocol_autogen::Optional< SF_NUMBER::type::value_type > getDebtMaximum() const
Get sfDebtMaximum (SoeOptional).
bool hasDomainID() const
Check if sfDomainID is present.
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (SoeOptional).
bool hasCoverRateLiquidation() const
Check if sfCoverRateLiquidation is present.
bool hasCoverRateMinimum() const
Check if sfCoverRateMinimum is present.
protocol_autogen::Optional< SF_UINT16::type::value_type > getManagementFeeRate() const
Get sfManagementFeeRate (SoeOptional).
protocol_autogen::Optional< SF_VL::type::value_type > getData() const
Get sfData (SoeOptional).
std::shared_ptr< STTx const > tx_
The underlying transaction object being wrapped.
TransactionBase(std::shared_ptr< STTx const > tx)
Construct a transaction wrapper from an existing STTx object.
LoanBrokerSetBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
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
TxType
Transaction type identifiers.
Definition TxFormats.h:45