xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
TxMeta.h
1
#pragma once
2
3
#include <xrpl/basics/Blob.h>
4
#include <xrpl/basics/base_uint.h>
5
#include <xrpl/json/json_value.h>
6
#include <xrpl/protocol/AccountID.h>
7
#include <xrpl/protocol/SField.h>
8
#include <xrpl/protocol/STAmount.h>
9
#include <xrpl/protocol/STArray.h>
10
#include <xrpl/protocol/STBase.h>
11
#include <xrpl/protocol/STLedgerEntry.h>
12
#include <xrpl/protocol/STObject.h>
13
#include <xrpl/protocol/Serializer.h>
14
#include <xrpl/protocol/TER.h>
15
#include <xrpl/protocol/UintTypes.h>
16
17
#include <boost/container/flat_set.hpp>
18
19
#include <
cstdint
>
20
#include <flat_set>
21
#include <
optional
>
22
23
namespace
xrpl
{
24
25
class
TxMeta
26
{
27
public
:
28
TxMeta
(
UInt256
const
& transactionID,
std::uint32_t
ledger);
29
TxMeta
(
UInt256
const
& txID,
std::uint32_t
ledger,
Blob
const
&);
30
TxMeta
(
UInt256
const
& txID,
std::uint32_t
ledger,
STObject
const
&);
31
32
[[nodiscard]]
UInt256
const
&
33
getTxID
()
const
34
{
35
return
transactionID_
;
36
}
37
[[nodiscard]]
std::uint32_t
38
getLgrSeq
()
const
39
{
40
return
ledgerSeq_
;
41
}
42
[[nodiscard]]
int
43
getResult
()
const
44
{
45
return
result_
;
46
}
47
[[nodiscard]]
TER
48
getResultTER
()
const
49
{
50
return
TER::fromInt
(
result_
);
51
}
52
[[nodiscard]]
std::uint32_t
53
getIndex
()
const
54
{
55
return
index_
;
56
}
57
58
void
59
setAffectedNode
(
UInt256
const
&,
SField
const
& type,
std::uint16_t
nodeType);
60
STObject
&
61
getAffectedNode
(
SLE::Ref
node,
SField
const
& type);
// create if needed
62
STObject
&
63
getAffectedNode
(
UInt256
const
&);
64
68
[[nodiscard]] boost::container::flat_set<AccountID>
69
getAffectedAccounts
()
const
;
70
71
[[nodiscard]]
json::Value
72
getJson
(
JsonOptions
p)
const
73
{
74
return
getAsObject
().
getJson
(p);
75
}
76
void
77
addRaw
(
Serializer
&,
TER
,
std::uint32_t
index);
78
79
[[nodiscard]]
STObject
80
getAsObject
()
const
;
81
STArray
&
82
getNodes
()
83
{
84
return
nodes_
;
85
}
86
[[nodiscard]]
STArray
const
&
87
getNodes
()
const
88
{
89
return
nodes_
;
90
}
91
92
void
93
setAdditionalFields
(
STObject
const
& obj)
94
{
95
if
(obj.
isFieldPresent
(sfDeliveredAmount))
96
deliveredAmount_
= obj.
getFieldAmount
(sfDeliveredAmount);
97
98
if
(obj.
isFieldPresent
(sfParentBatchID))
99
parentBatchID_
= obj.
getFieldH256
(sfParentBatchID);
100
}
101
102
[[nodiscard]]
std::optional<STAmount>
const
&
103
getDeliveredAmount
()
const
104
{
105
return
deliveredAmount_
;
106
}
107
108
void
109
setDeliveredAmount
(
std::optional<STAmount>
const
& amount)
110
{
111
deliveredAmount_
= amount;
112
}
113
114
void
115
setParentBatchID
(
std::optional<UInt256>
const
&
id
)
116
{
117
parentBatchID_
= id;
118
}
119
120
[[nodiscard]] std::flat_set<MPTID>
121
getAffectedMPTs
()
const
;
122
123
private
:
124
UInt256
transactionID_
;
125
std::uint32_t
ledgerSeq_
;
126
std::uint32_t
index_
;
127
int
result_
;
128
129
std::optional<STAmount>
deliveredAmount_
;
130
std::optional<UInt256>
parentBatchID_
;
131
132
STArray
nodes_
;
133
};
134
135
}
// namespace xrpl
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::SField
Identifies fields.
Definition
SField.h:132
xrpl::STArray
Definition
STArray.h:20
xrpl::STLedgerEntry::Ref
std::shared_ptr< STLedgerEntry > const & Ref
Definition
STLedgerEntry.h:35
xrpl::STObject
Definition
STObject.h:49
xrpl::STObject::getFieldH256
UInt256 getFieldH256(SField const &field) const
Definition
STObject.cpp:631
xrpl::STObject::getJson
json::Value getJson(JsonOptions=JsonOptions::Values::None) const override
Definition
STObject.cpp:845
xrpl::STObject::isFieldPresent
bool isFieldPresent(SField const &field) const
Definition
STObject.cpp:464
xrpl::STObject::getFieldAmount
STAmount const & getFieldAmount(SField const &field) const
Definition
STObject.cpp:657
xrpl::Serializer
Definition
Serializer.h:23
xrpl::TERSubset< CanCvtToTER >::fromInt
static constexpr TERSubset fromInt(int from)
Definition
TER.h:444
xrpl::TxMeta::getAffectedAccounts
boost::container::flat_set< AccountID > getAffectedAccounts() const
Return a list of accounts affected by this transaction.
Definition
TxMeta.cpp:89
xrpl::TxMeta::getTxID
UInt256 const & getTxID() const
Definition
TxMeta.h:33
xrpl::TxMeta::setDeliveredAmount
void setDeliveredAmount(std::optional< STAmount > const &amount)
Definition
TxMeta.h:109
xrpl::TxMeta::getResultTER
TER getResultTER() const
Definition
TxMeta.h:48
xrpl::TxMeta::getNodes
STArray const & getNodes() const
Definition
TxMeta.h:87
xrpl::TxMeta::TxMeta
TxMeta(UInt256 const &transactionID, std::uint32_t ledger)
Definition
TxMeta.cpp:56
xrpl::TxMeta::getJson
json::Value getJson(JsonOptions p) const
Definition
TxMeta.h:72
xrpl::TxMeta::transactionID_
UInt256 transactionID_
Definition
TxMeta.h:124
xrpl::TxMeta::getIndex
std::uint32_t getIndex() const
Definition
TxMeta.h:53
xrpl::TxMeta::setAdditionalFields
void setAdditionalFields(STObject const &obj)
Definition
TxMeta.h:93
xrpl::TxMeta::getAffectedNode
STObject & getAffectedNode(SLE::Ref node, SField const &type)
Definition
TxMeta.cpp:199
xrpl::TxMeta::deliveredAmount_
std::optional< STAmount > deliveredAmount_
Definition
TxMeta.h:129
xrpl::TxMeta::getDeliveredAmount
std::optional< STAmount > const & getDeliveredAmount() const
Definition
TxMeta.h:103
xrpl::TxMeta::nodes_
STArray nodes_
Definition
TxMeta.h:132
xrpl::TxMeta::result_
int result_
Definition
TxMeta.h:127
xrpl::TxMeta::getLgrSeq
std::uint32_t getLgrSeq() const
Definition
TxMeta.h:38
xrpl::TxMeta::getAffectedMPTs
std::flat_set< MPTID > getAffectedMPTs() const
Definition
TxMeta.cpp:153
xrpl::TxMeta::addRaw
void addRaw(Serializer &, TER, std::uint32_t index)
Definition
TxMeta.cpp:251
xrpl::TxMeta::parentBatchID_
std::optional< UInt256 > parentBatchID_
Definition
TxMeta.h:130
xrpl::TxMeta::getAsObject
STObject getAsObject() const
Definition
TxMeta.cpp:234
xrpl::TxMeta::getNodes
STArray & getNodes()
Definition
TxMeta.h:82
xrpl::TxMeta::setAffectedNode
void setAffectedNode(UInt256 const &, SField const &type, std::uint16_t nodeType)
Definition
TxMeta.cpp:67
xrpl::TxMeta::index_
std::uint32_t index_
Definition
TxMeta.h:126
xrpl::TxMeta::ledgerSeq_
std::uint32_t ledgerSeq_
Definition
TxMeta.h:125
xrpl::TxMeta::setParentBatchID
void setParentBatchID(std::optional< UInt256 > const &id)
Definition
TxMeta.h:115
xrpl::TxMeta::getResult
int getResult() const
Definition
TxMeta.h:43
cstdint
std::uint32_t
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::TER
TERSubset< CanCvtToTER > TER
Definition
TER.h:654
xrpl::Blob
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition
Blob.h:11
optional
xrpl::JsonOptions
Note, should be treated as flags that can be | and &.
Definition
STBase.h:22
Generated by
1.17.0