rippled
Loading...
Searching...
No Matches
InnerObjectFormats.cpp
1#include <xrpl/protocol/InnerObjectFormats.h>
2#include <xrpl/protocol/SField.h>
3#include <xrpl/protocol/SOTemplate.h>
4
5namespace ripple {
6
8{
9 // inner objects with the default fields have to be
10 // constructed with STObject::makeInnerObject()
11
12 add(sfSignerEntry.jsonName,
13 sfSignerEntry.getCode(),
14 {
15 {sfAccount, soeREQUIRED},
16 {sfSignerWeight, soeREQUIRED},
17 {sfWalletLocator, soeOPTIONAL},
18 });
19
20 add(sfSigner.jsonName,
21 sfSigner.getCode(),
22 {
23 {sfAccount, soeREQUIRED},
24 {sfSigningPubKey, soeREQUIRED},
25 {sfTxnSignature, soeREQUIRED},
26 });
27
28 add(sfMajority.jsonName,
29 sfMajority.getCode(),
30 {
31 {sfAmendment, soeREQUIRED},
32 {sfCloseTime, soeREQUIRED},
33 });
34
35 add(sfDisabledValidator.jsonName,
36 sfDisabledValidator.getCode(),
37 {
38 {sfPublicKey, soeREQUIRED},
39 {sfFirstLedgerSequence, soeREQUIRED},
40 });
41
42 add(sfNFToken.jsonName,
43 sfNFToken.getCode(),
44 {
45 {sfNFTokenID, soeREQUIRED},
46 {sfURI, soeOPTIONAL},
47 });
48
49 add(sfVoteEntry.jsonName,
50 sfVoteEntry.getCode(),
51 {
52 {sfAccount, soeREQUIRED},
53 {sfTradingFee, soeDEFAULT},
54 {sfVoteWeight, soeREQUIRED},
55 });
56
57 add(sfAuctionSlot.jsonName,
58 sfAuctionSlot.getCode(),
59 {{sfAccount, soeREQUIRED},
60 {sfExpiration, soeREQUIRED},
61 {sfDiscountedFee, soeDEFAULT},
62 {sfPrice, soeREQUIRED},
63 {sfAuthAccounts, soeOPTIONAL}});
64
65 add(sfXChainClaimAttestationCollectionElement.jsonName,
66 sfXChainClaimAttestationCollectionElement.getCode(),
67 {
68 {sfAttestationSignerAccount, soeREQUIRED},
69 {sfPublicKey, soeREQUIRED},
70 {sfSignature, soeREQUIRED},
71 {sfAmount, soeREQUIRED},
72 {sfAccount, soeREQUIRED},
73 {sfAttestationRewardAccount, soeREQUIRED},
74 {sfWasLockingChainSend, soeREQUIRED},
75 {sfXChainClaimID, soeREQUIRED},
76 {sfDestination, soeOPTIONAL},
77 });
78
79 add(sfXChainCreateAccountAttestationCollectionElement.jsonName,
80 sfXChainCreateAccountAttestationCollectionElement.getCode(),
81 {
82 {sfAttestationSignerAccount, soeREQUIRED},
83 {sfPublicKey, soeREQUIRED},
84 {sfSignature, soeREQUIRED},
85 {sfAmount, soeREQUIRED},
86 {sfAccount, soeREQUIRED},
87 {sfAttestationRewardAccount, soeREQUIRED},
88 {sfWasLockingChainSend, soeREQUIRED},
89 {sfXChainAccountCreateCount, soeREQUIRED},
90 {sfDestination, soeREQUIRED},
91 {sfSignatureReward, soeREQUIRED},
92 });
93
94 add(sfXChainClaimProofSig.jsonName,
95 sfXChainClaimProofSig.getCode(),
96 {
97 {sfAttestationSignerAccount, soeREQUIRED},
98 {sfPublicKey, soeREQUIRED},
99 {sfAmount, soeREQUIRED},
100 {sfAttestationRewardAccount, soeREQUIRED},
101 {sfWasLockingChainSend, soeREQUIRED},
102 {sfDestination, soeOPTIONAL},
103 });
104
105 add(sfXChainCreateAccountProofSig.jsonName,
106 sfXChainCreateAccountProofSig.getCode(),
107 {
108 {sfAttestationSignerAccount, soeREQUIRED},
109 {sfPublicKey, soeREQUIRED},
110 {sfAmount, soeREQUIRED},
111 {sfSignatureReward, soeREQUIRED},
112 {sfAttestationRewardAccount, soeREQUIRED},
113 {sfWasLockingChainSend, soeREQUIRED},
114 {sfDestination, soeREQUIRED},
115 });
116
117 add(sfAuthAccount.jsonName,
118 sfAuthAccount.getCode(),
119 {
120 {sfAccount, soeREQUIRED},
121 });
122
123 add(sfPriceData.jsonName,
124 sfPriceData.getCode(),
125 {
126 {sfBaseAsset, soeREQUIRED},
127 {sfQuoteAsset, soeREQUIRED},
128 {sfAssetPrice, soeOPTIONAL},
129 {sfScale, soeDEFAULT},
130 });
131
132 add(sfCredential.jsonName,
133 sfCredential.getCode(),
134 {
135 {sfIssuer, soeREQUIRED},
136 {sfCredentialType, soeREQUIRED},
137 });
138
139 add(sfPermission.jsonName.c_str(),
140 sfPermission.getCode(),
141 {{sfPermissionValue, soeREQUIRED}});
142
143 add(sfBatchSigner.jsonName.c_str(),
144 sfBatchSigner.getCode(),
145 {{sfAccount, soeREQUIRED},
146 {sfSigningPubKey, soeOPTIONAL},
147 {sfTxnSignature, soeOPTIONAL},
148 {sfSigners, soeOPTIONAL}});
149
150 add(sfBook.jsonName,
151 sfBook.getCode(),
152 {
153 {sfBookDirectory, soeREQUIRED},
154 {sfBookNode, soeREQUIRED},
155 });
156}
157
158InnerObjectFormats const&
159InnerObjectFormats::getInstance()
160{
161 static InnerObjectFormats instance;
162 return instance;
163}
164
165SOTemplate const*
166InnerObjectFormats::findSOTemplateBySField(SField const& sField) const
167{
168 auto itemPtr = findByType(sField.getCode());
169 if (itemPtr)
170 return &(itemPtr->getSOTemplate());
171
172 return nullptr;
173}
174
175} // namespace ripple
Manages the list of known inner object formats.
InnerObjectFormats()
Create the object.
Item const & add(char const *name, int type, std::initializer_list< SOElement > uniqueFields, std::initializer_list< SOElement > commonFields={})
Add a new format.
Identifies fields.
Definition SField.h:127
int getCode() const
Definition SField.h:243
Defines the fields and their attributes within a STObject.
Definition SOTemplate.h:94
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6