xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol_autogen
transactions
protocol_autogen/transactions/AMMVote.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
AMMVoteBuilder
;
17
29
class
AMMVote
:
public
TransactionBase
30
{
31
public
:
32
static
constexpr
xrpl::TxType
txType
= ttAMM_VOTE;
33
38
explicit
AMMVote
(
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 AMMVote"
);
45
}
46
}
47
48
// Transaction-specific field getters
49
55
[[nodiscard]]
56
SF_ISSUE::type::value_type
57
getAsset
()
const
58
{
59
return
this->
tx_
->at(sfAsset);
60
}
61
67
[[nodiscard]]
68
SF_ISSUE::type::value_type
69
getAsset2
()
const
70
{
71
return
this->
tx_
->at(sfAsset2);
72
}
73
78
[[nodiscard]]
79
SF_UINT16::type::value_type
80
getTradingFee
()
const
81
{
82
return
this->
tx_
->at(sfTradingFee);
83
}
84
};
85
93
class
AMMVoteBuilder
:
public
TransactionBuilderBase
<AMMVoteBuilder>
94
{
95
public
:
105
AMMVoteBuilder
(SF_ACCOUNT::type::value_type account,
106
std::decay_t<typename SF_ISSUE::type::value_type>
const
& asset,
std::decay_t<typename SF_ISSUE::type::value_type>
const
& asset2,
std::decay_t<typename SF_UINT16::type::value_type>
const
& tradingFee,
std::optional<SF_UINT32::type::value_type>
sequence = std::nullopt,
107
std::optional<SF_AMOUNT::type::value_type>
fee = std::nullopt
108
)
109
:
TransactionBuilderBase
<
AMMVoteBuilder
>(ttAMM_VOTE, account, sequence, fee)
110
{
111
setAsset
(asset);
112
setAsset2
(asset2);
113
setTradingFee
(tradingFee);
114
}
115
121
AMMVoteBuilder
(
std::shared_ptr<STTx const>
tx)
122
{
123
if
(tx->getTxnType() != ttAMM_VOTE)
124
{
125
throw
std::runtime_error
(
"Invalid transaction type for AMMVoteBuilder"
);
126
}
127
object_
= *tx;
128
}
129
133
139
AMMVoteBuilder
&
140
setAsset
(
std::decay_t<typename SF_ISSUE::type::value_type>
const
& value)
141
{
142
object_
[sfAsset] =
STIssue
(sfAsset, value);
143
return
*
this
;
144
}
145
151
AMMVoteBuilder
&
152
setAsset2
(
std::decay_t<typename SF_ISSUE::type::value_type>
const
& value)
153
{
154
object_
[sfAsset2] =
STIssue
(sfAsset2, value);
155
return
*
this
;
156
}
157
162
AMMVoteBuilder
&
163
setTradingFee
(
std::decay_t<typename SF_UINT16::type::value_type>
const
& value)
164
{
165
object_
[sfTradingFee] = value;
166
return
*
this
;
167
}
168
175
AMMVote
176
build
(
PublicKey
const
& publicKey,
SecretKey
const
& secretKey)
177
{
178
sign
(publicKey, secretKey);
179
return
AMMVote
{
std::make_shared<STTx>
(std::move(
object_
))};
180
}
181
};
182
183
}
// namespace xrpl::transactions
xrpl::PublicKey
A public key.
Definition
PublicKey.h:53
xrpl::STIssue
Definition
STIssue.h:21
xrpl::SecretKey
A secret key.
Definition
SecretKey.h:24
xrpl::transactions::AMMVoteBuilder
Builder for AMMVote transactions.
Definition
protocol_autogen/transactions/AMMVote.h:94
xrpl::transactions::AMMVoteBuilder::AMMVoteBuilder
AMMVoteBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_ISSUE::type::value_type > const &asset, std::decay_t< typename SF_ISSUE::type::value_type > const &asset2, std::decay_t< typename SF_UINT16::type::value_type > const &tradingFee, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new AMMVoteBuilder with required fields.
Definition
protocol_autogen/transactions/AMMVote.h:105
xrpl::transactions::AMMVoteBuilder::setAsset2
AMMVoteBuilder & setAsset2(std::decay_t< typename SF_ISSUE::type::value_type > const &value)
Set sfAsset2 (SoeRequired).
Definition
protocol_autogen/transactions/AMMVote.h:152
xrpl::transactions::AMMVoteBuilder::setAsset
AMMVoteBuilder & setAsset(std::decay_t< typename SF_ISSUE::type::value_type > const &value)
Transaction-specific field setters.
Definition
protocol_autogen/transactions/AMMVote.h:140
xrpl::transactions::AMMVoteBuilder::build
AMMVote build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the AMMVote wrapper.
Definition
protocol_autogen/transactions/AMMVote.h:176
xrpl::transactions::AMMVoteBuilder::setTradingFee
AMMVoteBuilder & setTradingFee(std::decay_t< typename SF_UINT16::type::value_type > const &value)
Set sfTradingFee (SoeRequired).
Definition
protocol_autogen/transactions/AMMVote.h:163
xrpl::transactions::AMMVoteBuilder::AMMVoteBuilder
AMMVoteBuilder(std::shared_ptr< STTx const > tx)
Construct a AMMVoteBuilder from an existing STTx object.
Definition
protocol_autogen/transactions/AMMVote.h:121
xrpl::transactions::AMMVote
Transaction: AMMVote.
Definition
protocol_autogen/transactions/AMMVote.h:30
xrpl::transactions::AMMVote::txType
static constexpr xrpl::TxType txType
Definition
protocol_autogen/transactions/AMMVote.h:32
xrpl::transactions::AMMVote::AMMVote
AMMVote(std::shared_ptr< STTx const > tx)
Construct a AMMVote transaction wrapper from an existing STTx object.
Definition
protocol_autogen/transactions/AMMVote.h:38
xrpl::transactions::AMMVote::getAsset
SF_ISSUE::type::value_type getAsset() const
Get sfAsset (SoeRequired).
Definition
protocol_autogen/transactions/AMMVote.h:57
xrpl::transactions::AMMVote::getAsset2
SF_ISSUE::type::value_type getAsset2() const
Get sfAsset2 (SoeRequired).
Definition
protocol_autogen/transactions/AMMVote.h:69
xrpl::transactions::AMMVote::getTradingFee
SF_UINT16::type::value_type getTradingFee() const
Get sfTradingFee (SoeRequired).
Definition
protocol_autogen/transactions/AMMVote.h:80
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< AMMVoteBuilder >::object_
STObject object_
Definition
TransactionBuilderBase.h:266
xrpl::transactions::TransactionBuilderBase< AMMVoteBuilder >::TransactionBuilderBase
TransactionBuilderBase()=default
xrpl::transactions::TransactionBuilderBase< AMMVoteBuilder >::sign
AMMVoteBuilder & 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::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