rippled
Loading...
Searching...
No Matches
TxMeta.h
1#ifndef XRPL_APP_TX_TRANSACTIONMETA_H_INCLUDED
2#define XRPL_APP_TX_TRANSACTIONMETA_H_INCLUDED
3
4#include <xrpl/beast/utility/Journal.h>
5#include <xrpl/protocol/STArray.h>
6#include <xrpl/protocol/STLedgerEntry.h>
7#include <xrpl/protocol/TER.h>
8
9#include <boost/container/flat_set.hpp>
10
11#include <optional>
12
13namespace ripple {
14
15class TxMeta
16{
17public:
19 TxMeta(uint256 const& txID, std::uint32_t ledger, Blob const&);
20 TxMeta(uint256 const& txID, std::uint32_t ledger, STObject const&);
21
22 uint256 const&
23 getTxID() const
24 {
25 return transactionID_;
26 }
28 getLgrSeq() const
29 {
30 return ledgerSeq_;
31 }
32 int
33 getResult() const
34 {
35 return result_;
36 }
37 TER
39 {
40 return TER::fromInt(result_);
41 }
43 getIndex() const
44 {
45 return index_;
46 }
47
48 void
49 setAffectedNode(uint256 const&, SField const& type, std::uint16_t nodeType);
51 getAffectedNode(SLE::ref node, SField const& type); // create if needed
54
56 boost::container::flat_set<AccountID>
57 getAffectedAccounts() const;
58
61 {
62 return getAsObject().getJson(p);
63 }
64 void
66
68 getAsObject() const;
69 STArray&
71 {
72 return nodes_;
73 }
74 STArray const&
75 getNodes() const
76 {
77 return nodes_;
78 }
79
80 void
82 {
83 if (obj.isFieldPresent(sfDeliveredAmount))
84 deliveredAmount_ = obj.getFieldAmount(sfDeliveredAmount);
85
86 if (obj.isFieldPresent(sfParentBatchID))
87 parentBatchID_ = obj.getFieldH256(sfParentBatchID);
88 }
89
92 {
93 return deliveredAmount_;
94 }
95
96 void
98 {
99 deliveredAmount_ = amount;
100 }
101
102 void
107
108private:
113
116
118};
119
120} // namespace ripple
121
122#endif
Represents a JSON value.
Definition json_value.h:130
Identifies fields.
Definition SField.h:127
STAmount const & getFieldAmount(SField const &field) const
Definition STObject.cpp:652
bool isFieldPresent(SField const &field) const
Definition STObject.cpp:465
Json::Value getJson(JsonOptions=JsonOptions::none) const override
Definition STObject.cpp:834
uint256 getFieldH256(SField const &field) const
Definition STObject.cpp:626
static constexpr TERSubset fromInt(int from)
Definition TER.h:414
void setParentBatchID(std::optional< uint256 > const &id)
Definition TxMeta.h:103
STArray const & getNodes() const
Definition TxMeta.h:75
STArray & getNodes()
Definition TxMeta.h:70
std::optional< uint256 > parentBatchID_
Definition TxMeta.h:115
std::optional< STAmount > deliveredAmount_
Definition TxMeta.h:114
std::uint32_t index_
Definition TxMeta.h:111
std::uint32_t getIndex() const
Definition TxMeta.h:43
int getResult() const
Definition TxMeta.h:33
STArray nodes_
Definition TxMeta.h:117
void setAffectedNode(uint256 const &, SField const &type, std::uint16_t nodeType)
Definition TxMeta.cpp:66
STObject getAsObject() const
Definition TxMeta.cpp:201
uint256 transactionID_
Definition TxMeta.h:109
std::uint32_t getLgrSeq() const
Definition TxMeta.h:28
void setDeliveredAmount(std::optional< STAmount > const &amount)
Definition TxMeta.h:97
Json::Value getJson(JsonOptions p) const
Definition TxMeta.h:60
TER getResultTER() const
Definition TxMeta.h:38
uint256 const & getTxID() const
Definition TxMeta.h:23
void setAdditionalFields(STObject const &obj)
Definition TxMeta.h:81
std::uint32_t ledgerSeq_
Definition TxMeta.h:110
boost::container::flat_set< AccountID > getAffectedAccounts() const
Return a list of accounts affected by this transaction.
Definition TxMeta.cpp:93
void addRaw(Serializer &, TER, std::uint32_t index)
Definition TxMeta.cpp:218
STObject & getAffectedNode(SLE::ref node, SField const &type)
Definition TxMeta.cpp:165
std::optional< STAmount > const & getDeliveredAmount() const
Definition TxMeta.h:91
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ transactionID
transaction plus signature to give transaction ID
Note, should be treated as flags that can be | and &.
Definition STBase.h:18