xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
tx
SignerEntries.h
1
#pragma once
2
3
#include <xrpl/basics/base_uint.h>
4
#include <xrpl/beast/utility/Journal.h>
// beast::Journal
5
#include <xrpl/protocol/AccountID.h>
6
#include <xrpl/protocol/TER.h>
// temMALFORMED
7
8
#include <
cstdint
>
9
#include <expected>
10
#include <
optional
>
11
#include <
string_view
>
12
#include <
vector
>
13
14
namespace
xrpl
{
15
16
// Forward declarations
17
class
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().
27
class
SignerEntries
28
{
29
public
:
30
explicit
SignerEntries
() =
delete
;
31
32
struct
SignerEntry
33
{
34
AccountID
account
;
35
std::uint16_t
weight
;
36
std::optional<UInt256>
tag
;
37
38
SignerEntry
(
39
AccountID
const
& inAccount,
40
std::uint16_t
inWeight,
41
std::optional<UInt256>
inTag)
42
:
account
(inAccount),
weight
(inWeight),
tag
(inTag)
43
{
44
}
45
46
// For sorting to look for duplicate accounts
47
friend
auto
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".
65
static
std::expected<std::vector<SignerEntry>,
NotTEC
>
66
deserialize
(
STObject
const
& obj,
beast::Journal
journal,
std::string_view
annotation);
67
};
68
69
}
// namespace xrpl
std::string_view
beast::Journal
A generic endpoint for log messages.
Definition
Journal.h:44
xrpl::STObject
Definition
STObject.h:49
xrpl::SignerEntries::deserialize
static std::expected< std::vector< SignerEntry >, NotTEC > deserialize(STObject const &obj, beast::Journal journal, std::string_view annotation)
Definition
SignerEntries.cpp:22
xrpl::SignerEntries::SignerEntries
SignerEntries()=delete
cstdint
std::uint16_t
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::NotTEC
TERSubset< CanCvtToNotTEC > NotTEC
Definition
TER.h:614
xrpl::AccountID
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition
AccountID.h:34
optional
string_view
xrpl::SignerEntries::SignerEntry::account
AccountID account
Definition
SignerEntries.h:34
xrpl::SignerEntries::SignerEntry::operator==
friend bool operator==(SignerEntry const &lhs, SignerEntry const &rhs)
Definition
SignerEntries.h:54
xrpl::SignerEntries::SignerEntry::tag
std::optional< UInt256 > tag
Definition
SignerEntries.h:36
xrpl::SignerEntries::SignerEntry::operator<=>
friend auto operator<=>(SignerEntry const &lhs, SignerEntry const &rhs)
Definition
SignerEntries.h:48
xrpl::SignerEntries::SignerEntry::SignerEntry
SignerEntry(AccountID const &inAccount, std::uint16_t inWeight, std::optional< UInt256 > inTag)
Definition
SignerEntries.h:38
xrpl::SignerEntries::SignerEntry::weight
std::uint16_t weight
Definition
SignerEntries.h:35
vector
Generated by
1.17.0