xrpld
Loading...
Searching...
No Matches
protocol_autogen/transactions/ConfidentialMPTHolderKeyUpdate.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_HOLDER_KEY_UPDATE;
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 ConfidentialMPTHolderKeyUpdate");
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]]
68 {
70 {
71 return this->tx_->at(sfHolderEncryptionKey);
72 }
73 return std::nullopt;
74 }
75
80 [[nodiscard]]
81 bool
83 {
84 return this->tx_->isFieldPresent(sfHolderEncryptionKey);
85 }
86
91 [[nodiscard]]
94 {
96 {
97 return this->tx_->at(sfConfidentialBalanceSpending);
98 }
99 return std::nullopt;
100 }
101
106 [[nodiscard]]
107 bool
109 {
110 return this->tx_->isFieldPresent(sfConfidentialBalanceSpending);
111 }
112
117 [[nodiscard]]
120 {
122 {
123 return this->tx_->at(sfConfidentialBalanceInbox);
124 }
125 return std::nullopt;
126 }
127
132 [[nodiscard]]
133 bool
135 {
136 return this->tx_->isFieldPresent(sfConfidentialBalanceInbox);
137 }
138
143 [[nodiscard]]
146 {
147 if (hasZKProof())
148 {
149 return this->tx_->at(sfZKProof);
150 }
151 return std::nullopt;
152 }
153
158 [[nodiscard]]
159 bool
161 {
162 return this->tx_->isFieldPresent(sfZKProof);
163 }
164};
165
173class ConfidentialMPTHolderKeyUpdateBuilder : public TransactionBuilderBase<ConfidentialMPTHolderKeyUpdateBuilder>
174{
175public:
183 ConfidentialMPTHolderKeyUpdateBuilder(SF_ACCOUNT::type::value_type account,
186)
187 : TransactionBuilderBase<ConfidentialMPTHolderKeyUpdateBuilder>(ttCONFIDENTIAL_MPT_HOLDER_KEY_UPDATE, account, sequence, fee)
188 {
189 setMPTokenIssuanceID(mPTokenIssuanceID);
190 }
191
198 {
199 if (tx->getTxnType() != ttCONFIDENTIAL_MPT_HOLDER_KEY_UPDATE)
200 {
201 throw std::runtime_error("Invalid transaction type for ConfidentialMPTHolderKeyUpdateBuilder");
202 }
203 object_ = *tx;
204 }
205
209
216 {
217 object_[sfMPTokenIssuanceID] = value;
218 return *this;
219 }
220
227 {
228 object_[sfHolderEncryptionKey] = value;
229 return *this;
230 }
231
238 {
239 object_[sfConfidentialBalanceSpending] = value;
240 return *this;
241 }
242
249 {
250 object_[sfConfidentialBalanceInbox] = value;
251 return *this;
252 }
253
260 {
261 object_[sfZKProof] = value;
262 return *this;
263 }
264
272 build(PublicKey const& publicKey, SecretKey const& secretKey)
273 {
274 sign(publicKey, secretKey);
276 }
277};
278
279} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:53
A secret key.
Definition SecretKey.h:24
ConfidentialMPTHolderKeyUpdateBuilder & setConfidentialBalanceInbox(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceInbox (SoeOptional).
ConfidentialMPTHolderKeyUpdateBuilder & setZKProof(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfZKProof (SoeOptional).
ConfidentialMPTHolderKeyUpdateBuilder & setMPTokenIssuanceID(std::decay_t< typename SF_UINT192::type::value_type > const &value)
Transaction-specific field setters.
ConfidentialMPTHolderKeyUpdateBuilder & setHolderEncryptionKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfHolderEncryptionKey (SoeOptional).
ConfidentialMPTHolderKeyUpdateBuilder & setConfidentialBalanceSpending(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfConfidentialBalanceSpending (SoeOptional).
ConfidentialMPTHolderKeyUpdateBuilder(std::shared_ptr< STTx const > tx)
Construct a ConfidentialMPTHolderKeyUpdateBuilder from an existing STTx object.
ConfidentialMPTHolderKeyUpdateBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT192::type::value_type > const &mPTokenIssuanceID, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new ConfidentialMPTHolderKeyUpdateBuilder with required fields.
ConfidentialMPTHolderKeyUpdate build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the ConfidentialMPTHolderKeyUpdate wrapper.
protocol_autogen::Optional< SF_VL::type::value_type > getConfidentialBalanceInbox() const
Get sfConfidentialBalanceInbox (SoeOptional).
protocol_autogen::Optional< SF_VL::type::value_type > getZKProof() const
Get sfZKProof (SoeOptional).
protocol_autogen::Optional< SF_VL::type::value_type > getConfidentialBalanceSpending() const
Get sfConfidentialBalanceSpending (SoeOptional).
bool hasConfidentialBalanceSpending() const
Check if sfConfidentialBalanceSpending is present.
SF_UINT192::type::value_type getMPTokenIssuanceID() const
Get sfMPTokenIssuanceID (SoeRequired).
bool hasConfidentialBalanceInbox() const
Check if sfConfidentialBalanceInbox is present.
protocol_autogen::Optional< SF_VL::type::value_type > getHolderEncryptionKey() const
Get sfHolderEncryptionKey (SoeOptional).
ConfidentialMPTHolderKeyUpdate(std::shared_ptr< STTx const > tx)
Construct a ConfidentialMPTHolderKeyUpdate transaction wrapper from an existing STTx object.
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.
ConfidentialMPTHolderKeyUpdateBuilder & 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:45