rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/LoanBrokerCoverWithdraw.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 LoanBrokerCoverWithdrawBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttLOAN_BROKER_COVER_WITHDRAW;
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 LoanBrokerCoverWithdraw");
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
66 [[nodiscard]]
67 SF_AMOUNT::type::value_type
68 getAmount() const
69 {
70 return this->tx_->at(sfAmount);
71 }
72
77 [[nodiscard]]
80 {
81 if (hasDestination())
82 {
83 return this->tx_->at(sfDestination);
84 }
85 return std::nullopt;
86 }
87
92 [[nodiscard]]
93 bool
95 {
96 return this->tx_->isFieldPresent(sfDestination);
97 }
98
103 [[nodiscard]]
106 {
107 if (hasDestinationTag())
108 {
109 return this->tx_->at(sfDestinationTag);
110 }
111 return std::nullopt;
112 }
113
118 [[nodiscard]]
119 bool
121 {
122 return this->tx_->isFieldPresent(sfDestinationTag);
123 }
124};
125
133class LoanBrokerCoverWithdrawBuilder : public TransactionBuilderBase<LoanBrokerCoverWithdrawBuilder>
134{
135public:
144 LoanBrokerCoverWithdrawBuilder(SF_ACCOUNT::type::value_type account,
147)
148 : TransactionBuilderBase<LoanBrokerCoverWithdrawBuilder>(ttLOAN_BROKER_COVER_WITHDRAW, account, sequence, fee)
149 {
150 setLoanBrokerID(loanBrokerID);
151 setAmount(amount);
152 }
153
160 {
161 if (tx->getTxnType() != ttLOAN_BROKER_COVER_WITHDRAW)
162 {
163 throw std::runtime_error("Invalid transaction type for LoanBrokerCoverWithdrawBuilder");
164 }
165 object_ = *tx;
166 }
167
176 {
177 object_[sfLoanBrokerID] = value;
178 return *this;
179 }
180
188 {
189 object_[sfAmount] = value;
190 return *this;
191 }
192
199 {
200 object_[sfDestination] = value;
201 return *this;
202 }
203
210 {
211 object_[sfDestinationTag] = value;
212 return *this;
213 }
214
222 build(PublicKey const& publicKey, SecretKey const& secretKey)
223 {
224 sign(publicKey, secretKey);
226 }
227};
228
229} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
LoanBrokerCoverWithdrawBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeOPTIONAL)
LoanBrokerCoverWithdrawBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT256::type::value_type > const &loanBrokerID, std::decay_t< typename SF_AMOUNT::type::value_type > const &amount, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new LoanBrokerCoverWithdrawBuilder with required fields.
LoanBrokerCoverWithdrawBuilder(std::shared_ptr< STTx const > tx)
Construct a LoanBrokerCoverWithdrawBuilder from an existing STTx object.
LoanBrokerCoverWithdraw build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the LoanBrokerCoverWithdraw wrapper.
LoanBrokerCoverWithdrawBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (soeOPTIONAL)
LoanBrokerCoverWithdrawBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (soeREQUIRED)
LoanBrokerCoverWithdrawBuilder & setLoanBrokerID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
SF_AMOUNT::type::value_type getAmount() const
Get sfAmount (soeREQUIRED)
protocol_autogen::Optional< SF_UINT32::type::value_type > getDestinationTag() const
Get sfDestinationTag (soeOPTIONAL)
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getDestination() const
Get sfDestination (soeOPTIONAL)
SF_UINT256::type::value_type getLoanBrokerID() const
Get sfLoanBrokerID (soeREQUIRED)
LoanBrokerCoverWithdraw(std::shared_ptr< STTx const > tx)
Construct a LoanBrokerCoverWithdraw transaction wrapper from an existing STTx object.
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.
LoanBrokerCoverWithdrawBuilder & 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