rippled
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
16class LoanBrokerSetBuilder;
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};
217
225class LoanBrokerSetBuilder : public TransactionBuilderBase<LoanBrokerSetBuilder>
226{
227public:
235 LoanBrokerSetBuilder(SF_ACCOUNT::type::value_type account,
238)
239 : TransactionBuilderBase<LoanBrokerSetBuilder>(ttLOAN_BROKER_SET, account, sequence, fee)
240 {
241 setVaultID(vaultID);
242 }
243
250 {
251 if (tx->getTxnType() != ttLOAN_BROKER_SET)
252 {
253 throw std::runtime_error("Invalid transaction type for LoanBrokerSetBuilder");
254 }
255 object_ = *tx;
256 }
257
266 {
267 object_[sfVaultID] = value;
268 return *this;
269 }
270
277 {
278 object_[sfLoanBrokerID] = value;
279 return *this;
280 }
281
288 {
289 object_[sfData] = value;
290 return *this;
291 }
292
299 {
300 object_[sfManagementFeeRate] = value;
301 return *this;
302 }
303
310 {
311 object_[sfDebtMaximum] = value;
312 return *this;
313 }
314
321 {
322 object_[sfCoverRateMinimum] = value;
323 return *this;
324 }
325
332 {
333 object_[sfCoverRateLiquidation] = value;
334 return *this;
335 }
336
344 build(PublicKey const& publicKey, SecretKey const& secretKey)
345 {
346 sign(publicKey, secretKey);
347 return LoanBrokerSet{std::make_shared<STTx>(std::move(object_))};
348 }
349};
350
351} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
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)
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 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)
Base class for all transaction wrapper types.
std::shared_ptr< STTx const > tx_
The underlying transaction object being wrapped.
Base class for all transaction builders.
LoanBrokerSetBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
Sign the transaction with the given keys.
T is_same_v
STL namespace.
TxType
Transaction type identifiers.
Definition TxFormats.h:39