rippled
Loading...
Searching...
No Matches
SignerEntries.cpp
1#include <xrpl/basics/Log.h>
2#include <xrpl/protocol/STArray.h>
3#include <xrpl/protocol/STObject.h>
4#include <xrpl/protocol/STTx.h>
5#include <xrpl/tx/SignerEntries.h>
6
7#include <cstdint>
8#include <optional>
9
10namespace xrpl {
11
12Expected<std::vector<SignerEntries::SignerEntry>, NotTEC>
14{
15 if (!obj.isFieldPresent(sfSignerEntries))
16 {
17 JLOG(journal.trace()) << "Malformed " << annotation << ": Need signer entry array.";
19 }
20
21 std::vector<SignerEntry> accountVec;
23
24 STArray const& sEntries(obj.getFieldArray(sfSignerEntries));
25 for (STObject const& sEntry : sEntries)
26 {
27 // Validate the SignerEntry.
28 if (sEntry.getFName() != sfSignerEntry)
29 {
30 JLOG(journal.trace()) << "Malformed " << annotation << ": Expected SignerEntry.";
32 }
33
34 // Extract SignerEntry fields.
35 AccountID const account = sEntry.getAccountID(sfAccount);
36 std::uint16_t const weight = sEntry.getFieldU16(sfSignerWeight);
37 std::optional<uint256> const tag = sEntry.at(~sfWalletLocator);
38
39 accountVec.emplace_back(account, weight, tag);
40 }
41 return accountVec;
42}
43
44} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
Stream trace() const
Severity stream access functions.
Definition Journal.h:295
STArray const & getFieldArray(SField const &field) const
Definition STObject.cpp:680
bool isFieldPresent(SField const &field) const
Definition STObject.cpp:456
static constexpr std::size_t maxMultiSigners
Definition STTx.h:34
static Expected< std::vector< SignerEntry >, NotTEC > deserialize(STObject const &obj, beast::Journal journal, std::string_view annotation)
T emplace_back(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
@ temMALFORMED
Definition TER.h:67
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:582
T reserve(T... args)