xrpld
Loading...
Searching...
No Matches
protocol_autogen/transactions/ConfidentialMPTConvert.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
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttCONFIDENTIAL_MPT_CONVERT;
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 ConfidentialMPTConvert");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
55 SF_UINT192::type::value_type
57 {
58 return this->tx_->at(sfMPTokenIssuanceID);
59 }
60
65 [[nodiscard]]
66 SF_UINT64::type::value_type
68 {
69 return this->tx_->at(sfMPTAmount);
70 }
71
76 [[nodiscard]]
79 {
81 {
82 return this->tx_->at(sfHolderEncryptionKey);
83 }
84 return std::nullopt;
85 }
86
91 [[nodiscard]]
92 bool
94 {
95 return this->tx_->isFieldPresent(sfHolderEncryptionKey);
96 }
97
102 [[nodiscard]]
103 SF_VL::type::value_type
105 {
106 return this->tx_->at(sfHolderEncryptedAmount);
107 }
108
113 [[nodiscard]]
114 SF_VL::type::value_type
116 {
117 return this->tx_->at(sfIssuerEncryptedAmount);
118 }
119
124 [[nodiscard]]
127 {
129 {
130 return this->tx_->at(sfAuditorEncryptedAmount);
131 }
132 return std::nullopt;
133 }
134
139 [[nodiscard]]
140 bool
142 {
143 return this->tx_->isFieldPresent(sfAuditorEncryptedAmount);
144 }
145
150 [[nodiscard]]
151 SF_UINT256::type::value_type
153 {
154 return this->tx_->at(sfBlindingFactor);
155 }
156
161 [[nodiscard]]
164 {
165 if (hasZKProof())
166 {
167 return this->tx_->at(sfZKProof);
168 }
169 return std::nullopt;
170 }
171
176 [[nodiscard]]
177 bool
179 {
180 return this->tx_->isFieldPresent(sfZKProof);
181 }
182};
183
191class ConfidentialMPTConvertBuilder : public TransactionBuilderBase<ConfidentialMPTConvertBuilder>
192{
193public:
205 ConfidentialMPTConvertBuilder(SF_ACCOUNT::type::value_type account,
208)
209 : TransactionBuilderBase<ConfidentialMPTConvertBuilder>(ttCONFIDENTIAL_MPT_CONVERT, account, sequence, fee)
210 {
211 setMPTokenIssuanceID(mPTokenIssuanceID);
212 setMPTAmount(mPTAmount);
213 setHolderEncryptedAmount(holderEncryptedAmount);
214 setIssuerEncryptedAmount(issuerEncryptedAmount);
215 setBlindingFactor(blindingFactor);
216 }
217
224 {
225 if (tx->getTxnType() != ttCONFIDENTIAL_MPT_CONVERT)
226 {
227 throw std::runtime_error("Invalid transaction type for ConfidentialMPTConvertBuilder");
228 }
229 object_ = *tx;
230 }
231
233
240 {
241 object_[sfMPTokenIssuanceID] = value;
242 return *this;
243 }
244
251 {
252 object_[sfMPTAmount] = value;
253 return *this;
254 }
255
262 {
263 object_[sfHolderEncryptionKey] = value;
264 return *this;
265 }
266
273 {
274 object_[sfHolderEncryptedAmount] = value;
275 return *this;
276 }
277
284 {
285 object_[sfIssuerEncryptedAmount] = value;
286 return *this;
287 }
288
295 {
296 object_[sfAuditorEncryptedAmount] = value;
297 return *this;
298 }
299
306 {
307 object_[sfBlindingFactor] = value;
308 return *this;
309 }
310
317 {
318 object_[sfZKProof] = value;
319 return *this;
320 }
321
329 build(PublicKey const& publicKey, SecretKey const& secretKey)
330 {
331 sign(publicKey, secretKey);
333 }
334};
335
336} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
ConfidentialMPTConvertBuilder & setZKProof(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfZKProof (SoeOptional).
ConfidentialMPTConvertBuilder & setAuditorEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfAuditorEncryptedAmount (SoeOptional).
ConfidentialMPTConvertBuilder & setHolderEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfHolderEncryptedAmount (SoeRequired).
ConfidentialMPTConvertBuilder & setHolderEncryptionKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfHolderEncryptionKey (SoeOptional).
ConfidentialMPTConvertBuilder & setMPTokenIssuanceID(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Transaction-specific field setters.
ConfidentialMPTConvertBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT192::type::value_type > const &mPTokenIssuanceID, std::decay_t< typename SF_UINT64::type::value_type > const &mPTAmount, std::decay_t< typename SF_VL::type::value_type > const &holderEncryptedAmount, std::decay_t< typename SF_VL::type::value_type > const &issuerEncryptedAmount, std::decay_t< typename SF_UINT256::type::value_type > const &blindingFactor, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new ConfidentialMPTConvertBuilder with required fields.
ConfidentialMPTConvertBuilder(std::shared_ptr< STTx const > tx)
Construct a ConfidentialMPTConvertBuilder from an existing STTx object.
ConfidentialMPTConvertBuilder & setMPTAmount(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfMPTAmount (SoeRequired).
ConfidentialMPTConvertBuilder & setBlindingFactor(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfBlindingFactor (SoeRequired).
ConfidentialMPTConvert build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the ConfidentialMPTConvert wrapper.
ConfidentialMPTConvertBuilder & setIssuerEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfIssuerEncryptedAmount (SoeRequired).
SF_VL::type::value_type getIssuerEncryptedAmount() const
Get sfIssuerEncryptedAmount (SoeRequired).
bool hasHolderEncryptionKey() const
Check if sfHolderEncryptionKey is present.
SF_UINT256::type::value_type getBlindingFactor() const
Get sfBlindingFactor (SoeRequired).
SF_UINT192::type::value_type getMPTokenIssuanceID() const
Get sfMPTokenIssuanceID (SoeRequired).
bool hasAuditorEncryptedAmount() const
Check if sfAuditorEncryptedAmount is present.
SF_VL::type::value_type getHolderEncryptedAmount() const
Get sfHolderEncryptedAmount (SoeRequired).
protocol_autogen::Optional< SF_VL::type::value_type > getHolderEncryptionKey() const
Get sfHolderEncryptionKey (SoeOptional).
protocol_autogen::Optional< SF_VL::type::value_type > getZKProof() const
Get sfZKProof (SoeOptional).
ConfidentialMPTConvert(std::shared_ptr< STTx const > tx)
Construct a ConfidentialMPTConvert transaction wrapper from an existing STTx object.
SF_UINT64::type::value_type getMPTAmount() const
Get sfMPTAmount (SoeRequired).
protocol_autogen::Optional< SF_VL::type::value_type > getAuditorEncryptedAmount() const
Get sfAuditorEncryptedAmount (SoeOptional).
std::shared_ptr< STTx const > tx_
The underlying transaction object being wrapped.
TransactionBase(std::shared_ptr< STTx const > tx)
Construct a transaction wrapper from an existing STTx object.
ConfidentialMPTConvertBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
T make_shared(T... args)
STL namespace.
std::conditional_t< std::is_reference_v< ValueType >, std::optional< std::reference_wrapper< std::remove_reference_t< ValueType > > >, std::optional< ValueType > > Optional
Definition Utils.h:9
TxType
Transaction type identifiers.
Definition TxFormats.h:41