xrpld
Loading...
Searching...
No Matches
InnerObjectFormats.cpp
1#include <xrpl/protocol/InnerObjectFormats.h>
2
3#include <xrpl/protocol/SField.h>
4#include <xrpl/protocol/SOTemplate.h>
5
6namespace xrpl {
7
9{
10 // inner objects with the default fields have to be
11 // constructed with STObject::makeInnerObject()
12
13 add(sfSignerEntry.jsonName,
14 sfSignerEntry.getCode(),
15 {
16 {sfAccount, SoeRequired},
17 {sfSignerWeight, SoeRequired},
18 {sfWalletLocator, SoeOptional},
19 });
20
21 add(sfSigner.jsonName,
22 sfSigner.getCode(),
23 {
24 {sfAccount, SoeRequired},
25 {sfSigningPubKey, SoeRequired},
26 {sfTxnSignature, SoeRequired},
27 });
28
29 add(sfMajority.jsonName,
30 sfMajority.getCode(),
31 {
32 {sfAmendment, SoeRequired},
33 {sfCloseTime, SoeRequired},
34 });
35
36 add(sfDisabledValidator.jsonName,
37 sfDisabledValidator.getCode(),
38 {
39 {sfPublicKey, SoeRequired},
40 {sfFirstLedgerSequence, SoeRequired},
41 });
42
43 add(sfNFToken.jsonName,
44 sfNFToken.getCode(),
45 {
46 {sfNFTokenID, SoeRequired},
47 {sfURI, SoeOptional},
48 });
49
50 add(sfVoteEntry.jsonName,
51 sfVoteEntry.getCode(),
52 {
53 {sfAccount, SoeRequired},
54 {sfTradingFee, SoeDefault},
55 {sfVoteWeight, SoeRequired},
56 });
57
58 add(sfAuctionSlot.jsonName,
59 sfAuctionSlot.getCode(),
60 {
61 {sfAccount, SoeRequired},
62 {sfExpiration, SoeRequired},
63 {sfDiscountedFee, SoeDefault},
64 {sfPrice, SoeRequired},
65 {sfAuthAccounts, SoeOptional},
66 });
67
68 add(sfAuthAccount.jsonName,
69 sfAuthAccount.getCode(),
70 {
71 {sfAccount, SoeRequired},
72 });
73
74 add(sfPriceData.jsonName,
75 sfPriceData.getCode(),
76 {
77 {sfBaseAsset, SoeRequired},
78 {sfQuoteAsset, SoeRequired},
79 {sfAssetPrice, SoeOptional},
80 {sfScale, SoeDefault},
81 });
82
83 add(sfCredential.jsonName,
84 sfCredential.getCode(),
85 {
86 {sfIssuer, SoeRequired},
87 {sfCredentialType, SoeRequired},
88 });
89
90 add(sfPermission.jsonName, sfPermission.getCode(), {{sfPermissionValue, SoeRequired}});
91
92 add(sfBatchSigner.jsonName,
93 sfBatchSigner.getCode(),
94 {
95 {sfAccount, SoeRequired},
96 {sfSigningPubKey, SoeOptional},
97 {sfTxnSignature, SoeOptional},
98 {sfSigners, SoeOptional},
99 });
100
101 add(sfBook.jsonName,
102 sfBook.getCode(),
103 {
104 {sfBookDirectory, SoeRequired},
105 {sfBookNode, SoeRequired},
106 });
107
108 add(sfCounterpartySignature.jsonName,
109 sfCounterpartySignature.getCode(),
110 {
111 {sfSigningPubKey, SoeOptional},
112 {sfTxnSignature, SoeOptional},
113 {sfSigners, SoeOptional},
114 });
115
116 add(sfSponsorSignature.jsonName,
117 sfSponsorSignature.getCode(),
118 {
119 {sfSigningPubKey, SoeOptional},
120 {sfTxnSignature, SoeOptional},
121 {sfSigners, SoeOptional},
122 });
123}
124
125InnerObjectFormats const&
127{
128 static InnerObjectFormats const kInstance;
129 return kInstance;
130}
131
132SOTemplate const*
134{
135 auto itemPtr = findByType(sField.getCode());
136 if (itemPtr != nullptr)
137 return &itemPtr->getSOTemplate();
138
139 return nullptr;
140}
141
142} // namespace xrpl
SOTemplate const * findSOTemplateBySField(SField const &sField) const
static InnerObjectFormats const & getInstance()
InnerObjectFormats()
Create the object.
Item const & add(char const *name, int type, std::vector< SOElement > uniqueFields, std::vector< SOElement > commonFields={})
Item const * findByType(int type) const
Identifies fields.
Definition SField.h:131
int getCode() const
Definition SField.h:248
Defines the fields and their attributes within a STObject.
Definition SOTemplate.h:105
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5