xrpld
Loading...
Searching...
No Matches
LedgerFormats.cpp
1#include <xrpl/protocol/LedgerFormats.h>
2
3#include <xrpl/protocol/SField.h>
4#include <xrpl/protocol/SOTemplate.h>
5#include <xrpl/protocol/jss.h> // IWYU pragma: keep
6
7#include <vector>
8
9namespace xrpl {
10
11std::vector<SOElement> const&
13{
14 static auto const kCommonFields = std::vector<SOElement>{
15 {sfLedgerIndex, SoeOptional},
16 {sfLedgerEntryType, SoeRequired},
17 {sfFlags, SoeRequired},
18 {sfSponsor, SoeOptional},
19 };
20 return kCommonFields;
21}
22
24{
25#pragma push_macro("UNWRAP")
26#undef UNWRAP
27#pragma push_macro("LEDGER_ENTRY")
28#undef LEDGER_ENTRY
29
30#define UNWRAP(...) __VA_ARGS__
31#define LEDGER_ENTRY(tag, value, name, rpcName, fields) \
32 add(jss::name, tag, UNWRAP fields, getCommonFields());
33
34#include <xrpl/protocol/detail/ledger_entries.macro>
35
36#undef LEDGER_ENTRY
37#pragma pop_macro("LEDGER_ENTRY")
38#undef UNWRAP
39#pragma pop_macro("UNWRAP")
40}
41
42LedgerFormats const&
44{
45 static LedgerFormats const kInstance;
46 return kInstance;
47}
48
49} // namespace xrpl
Holds the list of known ledger entry formats.
static std::vector< SOElement > const & getCommonFields()
LedgerFormats()
Create the object.
static LedgerFormats const & getInstance()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
@ SoeOptional
Definition SOTemplate.h:23
@ SoeRequired
Definition SOTemplate.h:22