rippled
Loading...
Searching...
No Matches
TxFormats.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#include <xrpl/protocol/SField.h>
21#include <xrpl/protocol/SOTemplate.h>
22#include <xrpl/protocol/TxFormats.h>
23#include <xrpl/protocol/jss.h>
24
25#include <initializer_list>
26
27namespace ripple {
28
30{
31 // Fields shared by all txFormats:
32 static std::initializer_list<SOElement> const commonFields{
33 {sfTransactionType, soeREQUIRED},
34 {sfFlags, soeOPTIONAL},
35 {sfSourceTag, soeOPTIONAL},
36 {sfAccount, soeREQUIRED},
37 {sfSequence, soeREQUIRED},
38 {sfPreviousTxnID, soeOPTIONAL}, // emulate027
39 {sfLastLedgerSequence, soeOPTIONAL},
40 {sfAccountTxnID, soeOPTIONAL},
41 {sfFee, soeREQUIRED},
42 {sfOperationLimit, soeOPTIONAL},
43 {sfMemos, soeOPTIONAL},
44 {sfSigningPubKey, soeREQUIRED},
45 {sfTicketSequence, soeOPTIONAL},
46 {sfTxnSignature, soeOPTIONAL},
47 {sfSigners, soeOPTIONAL}, // submit_multisigned
48 {sfNetworkID, soeOPTIONAL},
49 {sfDelegate, soeOPTIONAL},
50 };
51
52#pragma push_macro("UNWRAP")
53#undef UNWRAP
54#pragma push_macro("TRANSACTION")
55#undef TRANSACTION
56
57#define UNWRAP(...) __VA_ARGS__
58#define TRANSACTION( \
59 tag, value, name, delegatable, amendment, privileges, fields) \
60 add(jss::name, tag, UNWRAP fields, commonFields);
61
62#include <xrpl/protocol/detail/transactions.macro>
63
64#undef TRANSACTION
65#pragma pop_macro("TRANSACTION")
66#undef UNWRAP
67#pragma pop_macro("UNWRAP")
68}
69
70TxFormats const&
72{
73 static TxFormats const instance;
74 return instance;
75}
76
77} // namespace ripple
Manages the list of known transaction formats.
Definition TxFormats.h:86
static TxFormats const & getInstance()
Definition TxFormats.cpp:71
TxFormats()
Create the object.
Definition TxFormats.cpp:29
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
@ soeOPTIONAL
Definition SOTemplate.h:36
@ soeREQUIRED
Definition SOTemplate.h:35