xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol_autogen
transactions
protocol_autogen/transactions/SponsorshipSet.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
SponsorshipSetBuilder
;
17
29
class
SponsorshipSet
:
public
TransactionBase
30
{
31
public
:
32
static
constexpr
xrpl::TxType
txType
= ttSPONSORSHIP_SET;
33
38
explicit
SponsorshipSet
(
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 SponsorshipSet"
);
45
}
46
}
47
48
// Transaction-specific field getters
49
54
[[nodiscard]]
55
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
56
getCounterpartySponsor
()
const
57
{
58
if
(
hasCounterpartySponsor
())
59
{
60
return
this->
tx_
->at(sfCounterpartySponsor);
61
}
62
return
std::nullopt;
63
}
64
69
[[nodiscard]]
70
bool
71
hasCounterpartySponsor
()
const
72
{
73
return
this->
tx_
->isFieldPresent(sfCounterpartySponsor);
74
}
75
80
[[nodiscard]]
81
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
82
getSponsee
()
const
83
{
84
if
(
hasSponsee
())
85
{
86
return
this->
tx_
->at(sfSponsee);
87
}
88
return
std::nullopt;
89
}
90
95
[[nodiscard]]
96
bool
97
hasSponsee
()
const
98
{
99
return
this->
tx_
->isFieldPresent(sfSponsee);
100
}
101
106
[[nodiscard]]
107
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
108
getFeeAmountDelta
()
const
109
{
110
if
(
hasFeeAmountDelta
())
111
{
112
return
this->
tx_
->at(sfFeeAmountDelta);
113
}
114
return
std::nullopt;
115
}
116
121
[[nodiscard]]
122
bool
123
hasFeeAmountDelta
()
const
124
{
125
return
this->
tx_
->isFieldPresent(sfFeeAmountDelta);
126
}
127
132
[[nodiscard]]
133
protocol_autogen::Optional<SF_AMOUNT::type::value_type>
134
getMaxFee
()
const
135
{
136
if
(
hasMaxFee
())
137
{
138
return
this->
tx_
->at(sfMaxFee);
139
}
140
return
std::nullopt;
141
}
142
147
[[nodiscard]]
148
bool
149
hasMaxFee
()
const
150
{
151
return
this->
tx_
->isFieldPresent(sfMaxFee);
152
}
153
158
[[nodiscard]]
159
protocol_autogen::Optional<SF_INT32::type::value_type>
160
getRemainingOwnerCountDelta
()
const
161
{
162
if
(
hasRemainingOwnerCountDelta
())
163
{
164
return
this->
tx_
->at(sfRemainingOwnerCountDelta);
165
}
166
return
std::nullopt;
167
}
168
173
[[nodiscard]]
174
bool
175
hasRemainingOwnerCountDelta
()
const
176
{
177
return
this->
tx_
->isFieldPresent(sfRemainingOwnerCountDelta);
178
}
179
};
180
188
class
SponsorshipSetBuilder
:
public
TransactionBuilderBase
<SponsorshipSetBuilder>
189
{
190
public
:
197
SponsorshipSetBuilder
(SF_ACCOUNT::type::value_type account,
198
std::optional<SF_UINT32::type::value_type>
sequence = std::nullopt,
199
std::optional<SF_AMOUNT::type::value_type>
fee = std::nullopt
200
)
201
:
TransactionBuilderBase
<
SponsorshipSetBuilder
>(ttSPONSORSHIP_SET, account, sequence, fee)
202
{
203
}
204
210
SponsorshipSetBuilder
(
std::shared_ptr<STTx const>
tx)
211
{
212
if
(tx->getTxnType() != ttSPONSORSHIP_SET)
213
{
214
throw
std::runtime_error
(
"Invalid transaction type for SponsorshipSetBuilder"
);
215
}
216
object_
= *tx;
217
}
218
222
227
SponsorshipSetBuilder
&
228
setCounterpartySponsor
(
std::decay_t<typename SF_ACCOUNT::type::value_type>
const
& value)
229
{
230
object_
[sfCounterpartySponsor] = value;
231
return
*
this
;
232
}
233
238
SponsorshipSetBuilder
&
239
setSponsee
(
std::decay_t<typename SF_ACCOUNT::type::value_type>
const
& value)
240
{
241
object_
[sfSponsee] = value;
242
return
*
this
;
243
}
244
249
SponsorshipSetBuilder
&
250
setFeeAmountDelta
(
std::decay_t<typename SF_AMOUNT::type::value_type>
const
& value)
251
{
252
object_
[sfFeeAmountDelta] = value;
253
return
*
this
;
254
}
255
260
SponsorshipSetBuilder
&
261
setMaxFee
(
std::decay_t<typename SF_AMOUNT::type::value_type>
const
& value)
262
{
263
object_
[sfMaxFee] = value;
264
return
*
this
;
265
}
266
271
SponsorshipSetBuilder
&
272
setRemainingOwnerCountDelta
(
std::decay_t<typename SF_INT32::type::value_type>
const
& value)
273
{
274
object_
[sfRemainingOwnerCountDelta] = value;
275
return
*
this
;
276
}
277
284
SponsorshipSet
285
build
(
PublicKey
const
& publicKey,
SecretKey
const
& secretKey)
286
{
287
sign
(publicKey, secretKey);
288
return
SponsorshipSet
{
std::make_shared<STTx>
(std::move(
object_
))};
289
}
290
};
291
292
}
// namespace xrpl::transactions
xrpl::PublicKey
A public key.
Definition
PublicKey.h:53
xrpl::SecretKey
A secret key.
Definition
SecretKey.h:24
xrpl::transactions::SponsorshipSetBuilder
Builder for SponsorshipSet transactions.
Definition
protocol_autogen/transactions/SponsorshipSet.h:189
xrpl::transactions::SponsorshipSetBuilder::SponsorshipSetBuilder
SponsorshipSetBuilder(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 SponsorshipSetBuilder with required fields.
Definition
protocol_autogen/transactions/SponsorshipSet.h:197
xrpl::transactions::SponsorshipSetBuilder::setRemainingOwnerCountDelta
SponsorshipSetBuilder & setRemainingOwnerCountDelta(std::decay_t< typename SF_INT32::type::value_type > const &value)
Set sfRemainingOwnerCountDelta (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:272
xrpl::transactions::SponsorshipSetBuilder::SponsorshipSetBuilder
SponsorshipSetBuilder(std::shared_ptr< STTx const > tx)
Construct a SponsorshipSetBuilder from an existing STTx object.
Definition
protocol_autogen/transactions/SponsorshipSet.h:210
xrpl::transactions::SponsorshipSetBuilder::setSponsee
SponsorshipSetBuilder & setSponsee(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfSponsee (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:239
xrpl::transactions::SponsorshipSetBuilder::setMaxFee
SponsorshipSetBuilder & setMaxFee(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfMaxFee (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:261
xrpl::transactions::SponsorshipSetBuilder::setCounterpartySponsor
SponsorshipSetBuilder & setCounterpartySponsor(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Transaction-specific field setters.
Definition
protocol_autogen/transactions/SponsorshipSet.h:228
xrpl::transactions::SponsorshipSetBuilder::build
SponsorshipSet build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the SponsorshipSet wrapper.
Definition
protocol_autogen/transactions/SponsorshipSet.h:285
xrpl::transactions::SponsorshipSetBuilder::setFeeAmountDelta
SponsorshipSetBuilder & setFeeAmountDelta(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfFeeAmountDelta (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:250
xrpl::transactions::SponsorshipSet
Transaction: SponsorshipSet.
Definition
protocol_autogen/transactions/SponsorshipSet.h:30
xrpl::transactions::SponsorshipSet::hasFeeAmountDelta
bool hasFeeAmountDelta() const
Check if sfFeeAmountDelta is present.
Definition
protocol_autogen/transactions/SponsorshipSet.h:123
xrpl::transactions::SponsorshipSet::hasSponsee
bool hasSponsee() const
Check if sfSponsee is present.
Definition
protocol_autogen/transactions/SponsorshipSet.h:97
xrpl::transactions::SponsorshipSet::getCounterpartySponsor
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getCounterpartySponsor() const
Get sfCounterpartySponsor (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:56
xrpl::transactions::SponsorshipSet::hasCounterpartySponsor
bool hasCounterpartySponsor() const
Check if sfCounterpartySponsor is present.
Definition
protocol_autogen/transactions/SponsorshipSet.h:71
xrpl::transactions::SponsorshipSet::hasRemainingOwnerCountDelta
bool hasRemainingOwnerCountDelta() const
Check if sfRemainingOwnerCountDelta is present.
Definition
protocol_autogen/transactions/SponsorshipSet.h:175
xrpl::transactions::SponsorshipSet::getFeeAmountDelta
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getFeeAmountDelta() const
Get sfFeeAmountDelta (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:108
xrpl::transactions::SponsorshipSet::getSponsee
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getSponsee() const
Get sfSponsee (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:82
xrpl::transactions::SponsorshipSet::SponsorshipSet
SponsorshipSet(std::shared_ptr< STTx const > tx)
Construct a SponsorshipSet transaction wrapper from an existing STTx object.
Definition
protocol_autogen/transactions/SponsorshipSet.h:38
xrpl::transactions::SponsorshipSet::txType
static constexpr xrpl::TxType txType
Definition
protocol_autogen/transactions/SponsorshipSet.h:32
xrpl::transactions::SponsorshipSet::getRemainingOwnerCountDelta
protocol_autogen::Optional< SF_INT32::type::value_type > getRemainingOwnerCountDelta() const
Get sfRemainingOwnerCountDelta (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:160
xrpl::transactions::SponsorshipSet::getMaxFee
protocol_autogen::Optional< SF_AMOUNT::type::value_type > getMaxFee() const
Get sfMaxFee (SoeOptional).
Definition
protocol_autogen/transactions/SponsorshipSet.h:134
xrpl::transactions::SponsorshipSet::hasMaxFee
bool hasMaxFee() const
Check if sfMaxFee is present.
Definition
protocol_autogen/transactions/SponsorshipSet.h:149
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< SponsorshipSetBuilder >::object_
STObject object_
Definition
TransactionBuilderBase.h:266
xrpl::transactions::TransactionBuilderBase< SponsorshipSetBuilder >::TransactionBuilderBase
TransactionBuilderBase()=default
xrpl::transactions::TransactionBuilderBase< SponsorshipSetBuilder >::sign
SponsorshipSetBuilder & 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