rippled
Loading...
Searching...
No Matches
XChainAddClaimAttestation.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 XChainAddClaimAttestationBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttXCHAIN_ADD_CLAIM_ATTESTATION;
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 XChainAddClaimAttestation");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
55 SF_XCHAIN_BRIDGE::type::value_type
57 {
58 return this->tx_->at(sfXChainBridge);
59 }
60
65 [[nodiscard]]
66 SF_ACCOUNT::type::value_type
68 {
69 return this->tx_->at(sfAttestationSignerAccount);
70 }
71
76 [[nodiscard]]
77 SF_VL::type::value_type
79 {
80 return this->tx_->at(sfPublicKey);
81 }
82
87 [[nodiscard]]
88 SF_VL::type::value_type
90 {
91 return this->tx_->at(sfSignature);
92 }
93
98 [[nodiscard]]
99 SF_ACCOUNT::type::value_type
101 {
102 return this->tx_->at(sfOtherChainSource);
103 }
104
109 [[nodiscard]]
110 SF_AMOUNT::type::value_type
111 getAmount() const
112 {
113 return this->tx_->at(sfAmount);
114 }
115
120 [[nodiscard]]
121 SF_ACCOUNT::type::value_type
123 {
124 return this->tx_->at(sfAttestationRewardAccount);
125 }
126
131 [[nodiscard]]
132 SF_UINT8::type::value_type
134 {
135 return this->tx_->at(sfWasLockingChainSend);
136 }
137
142 [[nodiscard]]
143 SF_UINT64::type::value_type
145 {
146 return this->tx_->at(sfXChainClaimID);
147 }
148
153 [[nodiscard]]
156 {
157 if (hasDestination())
158 {
159 return this->tx_->at(sfDestination);
160 }
161 return std::nullopt;
162 }
163
168 [[nodiscard]]
169 bool
171 {
172 return this->tx_->isFieldPresent(sfDestination);
173 }
174};
175
183class XChainAddClaimAttestationBuilder : public TransactionBuilderBase<XChainAddClaimAttestationBuilder>
184{
185public:
201 XChainAddClaimAttestationBuilder(SF_ACCOUNT::type::value_type account,
204)
205 : TransactionBuilderBase<XChainAddClaimAttestationBuilder>(ttXCHAIN_ADD_CLAIM_ATTESTATION, account, sequence, fee)
206 {
207 setXChainBridge(xChainBridge);
208 setAttestationSignerAccount(attestationSignerAccount);
209 setPublicKey(publicKey);
210 setSignature(signature);
211 setOtherChainSource(otherChainSource);
212 setAmount(amount);
213 setAttestationRewardAccount(attestationRewardAccount);
214 setWasLockingChainSend(wasLockingChainSend);
215 setXChainClaimID(xChainClaimID);
216 }
217
224 {
225 if (tx->getTxnType() != ttXCHAIN_ADD_CLAIM_ATTESTATION)
226 {
227 throw std::runtime_error("Invalid transaction type for XChainAddClaimAttestationBuilder");
228 }
229 object_ = *tx;
230 }
231
240 {
241 object_[sfXChainBridge] = value;
242 return *this;
243 }
244
251 {
252 object_[sfAttestationSignerAccount] = value;
253 return *this;
254 }
255
262 {
263 object_[sfPublicKey] = value;
264 return *this;
265 }
266
273 {
274 object_[sfSignature] = value;
275 return *this;
276 }
277
284 {
285 object_[sfOtherChainSource] = value;
286 return *this;
287 }
288
295 {
296 object_[sfAmount] = value;
297 return *this;
298 }
299
306 {
307 object_[sfAttestationRewardAccount] = value;
308 return *this;
309 }
310
317 {
318 object_[sfWasLockingChainSend] = value;
319 return *this;
320 }
321
328 {
329 object_[sfXChainClaimID] = value;
330 return *this;
331 }
332
339 {
340 object_[sfDestination] = value;
341 return *this;
342 }
343
351 build(PublicKey const& publicKey, SecretKey const& secretKey)
352 {
353 sign(publicKey, secretKey);
355 }
356};
357
358} // 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.
XChainAddClaimAttestationBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
Sign the transaction with the given keys.
Builder for XChainAddClaimAttestation transactions.
XChainAddClaimAttestationBuilder & setXChainClaimID(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfXChainClaimID (soeREQUIRED)
XChainAddClaimAttestationBuilder & setOtherChainSource(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfOtherChainSource (soeREQUIRED)
XChainAddClaimAttestation build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the XChainAddClaimAttestation wrapper.
XChainAddClaimAttestationBuilder & setWasLockingChainSend(std::decay_t< typename SF_UINT8::type::value_type > const &value)
Set sfWasLockingChainSend (soeREQUIRED)
XChainAddClaimAttestationBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (soeREQUIRED)
XChainAddClaimAttestationBuilder & setAttestationRewardAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfAttestationRewardAccount (soeREQUIRED)
XChainAddClaimAttestationBuilder & setXChainBridge(std::decay_t< typename SF_XCHAIN_BRIDGE::type::value_type > const &value)
Transaction-specific field setters.
XChainAddClaimAttestationBuilder & setPublicKey(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfPublicKey (soeREQUIRED)
XChainAddClaimAttestationBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_XCHAIN_BRIDGE::type::value_type > const &xChainBridge, std::decay_t< typename SF_ACCOUNT::type::value_type > const &attestationSignerAccount, std::decay_t< typename SF_VL::type::value_type > const &publicKey, std::decay_t< typename SF_VL::type::value_type > const &signature, std::decay_t< typename SF_ACCOUNT::type::value_type > const &otherChainSource, std::decay_t< typename SF_AMOUNT::type::value_type > const &amount, std::decay_t< typename SF_ACCOUNT::type::value_type > const &attestationRewardAccount, std::decay_t< typename SF_UINT8::type::value_type > const &wasLockingChainSend, std::decay_t< typename SF_UINT64::type::value_type > const &xChainClaimID, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new XChainAddClaimAttestationBuilder with required fields.
XChainAddClaimAttestationBuilder(std::shared_ptr< STTx const > tx)
Construct a XChainAddClaimAttestationBuilder from an existing STTx object.
XChainAddClaimAttestationBuilder & setSignature(std::decay_t< typename SF_VL::type::value_type > const &value)
Set sfSignature (soeREQUIRED)
XChainAddClaimAttestationBuilder & setAttestationSignerAccount(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfAttestationSignerAccount (soeREQUIRED)
XChainAddClaimAttestationBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeOPTIONAL)
Transaction: XChainAddClaimAttestation.
SF_UINT8::type::value_type getWasLockingChainSend() const
Get sfWasLockingChainSend (soeREQUIRED)
SF_ACCOUNT::type::value_type getAttestationSignerAccount() const
Get sfAttestationSignerAccount (soeREQUIRED)
XChainAddClaimAttestation(std::shared_ptr< STTx const > tx)
Construct a XChainAddClaimAttestation transaction wrapper from an existing STTx object.
SF_ACCOUNT::type::value_type getAttestationRewardAccount() const
Get sfAttestationRewardAccount (soeREQUIRED)
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getDestination() const
Get sfDestination (soeOPTIONAL)
SF_VL::type::value_type getPublicKey() const
Get sfPublicKey (soeREQUIRED)
SF_VL::type::value_type getSignature() const
Get sfSignature (soeREQUIRED)
SF_ACCOUNT::type::value_type getOtherChainSource() const
Get sfOtherChainSource (soeREQUIRED)
bool hasDestination() const
Check if sfDestination is present.
SF_XCHAIN_BRIDGE::type::value_type getXChainBridge() const
Get sfXChainBridge (soeREQUIRED)
SF_AMOUNT::type::value_type getAmount() const
Get sfAmount (soeREQUIRED)
SF_UINT64::type::value_type getXChainClaimID() const
Get sfXChainClaimID (soeREQUIRED)
T is_same_v
STL namespace.
TxType
Transaction type identifiers.
Definition TxFormats.h:39