rippled
Loading...
Searching...
No Matches
protocol_autogen/transactions/SignerListSet.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 SignerListSetBuilder;
17
30{
31public:
32 static constexpr xrpl::TxType txType = ttSIGNER_LIST_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 SignerListSet");
45 }
46 }
47
48 // Transaction-specific field getters
49
54 [[nodiscard]]
55 SF_UINT32::type::value_type
57 {
58 return this->tx_->at(sfSignerQuorum);
59 }
65 [[nodiscard]]
68 {
69 if (this->tx_->isFieldPresent(sfSignerEntries))
70 return this->tx_->getFieldArray(sfSignerEntries);
71 return std::nullopt;
72 }
73
78 [[nodiscard]]
79 bool
81 {
82 return this->tx_->isFieldPresent(sfSignerEntries);
83 }
84};
85
93class SignerListSetBuilder : public TransactionBuilderBase<SignerListSetBuilder>
94{
95public:
103 SignerListSetBuilder(SF_ACCOUNT::type::value_type account,
106)
107 : TransactionBuilderBase<SignerListSetBuilder>(ttSIGNER_LIST_SET, account, sequence, fee)
108 {
109 setSignerQuorum(signerQuorum);
110 }
111
118 {
119 if (tx->getTxnType() != ttSIGNER_LIST_SET)
120 {
121 throw std::runtime_error("Invalid transaction type for SignerListSetBuilder");
122 }
123 object_ = *tx;
124 }
125
134 {
135 object_[sfSignerQuorum] = value;
136 return *this;
137 }
138
145 {
146 object_.setFieldArray(sfSignerEntries, value);
147 return *this;
148 }
149
157 build(PublicKey const& publicKey, SecretKey const& secretKey)
158 {
159 sign(publicKey, secretKey);
160 return SignerListSet{std::make_shared<STTx>(std::move(object_))};
161 }
162};
163
164} // 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
SignerListSetBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT32::type::value_type > const &signerQuorum, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new SignerListSetBuilder with required fields.
SignerListSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the SignerListSet wrapper.
SignerListSetBuilder(std::shared_ptr< STTx const > tx)
Construct a SignerListSetBuilder from an existing STTx object.
SignerListSetBuilder & setSignerEntries(STArray const &value)
Set sfSignerEntries (soeOPTIONAL)
SignerListSetBuilder & setSignerQuorum(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Transaction-specific field setters.
SignerListSet(std::shared_ptr< STTx const > tx)
Construct a SignerListSet transaction wrapper from an existing STTx object.
bool hasSignerEntries() const
Check if sfSignerEntries is present.
SF_UINT32::type::value_type getSignerQuorum() const
Get sfSignerQuorum (soeREQUIRED)
std::optional< std::reference_wrapper< STArray const > > getSignerEntries() const
Get sfSignerEntries (soeOPTIONAL)
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.
SignerListSetBuilder & 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