rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/VaultSet.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 VaultSetBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttVAULT_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 VaultSet");
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 (hasAssetsMaximum())
70 {
71 return this->tx_->at(sfAssetsMaximum);
72 }
73 return std::nullopt;
74 }
75
80 [[nodiscard]]
81 bool
83 {
84 return this->tx_->isFieldPresent(sfAssetsMaximum);
85 }
86
91 [[nodiscard]]
94 {
95 if (hasDomainID())
96 {
97 return this->tx_->at(sfDomainID);
98 }
99 return std::nullopt;
100 }
101
106 [[nodiscard]]
107 bool
109 {
110 return this->tx_->isFieldPresent(sfDomainID);
111 }
112
117 [[nodiscard]]
119 getData() const
120 {
121 if (hasData())
122 {
123 return this->tx_->at(sfData);
124 }
125 return std::nullopt;
126 }
127
132 [[nodiscard]]
133 bool
134 hasData() const
135 {
136 return this->tx_->isFieldPresent(sfData);
137 }
138};
139
147class VaultSetBuilder : public TransactionBuilderBase<VaultSetBuilder>
148{
149public:
157 VaultSetBuilder(SF_ACCOUNT::type::value_type account,
160)
161 : TransactionBuilderBase<VaultSetBuilder>(ttVAULT_SET, account, sequence, fee)
162 {
163 setVaultID(vaultID);
164 }
165
172 {
173 if (tx->getTxnType() != ttVAULT_SET)
174 {
175 throw std::runtime_error("Invalid transaction type for VaultSetBuilder");
176 }
177 object_ = *tx;
178 }
179
188 {
189 object_[sfVaultID] = value;
190 return *this;
191 }
192
199 {
200 object_[sfAssetsMaximum] = value;
201 return *this;
202 }
203
210 {
211 object_[sfDomainID] = value;
212 return *this;
213 }
214
221 {
222 object_[sfData] = value;
223 return *this;
224 }
225
233 build(PublicKey const& publicKey, SecretKey const& secretKey)
234 {
235 sign(publicKey, secretKey);
236 return VaultSet{std::make_shared<STTx>(std::move(object_))};
237 }
238};
239
240} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
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.
VaultSetBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
Sign the transaction with the given keys.
VaultSetBuilder(std::shared_ptr< STTx const > tx)
Construct a VaultSetBuilder from an existing STTx object.
VaultSetBuilder & setData(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfData (soeOPTIONAL)
VaultSetBuilder & setAssetsMaximum(std::decay_t< typename SF_NUMBER::type::value_type > const &value)
Set sfAssetsMaximum (soeOPTIONAL)
VaultSetBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfDomainID (soeOPTIONAL)
VaultSetBuilder(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 VaultSetBuilder with required fields.
VaultSetBuilder & setVaultID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
VaultSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the VaultSet wrapper.
VaultSet(std::shared_ptr< STTx const > tx)
Construct a VaultSet transaction wrapper from an existing STTx object.
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (soeOPTIONAL)
protocol_autogen::Optional< SF_VL::type::value_type > getData() const
Get sfData (soeOPTIONAL)
protocol_autogen::Optional< SF_NUMBER::type::value_type > getAssetsMaximum() const
Get sfAssetsMaximum (soeOPTIONAL)
bool hasDomainID() const
Check if sfDomainID is present.
bool hasData() const
Check if sfData is present.
bool hasAssetsMaximum() const
Check if sfAssetsMaximum is present.
SF_UINT256::type::value_type getVaultID() const
Get sfVaultID (soeREQUIRED)
T is_same_v
STL namespace.
TxType
Transaction type identifiers.
Definition TxFormats.h:39