xrpld
Loading...
Searching...
No Matches
protocol_autogen/transactions/ConfidentialMPTSend.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_SEND;
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 ConfidentialMPTSend");
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_ACCOUNT::type::value_type
68 {
69 return this->tx_->at(sfDestination);
70 }
71
76 [[nodiscard]]
79 {
81 {
82 return this->tx_->at(sfDestinationTag);
83 }
84 return std::nullopt;
85 }
86
91 [[nodiscard]]
92 bool
94 {
95 return this->tx_->isFieldPresent(sfDestinationTag);
96 }
97
102 [[nodiscard]]
103 SF_VL::type::value_type
105 {
106 return this->tx_->at(sfSenderEncryptedAmount);
107 }
108
113 [[nodiscard]]
114 SF_VL::type::value_type
116 {
117 return this->tx_->at(sfDestinationEncryptedAmount);
118 }
119
124 [[nodiscard]]
125 SF_VL::type::value_type
127 {
128 return this->tx_->at(sfIssuerEncryptedAmount);
129 }
130
135 [[nodiscard]]
138 {
140 {
141 return this->tx_->at(sfAuditorEncryptedAmount);
142 }
143 return std::nullopt;
144 }
145
150 [[nodiscard]]
151 bool
153 {
154 return this->tx_->isFieldPresent(sfAuditorEncryptedAmount);
155 }
156
161 [[nodiscard]]
162 SF_VL::type::value_type
164 {
165 return this->tx_->at(sfZKProof);
166 }
167
172 [[nodiscard]]
173 SF_VL::type::value_type
175 {
176 return this->tx_->at(sfAmountCommitment);
177 }
178
183 [[nodiscard]]
184 SF_VL::type::value_type
186 {
187 return this->tx_->at(sfBalanceCommitment);
188 }
189
194 [[nodiscard]]
197 {
198 if (hasCredentialIDs())
199 {
200 return this->tx_->at(sfCredentialIDs);
201 }
202 return std::nullopt;
203 }
204
209 [[nodiscard]]
210 bool
212 {
213 return this->tx_->isFieldPresent(sfCredentialIDs);
214 }
215};
216
224class ConfidentialMPTSendBuilder : public TransactionBuilderBase<ConfidentialMPTSendBuilder>
225{
226public:
241 ConfidentialMPTSendBuilder(SF_ACCOUNT::type::value_type account,
244)
245 : TransactionBuilderBase<ConfidentialMPTSendBuilder>(ttCONFIDENTIAL_MPT_SEND, account, sequence, fee)
246 {
247 setMPTokenIssuanceID(mPTokenIssuanceID);
248 setDestination(destination);
249 setSenderEncryptedAmount(senderEncryptedAmount);
250 setDestinationEncryptedAmount(destinationEncryptedAmount);
251 setIssuerEncryptedAmount(issuerEncryptedAmount);
252 setZKProof(zKProof);
253 setAmountCommitment(amountCommitment);
254 setBalanceCommitment(balanceCommitment);
255 }
256
263 {
264 if (tx->getTxnType() != ttCONFIDENTIAL_MPT_SEND)
265 {
266 throw std::runtime_error("Invalid transaction type for ConfidentialMPTSendBuilder");
267 }
268 object_ = *tx;
269 }
270
272
279 {
280 object_[sfMPTokenIssuanceID] = value;
281 return *this;
282 }
283
290 {
291 object_[sfDestination] = value;
292 return *this;
293 }
294
301 {
302 object_[sfDestinationTag] = value;
303 return *this;
304 }
305
312 {
313 object_[sfSenderEncryptedAmount] = value;
314 return *this;
315 }
316
323 {
324 object_[sfDestinationEncryptedAmount] = value;
325 return *this;
326 }
327
334 {
335 object_[sfIssuerEncryptedAmount] = value;
336 return *this;
337 }
338
345 {
346 object_[sfAuditorEncryptedAmount] = value;
347 return *this;
348 }
349
356 {
357 object_[sfZKProof] = value;
358 return *this;
359 }
360
367 {
368 object_[sfAmountCommitment] = value;
369 return *this;
370 }
371
378 {
379 object_[sfBalanceCommitment] = value;
380 return *this;
381 }
382
389 {
390 object_[sfCredentialIDs] = value;
391 return *this;
392 }
393
401 build(PublicKey const& publicKey, SecretKey const& secretKey)
402 {
403 sign(publicKey, secretKey);
405 }
406};
407
408} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
A secret key.
Definition SecretKey.h:18
ConfidentialMPTSendBuilder & setAmountCommitment(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfAmountCommitment (SoeRequired).
ConfidentialMPTSendBuilder & setDestinationEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfDestinationEncryptedAmount (SoeRequired).
ConfidentialMPTSendBuilder & setSenderEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfSenderEncryptedAmount (SoeRequired).
ConfidentialMPTSendBuilder & setBalanceCommitment(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfBalanceCommitment (SoeRequired).
ConfidentialMPTSendBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (SoeRequired).
ConfidentialMPTSendBuilder & setZKProof(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfZKProof (SoeRequired).
ConfidentialMPTSendBuilder & setCredentialIDs(std::decay_t< typename SF_VECTOR256::type::value_type > const &value)
Set sfCredentialIDs (SoeOptional).
ConfidentialMPTSend build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the ConfidentialMPTSend wrapper.
ConfidentialMPTSendBuilder & setMPTokenIssuanceID(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Transaction-specific field setters.
ConfidentialMPTSendBuilder & setAuditorEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfAuditorEncryptedAmount (SoeOptional).
ConfidentialMPTSendBuilder(std::shared_ptr< STTx const > tx)
Construct a ConfidentialMPTSendBuilder from an existing STTx object.
ConfidentialMPTSendBuilder & setIssuerEncryptedAmount(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfIssuerEncryptedAmount (SoeRequired).
ConfidentialMPTSendBuilder & setDestinationTag(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfDestinationTag (SoeOptional).
ConfidentialMPTSendBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT192::type::value_type > const &mPTokenIssuanceID, std::decay_t< typename SF_ACCOUNT::type::value_type > const &destination, std::decay_t< typename SF_VL::type::value_type > const &senderEncryptedAmount, std::decay_t< typename SF_VL::type::value_type > const &destinationEncryptedAmount, std::decay_t< typename SF_VL::type::value_type > const &issuerEncryptedAmount, std::decay_t< typename SF_VL::type::value_type > const &zKProof, std::decay_t< typename SF_VL::type::value_type > const &amountCommitment, std::decay_t< typename SF_VL::type::value_type > const &balanceCommitment, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new ConfidentialMPTSendBuilder with required fields.
SF_VL::type::value_type getIssuerEncryptedAmount() const
Get sfIssuerEncryptedAmount (SoeRequired).
bool hasCredentialIDs() const
Check if sfCredentialIDs is present.
protocol_autogen::Optional< SF_UINT32::type::value_type > getDestinationTag() const
Get sfDestinationTag (SoeOptional).
bool hasAuditorEncryptedAmount() const
Check if sfAuditorEncryptedAmount is present.
protocol_autogen::Optional< SF_VL::type::value_type > getAuditorEncryptedAmount() const
Get sfAuditorEncryptedAmount (SoeOptional).
SF_VL::type::value_type getZKProof() const
Get sfZKProof (SoeRequired).
SF_VL::type::value_type getDestinationEncryptedAmount() const
Get sfDestinationEncryptedAmount (SoeRequired).
SF_VL::type::value_type getAmountCommitment() const
Get sfAmountCommitment (SoeRequired).
protocol_autogen::Optional< SF_VECTOR256::type::value_type > getCredentialIDs() const
Get sfCredentialIDs (SoeOptional).
SF_VL::type::value_type getSenderEncryptedAmount() const
Get sfSenderEncryptedAmount (SoeRequired).
SF_VL::type::value_type getBalanceCommitment() const
Get sfBalanceCommitment (SoeRequired).
SF_UINT192::type::value_type getMPTokenIssuanceID() const
Get sfMPTokenIssuanceID (SoeRequired).
SF_ACCOUNT::type::value_type getDestination() const
Get sfDestination (SoeRequired).
ConfidentialMPTSend(std::shared_ptr< STTx const > tx)
Construct a ConfidentialMPTSend transaction wrapper from an existing STTx object.
bool hasDestinationTag() const
Check if sfDestinationTag is present.
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.
ConfidentialMPTSendBuilder & 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