rippled
Loading...
Searching...
No Matches
SignerEntries.h
1#ifndef XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED
2#define XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED
3
4#include <xrpld/app/tx/detail/Transactor.h> // NotTEC
5
6#include <xrpl/basics/Expected.h> //
7#include <xrpl/beast/utility/Journal.h> // beast::Journal
8#include <xrpl/protocol/TER.h> // temMALFORMED
9#include <xrpl/protocol/UintTypes.h> // AccountID
10
11#include <optional>
12#include <string_view>
13
14namespace ripple {
15
16// Forward declarations
17class STObject;
18
19// Support for SignerEntries that is needed by a few Transactors.
20//
21// SignerEntries is represented as a std::vector<SignerEntries::SignerEntry>.
22// There is no direct constructor for SignerEntries.
23//
24// o A std::vector<SignerEntries::SignerEntry> is a SignerEntries.
25// o More commonly, SignerEntries are extracted from an STObject by
26// calling SignerEntries::deserialize().
28{
29public:
30 explicit SignerEntries() = delete;
31
33 {
37
39 AccountID const& inAccount,
40 std::uint16_t inWeight,
42 : account(inAccount), weight(inWeight), tag(inTag)
43 {
44 }
45
46 // For sorting to look for duplicate accounts
47 friend bool
48 operator<(SignerEntry const& lhs, SignerEntry const& rhs)
49 {
50 return lhs.account < rhs.account;
51 }
52
53 friend bool
54 operator==(SignerEntry const& lhs, SignerEntry const& rhs)
55 {
56 return lhs.account == rhs.account;
57 }
58 };
59
60 // Deserialize a SignerEntries array from the network or from the ledger.
61 //
62 // obj Contains a SignerEntries field that is an STArray.
63 // journal For reporting error conditions.
64 // annotation Source of SignerEntries, like "ledger" or "transaction".
67 STObject const& obj,
68 beast::Journal journal,
69 std::string_view annotation);
70};
71
72} // namespace ripple
73
74#endif // XRPL_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED
A generic endpoint for log messages.
Definition Journal.h:41
static Expected< std::vector< SignerEntry >, NotTEC > deserialize(STObject const &obj, beast::Journal journal, std::string_view annotation)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
friend bool operator<(SignerEntry const &lhs, SignerEntry const &rhs)
friend bool operator==(SignerEntry const &lhs, SignerEntry const &rhs)
SignerEntry(AccountID const &inAccount, std::uint16_t inWeight, std::optional< uint256 > inTag)
std::optional< uint256 > tag