xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol_autogen
transactions
protocol_autogen/transactions/PaymentChannelFund.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
PaymentChannelFundBuilder
;
17
29
class
PaymentChannelFund
:
public
TransactionBase
30
{
31
public
:
32
static
constexpr
xrpl::TxType
txType
= ttPAYCHAN_FUND;
33
38
explicit
PaymentChannelFund
(
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 PaymentChannelFund"
);
45
}
46
}
47
48
// Transaction-specific field getters
49
54
[[nodiscard]]
55
SF_UINT256::type::value_type
56
getChannel
()
const
57
{
58
return
this->
tx_
->at(sfChannel);
59
}
60
65
[[nodiscard]]
66
SF_AMOUNT::type::value_type
67
getAmount
()
const
68
{
69
return
this->
tx_
->at(sfAmount);
70
}
71
76
[[nodiscard]]
77
protocol_autogen::Optional<SF_UINT32::type::value_type>
78
getExpiration
()
const
79
{
80
if
(
hasExpiration
())
81
{
82
return
this->
tx_
->at(sfExpiration);
83
}
84
return
std::nullopt;
85
}
86
91
[[nodiscard]]
92
bool
93
hasExpiration
()
const
94
{
95
return
this->
tx_
->isFieldPresent(sfExpiration);
96
}
97
};
98
106
class
PaymentChannelFundBuilder
:
public
TransactionBuilderBase
<PaymentChannelFundBuilder>
107
{
108
public
:
117
PaymentChannelFundBuilder
(SF_ACCOUNT::type::value_type account,
118
std::decay_t<typename SF_UINT256::type::value_type>
const
& channel,
std::decay_t<typename SF_AMOUNT::type::value_type>
const
& amount,
std::optional<SF_UINT32::type::value_type>
sequence = std::nullopt,
119
std::optional<SF_AMOUNT::type::value_type>
fee = std::nullopt
120
)
121
:
TransactionBuilderBase
<
PaymentChannelFundBuilder
>(ttPAYCHAN_FUND, account, sequence, fee)
122
{
123
setChannel
(channel);
124
setAmount
(amount);
125
}
126
132
PaymentChannelFundBuilder
(
std::shared_ptr<STTx const>
tx)
133
{
134
if
(tx->getTxnType() != ttPAYCHAN_FUND)
135
{
136
throw
std::runtime_error
(
"Invalid transaction type for PaymentChannelFundBuilder"
);
137
}
138
object_
= *tx;
139
}
140
144
149
PaymentChannelFundBuilder
&
150
setChannel
(
std::decay_t<typename SF_UINT256::type::value_type>
const
& value)
151
{
152
object_
[sfChannel] = value;
153
return
*
this
;
154
}
155
160
PaymentChannelFundBuilder
&
161
setAmount
(
std::decay_t<typename SF_AMOUNT::type::value_type>
const
& value)
162
{
163
object_
[sfAmount] = value;
164
return
*
this
;
165
}
166
171
PaymentChannelFundBuilder
&
172
setExpiration
(
std::decay_t<typename SF_UINT32::type::value_type>
const
& value)
173
{
174
object_
[sfExpiration] = value;
175
return
*
this
;
176
}
177
184
PaymentChannelFund
185
build
(
PublicKey
const
& publicKey,
SecretKey
const
& secretKey)
186
{
187
sign
(publicKey, secretKey);
188
return
PaymentChannelFund
{
std::make_shared<STTx>
(std::move(
object_
))};
189
}
190
};
191
192
}
// namespace xrpl::transactions
xrpl::PublicKey
A public key.
Definition
PublicKey.h:53
xrpl::SecretKey
A secret key.
Definition
SecretKey.h:24
xrpl::transactions::PaymentChannelFundBuilder
Builder for PaymentChannelFund transactions.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:107
xrpl::transactions::PaymentChannelFundBuilder::PaymentChannelFundBuilder
PaymentChannelFundBuilder(std::shared_ptr< STTx const > tx)
Construct a PaymentChannelFundBuilder from an existing STTx object.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:132
xrpl::transactions::PaymentChannelFundBuilder::build
PaymentChannelFund build(PublicKey const &publicKey, SecretKey const &secretKey)
Build and return the PaymentChannelFund wrapper.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:185
xrpl::transactions::PaymentChannelFundBuilder::setExpiration
PaymentChannelFundBuilder & setExpiration(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfExpiration (SoeOptional).
Definition
protocol_autogen/transactions/PaymentChannelFund.h:172
xrpl::transactions::PaymentChannelFundBuilder::setChannel
PaymentChannelFundBuilder & setChannel(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Transaction-specific field setters.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:150
xrpl::transactions::PaymentChannelFundBuilder::PaymentChannelFundBuilder
PaymentChannelFundBuilder(SF_ACCOUNT::type::value_type account, std::decay_t< typename SF_UINT256::type::value_type > const &channel, std::decay_t< typename SF_AMOUNT::type::value_type > const &amount, std::optional< SF_UINT32::type::value_type > sequence=std::nullopt, std::optional< SF_AMOUNT::type::value_type > fee=std::nullopt)
Construct a new PaymentChannelFundBuilder with required fields.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:117
xrpl::transactions::PaymentChannelFundBuilder::setAmount
PaymentChannelFundBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (SoeRequired).
Definition
protocol_autogen/transactions/PaymentChannelFund.h:161
xrpl::transactions::PaymentChannelFund
Transaction: PaymentChannelFund.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:30
xrpl::transactions::PaymentChannelFund::PaymentChannelFund
PaymentChannelFund(std::shared_ptr< STTx const > tx)
Construct a PaymentChannelFund transaction wrapper from an existing STTx object.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:38
xrpl::transactions::PaymentChannelFund::getExpiration
protocol_autogen::Optional< SF_UINT32::type::value_type > getExpiration() const
Get sfExpiration (SoeOptional).
Definition
protocol_autogen/transactions/PaymentChannelFund.h:78
xrpl::transactions::PaymentChannelFund::getChannel
SF_UINT256::type::value_type getChannel() const
Get sfChannel (SoeRequired).
Definition
protocol_autogen/transactions/PaymentChannelFund.h:56
xrpl::transactions::PaymentChannelFund::txType
static constexpr xrpl::TxType txType
Definition
protocol_autogen/transactions/PaymentChannelFund.h:32
xrpl::transactions::PaymentChannelFund::hasExpiration
bool hasExpiration() const
Check if sfExpiration is present.
Definition
protocol_autogen/transactions/PaymentChannelFund.h:93
xrpl::transactions::PaymentChannelFund::getAmount
SF_AMOUNT::type::value_type getAmount() const
Get sfAmount (SoeRequired).
Definition
protocol_autogen/transactions/PaymentChannelFund.h:67
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< PaymentChannelFundBuilder >::object_
STObject object_
Definition
TransactionBuilderBase.h:266
xrpl::transactions::TransactionBuilderBase< PaymentChannelFundBuilder >::TransactionBuilderBase
TransactionBuilderBase()=default
xrpl::transactions::TransactionBuilderBase< PaymentChannelFundBuilder >::sign
PaymentChannelFundBuilder & 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