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