xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol_autogen
transactions
protocol_autogen/transactions/SetRegularKey.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
14
namespace
xrpl::transactions
{
15
16
class
SetRegularKeyBuilder
;
17
29
class
SetRegularKey
:
public
TransactionBase
30
{
31
public
:
32
static
constexpr
xrpl::TxType
txType
= ttREGULAR_KEY_SET;
33
38
explicit
SetRegularKey
(
std::shared_ptr<STTx const>
tx)
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 SetRegularKey"
);
45
}
46
}
47
48
// Transaction-specific field getters
49
54
[[nodiscard]]
55
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
56
getRegularKey
()
const
57
{
58
if
(
hasRegularKey
())
59
{
60
return
this->
tx_
->at(sfRegularKey);
61
}
62
return
std::nullopt;
63
}
64
69
[[nodiscard]]
70
bool
71
hasRegularKey
()
const
72
{
73
return
this->
tx_
->isFieldPresent(sfRegularKey);
74
}
75
};
76
84
class
SetRegularKeyBuilder
:
public
TransactionBuilderBase
<SetRegularKeyBuilder>
85
{
86
public
:
93
SetRegularKeyBuilder
(SF_ACCOUNT::type::value_type account,
94
std::optional<SF_UINT32::type::value_type>
sequence = std::nullopt,
95
std::optional<SF_AMOUNT::type::value_type>
fee = std::nullopt
96
)
97
:
TransactionBuilderBase
<
SetRegularKeyBuilder
>(ttREGULAR_KEY_SET, account, sequence, fee)
98
{
99
}
100
106
SetRegularKeyBuilder
(
std::shared_ptr<STTx const>
tx)
107
{
108
if
(tx->getTxnType() != ttREGULAR_KEY_SET)
109
{
110
throw
std::runtime_error
(
"Invalid transaction type for SetRegularKeyBuilder"
);
111
}
112
object_
= *tx;
113
}
114
118
123
SetRegularKeyBuilder
&
124
setRegularKey
(
std::decay_t<typename SF_ACCOUNT::type::value_type>
const
& value)
125
{
126
object_
[sfRegularKey] = value;
127
return
*
this
;
128
}
129
136
SetRegularKey
137
build
(
PublicKey
const
& publicKey,
SecretKey
const
& secretKey)
138
{
139
sign
(publicKey, secretKey);
140
return
SetRegularKey
{
std::make_shared<STTx>
(std::move(
object_
))};
141
}
142
};
143
144
}
// namespace xrpl::transactions
xrpl::PublicKey
A public key.
Definition
PublicKey.h:53
xrpl::SecretKey
A secret key.
Definition
SecretKey.h:24
xrpl::transactions::SetRegularKeyBuilder
Builder for SetRegularKey transactions.
Definition
protocol_autogen/transactions/SetRegularKey.h:85
xrpl::transactions::SetRegularKeyBuilder::build
SetRegularKey build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the SetRegularKey wrapper.
Definition
protocol_autogen/transactions/SetRegularKey.h:137
xrpl::transactions::SetRegularKeyBuilder::SetRegularKeyBuilder
SetRegularKeyBuilder(SF_ACCOUNT::type::value_type account, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new SetRegularKeyBuilder with required fields.
Definition
protocol_autogen/transactions/SetRegularKey.h:93
xrpl::transactions::SetRegularKeyBuilder::SetRegularKeyBuilder
SetRegularKeyBuilder(std::shared_ptr< STTx const > tx)
Construct a SetRegularKeyBuilder from an existing STTx object.
Definition
protocol_autogen/transactions/SetRegularKey.h:106
xrpl::transactions::SetRegularKeyBuilder::setRegularKey
SetRegularKeyBuilder & setRegularKey(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Transaction-specific field setters.
Definition
protocol_autogen/transactions/SetRegularKey.h:124
xrpl::transactions::SetRegularKey
Transaction: SetRegularKey.
Definition
protocol_autogen/transactions/SetRegularKey.h:30
xrpl::transactions::SetRegularKey::txType
static constexpr xrpl::TxType txType
Definition
protocol_autogen/transactions/SetRegularKey.h:32
xrpl::transactions::SetRegularKey::hasRegularKey
bool hasRegularKey() const
Check if sfRegularKey is present.
Definition
protocol_autogen/transactions/SetRegularKey.h:71
xrpl::transactions::SetRegularKey::getRegularKey
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getRegularKey() const
Get sfRegularKey (SoeOptional).
Definition
protocol_autogen/transactions/SetRegularKey.h:56
xrpl::transactions::SetRegularKey::SetRegularKey
SetRegularKey(std::shared_ptr< STTx const > tx)
Construct a SetRegularKey transaction wrapper from an existing STTx object.
Definition
protocol_autogen/transactions/SetRegularKey.h:38
xrpl::transactions::TransactionBase::tx_
std::shared_ptr< STTx const > tx_
The underlying transaction object being wrapped.
Definition
TransactionBase.h:456
xrpl::transactions::TransactionBase::TransactionBase
TransactionBase(std::shared_ptr< STTx const > tx)
Construct a transaction wrapper from an existing STTx object.
Definition
TransactionBase.h:31
xrpl::transactions::TransactionBuilderBase< SetRegularKeyBuilder >::object_
STObject object_
Definition
TransactionBuilderBase.h:266
xrpl::transactions::TransactionBuilderBase< SetRegularKeyBuilder >::TransactionBuilderBase
TransactionBuilderBase()=default
xrpl::transactions::TransactionBuilderBase< SetRegularKeyBuilder >::sign
SetRegularKeyBuilder & sign(PublicKey const &publicKey, SecretKey const &secretKey)
Definition
TransactionBuilderBase.h:248
std::decay_t
std::make_shared
T make_shared(T... args)
std
STL namespace.
xrpl::protocol_autogen::Optional
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
xrpl::transactions
Definition
TransactionBase.h:15
xrpl::TxType
TxType
Transaction type identifiers.
Definition
TxFormats.h:45
optional
std::runtime_error
std::shared_ptr
stdexcept
Generated by
1.17.0