rippled
Loading...
Searching...
No Matches
SignerEntries.h
1#pragma once
2
3#include <xrpl/basics/Expected.h> //
4#include <xrpl/beast/utility/Journal.h> // beast::Journal
5#include <xrpl/protocol/TER.h> // temMALFORMED
6#include <xrpl/protocol/UintTypes.h> // AccountID
7#include <xrpl/tx/Transactor.h> // NotTEC
8
9#include <optional>
10#include <string_view>
11
12namespace xrpl {
13
14// Forward declarations
15class STObject;
16
17// Support for SignerEntries that is needed by a few Transactors.
18//
19// SignerEntries is represented as a std::vector<SignerEntries::SignerEntry>.
20// There is no direct constructor for SignerEntries.
21//
22// o A std::vector<SignerEntries::SignerEntry> is a SignerEntries.
23// o More commonly, SignerEntries are extracted from an STObject by
24// calling SignerEntries::deserialize().
26{
27public:
28 explicit SignerEntries() = delete;
29
31 {
35
37 AccountID const& inAccount,
38 std::uint16_t inWeight,
40 : account(inAccount), weight(inWeight), tag(inTag)
41 {
42 }
43
44 // For sorting to look for duplicate accounts
45 friend bool
46 operator<(SignerEntry const& lhs, SignerEntry const& rhs)
47 {
48 return lhs.account < rhs.account;
49 }
50
51 friend bool
52 operator==(SignerEntry const& lhs, SignerEntry const& rhs)
53 {
54 return lhs.account == rhs.account;
55 }
56 };
57
58 // Deserialize a SignerEntries array from the network or from the ledger.
59 //
60 // obj Contains a SignerEntries field that is an STArray.
61 // journal For reporting error conditions.
62 // annotation Source of SignerEntries, like "ledger" or "transaction".
64 deserialize(STObject const& obj, beast::Journal journal, std::string_view annotation);
65};
66
67} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
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:5
SignerEntry(AccountID const &inAccount, std::uint16_t inWeight, std::optional< uint256 > inTag)
friend bool operator<(SignerEntry const &lhs, SignerEntry const &rhs)
friend bool operator==(SignerEntry const &lhs, SignerEntry const &rhs)
std::optional< uint256 > tag