rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/LoanBrokerCoverClawback.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 LoanBrokerCoverClawbackBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttLOAN_BROKER_COVER_CLAWBACK;
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 LoanBrokerCoverClawback");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
57 {
58 if (hasLoanBrokerID())
59 {
60 return this->tx_->at(sfLoanBrokerID);
61 }
62 return std::nullopt;
63 }
64
69 [[nodiscard]]
70 bool
72 {
73 return this->tx_->isFieldPresent(sfLoanBrokerID);
74 }
75
81 [[nodiscard]]
83 getAmount() const
84 {
85 if (hasAmount())
86 {
87 return this->tx_->at(sfAmount);
88 }
89 return std::nullopt;
90 }
91
96 [[nodiscard]]
97 bool
98 hasAmount() const
99 {
100 return this->tx_->isFieldPresent(sfAmount);
101 }
102};
103
111class LoanBrokerCoverClawbackBuilder : public TransactionBuilderBase<LoanBrokerCoverClawbackBuilder>
112{
113public:
120 LoanBrokerCoverClawbackBuilder(SF_ACCOUNT::type::value_type account,
123)
124 : TransactionBuilderBase<LoanBrokerCoverClawbackBuilder>(ttLOAN_BROKER_COVER_CLAWBACK, account, sequence, fee)
125 {
126 }
127
134 {
135 if (tx->getTxnType() != ttLOAN_BROKER_COVER_CLAWBACK)
136 {
137 throw std::runtime_error("Invalid transaction type for LoanBrokerCoverClawbackBuilder");
138 }
139 object_ = *tx;
140 }
141
150 {
151 object_[sfLoanBrokerID] = value;
152 return *this;
153 }
154
162 {
163 object_[sfAmount] = value;
164 return *this;
165 }
166
174 build(PublicKey const& publicKey, SecretKey const& secretKey)
175 {
176 sign(publicKey, secretKey);
178 }
179};
180
181} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
LoanBrokerCoverClawbackBuilder(std::shared_ptr< STTx const > tx)
Construct a LoanBrokerCoverClawbackBuilder from an existing STTx object.
LoanBrokerCoverClawbackBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (soeOPTIONAL)
LoanBrokerCoverClawback build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the LoanBrokerCoverClawback wrapper.
LoanBrokerCoverClawbackBuilder(SF_ACCOUNT::type::value_type account, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new LoanBrokerCoverClawbackBuilder with required fields.
LoanBrokerCoverClawbackBuilder & setLoanBrokerID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
LoanBrokerCoverClawback(std::shared_ptr< STTx const > tx)
Construct a LoanBrokerCoverClawback transaction wrapper from an existing STTx object.
protocol_autogen::Optional< SF_UINT256::type::value_type > getLoanBrokerID() const
Get sfLoanBrokerID (soeOPTIONAL)
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getAmount() const
Get sfAmount (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.
LoanBrokerCoverClawbackBuilder & 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