rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/LoanSet.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 LoanSetBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttLOAN_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 LoanSet");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
55 SF_UINT256::type::value_type
57 {
58 return this->tx_->at(sfLoanBrokerID);
59 }
60
65 [[nodiscard]]
67 getData() const
68 {
69 if (hasData())
70 {
71 return this->tx_->at(sfData);
72 }
73 return std::nullopt;
74 }
75
80 [[nodiscard]]
81 bool
82 hasData() const
83 {
84 return this->tx_->isFieldPresent(sfData);
85 }
86
91 [[nodiscard]]
94 {
95 if (hasCounterparty())
96 {
97 return this->tx_->at(sfCounterparty);
98 }
99 return std::nullopt;
100 }
101
106 [[nodiscard]]
107 bool
109 {
110 return this->tx_->isFieldPresent(sfCounterparty);
111 }
117 [[nodiscard]]
120 {
121 if (this->tx_->isFieldPresent(sfCounterpartySignature))
122 return this->tx_->getFieldObject(sfCounterpartySignature);
123 return std::nullopt;
124 }
125
130 [[nodiscard]]
131 bool
133 {
134 return this->tx_->isFieldPresent(sfCounterpartySignature);
135 }
136
141 [[nodiscard]]
144 {
146 {
147 return this->tx_->at(sfLoanOriginationFee);
148 }
149 return std::nullopt;
150 }
151
156 [[nodiscard]]
157 bool
159 {
160 return this->tx_->isFieldPresent(sfLoanOriginationFee);
161 }
162
167 [[nodiscard]]
170 {
171 if (hasLoanServiceFee())
172 {
173 return this->tx_->at(sfLoanServiceFee);
174 }
175 return std::nullopt;
176 }
177
182 [[nodiscard]]
183 bool
185 {
186 return this->tx_->isFieldPresent(sfLoanServiceFee);
187 }
188
193 [[nodiscard]]
196 {
197 if (hasLatePaymentFee())
198 {
199 return this->tx_->at(sfLatePaymentFee);
200 }
201 return std::nullopt;
202 }
203
208 [[nodiscard]]
209 bool
211 {
212 return this->tx_->isFieldPresent(sfLatePaymentFee);
213 }
214
219 [[nodiscard]]
222 {
223 if (hasClosePaymentFee())
224 {
225 return this->tx_->at(sfClosePaymentFee);
226 }
227 return std::nullopt;
228 }
229
234 [[nodiscard]]
235 bool
237 {
238 return this->tx_->isFieldPresent(sfClosePaymentFee);
239 }
240
245 [[nodiscard]]
248 {
249 if (hasOverpaymentFee())
250 {
251 return this->tx_->at(sfOverpaymentFee);
252 }
253 return std::nullopt;
254 }
255
260 [[nodiscard]]
261 bool
263 {
264 return this->tx_->isFieldPresent(sfOverpaymentFee);
265 }
266
271 [[nodiscard]]
274 {
275 if (hasInterestRate())
276 {
277 return this->tx_->at(sfInterestRate);
278 }
279 return std::nullopt;
280 }
281
286 [[nodiscard]]
287 bool
289 {
290 return this->tx_->isFieldPresent(sfInterestRate);
291 }
292
297 [[nodiscard]]
300 {
302 {
303 return this->tx_->at(sfLateInterestRate);
304 }
305 return std::nullopt;
306 }
307
312 [[nodiscard]]
313 bool
315 {
316 return this->tx_->isFieldPresent(sfLateInterestRate);
317 }
318
323 [[nodiscard]]
326 {
328 {
329 return this->tx_->at(sfCloseInterestRate);
330 }
331 return std::nullopt;
332 }
333
338 [[nodiscard]]
339 bool
341 {
342 return this->tx_->isFieldPresent(sfCloseInterestRate);
343 }
344
349 [[nodiscard]]
352 {
354 {
355 return this->tx_->at(sfOverpaymentInterestRate);
356 }
357 return std::nullopt;
358 }
359
364 [[nodiscard]]
365 bool
367 {
368 return this->tx_->isFieldPresent(sfOverpaymentInterestRate);
369 }
370
375 [[nodiscard]]
376 SF_NUMBER::type::value_type
378 {
379 return this->tx_->at(sfPrincipalRequested);
380 }
381
386 [[nodiscard]]
389 {
390 if (hasPaymentTotal())
391 {
392 return this->tx_->at(sfPaymentTotal);
393 }
394 return std::nullopt;
395 }
396
401 [[nodiscard]]
402 bool
404 {
405 return this->tx_->isFieldPresent(sfPaymentTotal);
406 }
407
412 [[nodiscard]]
415 {
416 if (hasPaymentInterval())
417 {
418 return this->tx_->at(sfPaymentInterval);
419 }
420 return std::nullopt;
421 }
422
427 [[nodiscard]]
428 bool
430 {
431 return this->tx_->isFieldPresent(sfPaymentInterval);
432 }
433
438 [[nodiscard]]
441 {
442 if (hasGracePeriod())
443 {
444 return this->tx_->at(sfGracePeriod);
445 }
446 return std::nullopt;
447 }
448
453 [[nodiscard]]
454 bool
456 {
457 return this->tx_->isFieldPresent(sfGracePeriod);
458 }
459};
460
468class LoanSetBuilder : public TransactionBuilderBase<LoanSetBuilder>
469{
470public:
479 LoanSetBuilder(SF_ACCOUNT::type::value_type account,
482)
483 : TransactionBuilderBase<LoanSetBuilder>(ttLOAN_SET, account, sequence, fee)
484 {
485 setLoanBrokerID(loanBrokerID);
486 setPrincipalRequested(principalRequested);
487 }
488
495 {
496 if (tx->getTxnType() != ttLOAN_SET)
497 {
498 throw std::runtime_error("Invalid transaction type for LoanSetBuilder");
499 }
500 object_ = *tx;
501 }
502
511 {
512 object_[sfLoanBrokerID] = value;
513 return *this;
514 }
515
522 {
523 object_[sfData] = value;
524 return *this;
525 }
526
533 {
534 object_[sfCounterparty] = value;
535 return *this;
536 }
537
544 {
545 object_.setFieldObject(sfCounterpartySignature, value);
546 return *this;
547 }
548
555 {
556 object_[sfLoanOriginationFee] = value;
557 return *this;
558 }
559
566 {
567 object_[sfLoanServiceFee] = value;
568 return *this;
569 }
570
577 {
578 object_[sfLatePaymentFee] = value;
579 return *this;
580 }
581
588 {
589 object_[sfClosePaymentFee] = value;
590 return *this;
591 }
592
599 {
600 object_[sfOverpaymentFee] = value;
601 return *this;
602 }
603
610 {
611 object_[sfInterestRate] = value;
612 return *this;
613 }
614
621 {
622 object_[sfLateInterestRate] = value;
623 return *this;
624 }
625
632 {
633 object_[sfCloseInterestRate] = value;
634 return *this;
635 }
636
643 {
644 object_[sfOverpaymentInterestRate] = value;
645 return *this;
646 }
647
654 {
655 object_[sfPrincipalRequested] = value;
656 return *this;
657 }
658
665 {
666 object_[sfPaymentTotal] = value;
667 return *this;
668 }
669
676 {
677 object_[sfPaymentInterval] = value;
678 return *this;
679 }
680
687 {
688 object_[sfGracePeriod] = value;
689 return *this;
690 }
691
698 LoanSet
699 build(PublicKey const& publicKey, SecretKey const& secretKey)
700 {
701 sign(publicKey, secretKey);
702 return LoanSet{std::make_shared<STTx>(std::move(object_))};
703 }
704};
705
706} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
void setFieldObject(SField const &field, STObject const &v)
Definition STObject.cpp:825
A secret key.
Definition SecretKey.h:18
LoanSetBuilder & setLoanServiceFee(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfLoanServiceFee (soeOPTIONAL)
LoanSetBuilder & setLoanOriginationFee(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfLoanOriginationFee (soeOPTIONAL)
LoanSetBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT256::type::value_type > const &loanBrokerID, std::decay_t< typename SF_NUMBER::type::value_type > const &principalRequested, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new LoanSetBuilder with required fields.
LoanSetBuilder & setLateInterestRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfLateInterestRate (soeOPTIONAL)
LoanSetBuilder(std::shared_ptr< STTx const > tx)
Construct a LoanSetBuilder from an existing STTx object.
LoanSetBuilder & setOverpaymentInterestRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfOverpaymentInterestRate (soeOPTIONAL)
LoanSetBuilder & setPaymentInterval(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPaymentInterval (soeOPTIONAL)
LoanSetBuilder & setClosePaymentFee(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfClosePaymentFee (soeOPTIONAL)
LoanSetBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (soeOPTIONAL)
LoanSetBuilder & setCounterpartySignature(STObject const &value)
Set sfCounterpartySignature (soeOPTIONAL)
LoanSetBuilder & setLatePaymentFee(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfLatePaymentFee (soeOPTIONAL)
LoanSetBuilder & setInterestRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfInterestRate (soeOPTIONAL)
LoanSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the LoanSet wrapper.
LoanSetBuilder & setLoanBrokerID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
LoanSetBuilder & setOverpaymentFee(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfOverpaymentFee (soeOPTIONAL)
LoanSetBuilder & setCounterparty(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfCounterparty (soeOPTIONAL)
LoanSetBuilder & setPaymentTotal(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPaymentTotal (soeOPTIONAL)
LoanSetBuilder & setGracePeriod(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfGracePeriod (soeOPTIONAL)
LoanSetBuilder & setCloseInterestRate(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfCloseInterestRate (soeOPTIONAL)
LoanSetBuilder & setPrincipalRequested(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfPrincipalRequested (soeREQUIRED)
SF_NUMBER::type::value_type getPrincipalRequested() const
Get sfPrincipalRequested (soeREQUIRED)
bool hasCounterparty() const
Check if sfCounterparty is present.
bool hasCounterpartySignature() const
Check if sfCounterpartySignature is present.
bool hasInterestRate() const
Check if sfInterestRate is present.
protocol_autogen::Optional< SF_NUMBER::type::value_type > getLoanOriginationFee() const
Get sfLoanOriginationFee (soeOPTIONAL)
bool hasLoanOriginationFee() const
Check if sfLoanOriginationFee is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getGracePeriod() const
Get sfGracePeriod (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT32::type::value_type > getOverpaymentFee() const
Get sfOverpaymentFee (soeOPTIONAL)
protocol_autogen::Optional< SF_NUMBER::type::value_type > getLoanServiceFee() const
Get sfLoanServiceFee (soeOPTIONAL)
protocol_autogen::Optional< SF_VL::type::value_type > getData() const
Get sfData (soeOPTIONAL)
bool hasCloseInterestRate() const
Check if sfCloseInterestRate is present.
bool hasOverpaymentInterestRate() const
Check if sfOverpaymentInterestRate is present.
bool hasLateInterestRate() const
Check if sfLateInterestRate is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getPaymentInterval() const
Get sfPaymentInterval (soeOPTIONAL)
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getCounterparty() const
Get sfCounterparty (soeOPTIONAL)
bool hasOverpaymentFee() const
Check if sfOverpaymentFee is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getOverpaymentInterestRate() const
Get sfOverpaymentInterestRate (soeOPTIONAL)
bool hasPaymentTotal() const
Check if sfPaymentTotal is present.
bool hasLatePaymentFee() const
Check if sfLatePaymentFee is present.
bool hasLoanServiceFee() const
Check if sfLoanServiceFee is present.
std::optional< STObject > getCounterpartySignature() const
Get sfCounterpartySignature (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT32::type::value_type > getLateInterestRate() const
Get sfLateInterestRate (soeOPTIONAL)
SF_UINT256::type::value_type getLoanBrokerID() const
Get sfLoanBrokerID (soeREQUIRED)
protocol_autogen::Optional< SF_NUMBER::type::value_type > getLatePaymentFee() const
Get sfLatePaymentFee (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT32::type::value_type > getCloseInterestRate() const
Get sfCloseInterestRate (soeOPTIONAL)
protocol_autogen::Optional< SF_UINT32::type::value_type > getInterestRate() const
Get sfInterestRate (soeOPTIONAL)
bool hasPaymentInterval() const
Check if sfPaymentInterval is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getPaymentTotal() const
Get sfPaymentTotal (soeOPTIONAL)
bool hasGracePeriod() const
Check if sfGracePeriod is present.
LoanSet(std::shared_ptr< STTx const > tx)
Construct a LoanSet transaction wrapper from an existing STTx object.
protocol_autogen::Optional< SF_NUMBER::type::value_type > getClosePaymentFee() const
Get sfClosePaymentFee (soeOPTIONAL)
bool hasClosePaymentFee() const
Check if sfClosePaymentFee is present.
bool hasData() const
Check if sfData is present.
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.
LoanSetBuilder & 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