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