rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/PermissionedDomainSet.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 PermissionedDomainSetBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttPERMISSIONED_DOMAIN_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 PermissionedDomainSet");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
57 {
58 if (hasDomainID())
59 {
60 return this->tx_->at(sfDomainID);
61 }
62 return std::nullopt;
63 }
64
69 [[nodiscard]]
70 bool
72 {
73 return this->tx_->isFieldPresent(sfDomainID);
74 }
80 [[nodiscard]]
81 STArray const&
83 {
84 return this->tx_->getFieldArray(sfAcceptedCredentials);
85 }
86};
87
95class PermissionedDomainSetBuilder : public TransactionBuilderBase<PermissionedDomainSetBuilder>
96{
97public:
105 PermissionedDomainSetBuilder(SF_ACCOUNT::type::value_type account,
106 STArray const& acceptedCredentials, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
108)
109 : TransactionBuilderBase<PermissionedDomainSetBuilder>(ttPERMISSIONED_DOMAIN_SET, account, sequence, fee)
110 {
111 setAcceptedCredentials(acceptedCredentials);
112 }
113
120 {
121 if (tx->getTxnType() != ttPERMISSIONED_DOMAIN_SET)
122 {
123 throw std::runtime_error("Invalid transaction type for PermissionedDomainSetBuilder");
124 }
125 object_ = *tx;
126 }
127
136 {
137 object_[sfDomainID] = value;
138 return *this;
139 }
140
147 {
148 object_.setFieldArray(sfAcceptedCredentials, value);
149 return *this;
150 }
151
159 build(PublicKey const& publicKey, SecretKey const& secretKey)
160 {
161 sign(publicKey, secretKey);
163 }
164};
165
166} // namespace xrpl::transactions
A public key.
Definition PublicKey.h:42
void setFieldArray(SField const &field, STArray const &v)
Definition STObject.cpp:819
A secret key.
Definition SecretKey.h:18
PermissionedDomainSetBuilder(SF_ACCOUNT::type::value_type account, STArray const &acceptedCredentials, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new PermissionedDomainSetBuilder with required fields.
PermissionedDomainSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the PermissionedDomainSet wrapper.
PermissionedDomainSetBuilder(std::shared_ptr< STTx const > tx)
Construct a PermissionedDomainSetBuilder from an existing STTx object.
PermissionedDomainSetBuilder & setDomainID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
PermissionedDomainSetBuilder & setAcceptedCredentials(STArray const &value)
Set sfAcceptedCredentials (soeREQUIRED)
protocol_autogen::Optional< SF_UINT256::type::value_type > getDomainID() const
Get sfDomainID (soeOPTIONAL)
STArray const & getAcceptedCredentials() const
Get sfAcceptedCredentials (soeREQUIRED)
PermissionedDomainSet(std::shared_ptr< STTx const > tx)
Construct a PermissionedDomainSet transaction wrapper from an existing STTx object.
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.
PermissionedDomainSetBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
Sign the transaction with the given keys.
T is_same_v
STL namespace.
TxType
Transaction type identifiers.
Definition TxFormats.h:39