rippled
InnerObjectFormats.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 <ripple/protocol/InnerObjectFormats.h>
21 #include <ripple/protocol/SField.h>
22 #include <ripple/protocol/SOTemplate.h>
23 
24 namespace ripple {
25 
27 {
30  {
31  {sfAccount, soeREQUIRED},
32  {sfSignerWeight, soeREQUIRED},
33  {sfWalletLocator, soeOPTIONAL},
34  });
35 
36  add(sfSigner.jsonName.c_str(),
37  sfSigner.getCode(),
38  {
39  {sfAccount, soeREQUIRED},
40  {sfSigningPubKey, soeREQUIRED},
41  {sfTxnSignature, soeREQUIRED},
42  });
43 
44  add(sfMajority.jsonName.c_str(),
45  sfMajority.getCode(),
46  {
47  {sfAmendment, soeREQUIRED},
48  {sfCloseTime, soeREQUIRED},
49  });
50 
53  {
54  {sfPublicKey, soeREQUIRED},
55  {sfFirstLedgerSequence, soeREQUIRED},
56  });
57 
58  add(sfNFToken.jsonName.c_str(),
60  {
61  {sfNFTokenID, soeREQUIRED},
62  {sfURI, soeOPTIONAL},
63  });
64 
67  {
68  {sfAccount, soeREQUIRED},
69  {sfTradingFee, soeDEFAULT},
70  {sfVoteWeight, soeREQUIRED},
71  });
72 
75  {{sfAccount, soeREQUIRED},
76  {sfExpiration, soeREQUIRED},
77  {sfDiscountedFee, soeDEFAULT},
78  {sfPrice, soeREQUIRED},
79  {sfAuthAccounts, soeOPTIONAL}});
80 
83  {
84  {sfAttestationSignerAccount, soeREQUIRED},
85  {sfPublicKey, soeREQUIRED},
86  {sfSignature, soeREQUIRED},
87  {sfAmount, soeREQUIRED},
88  {sfAccount, soeREQUIRED},
89  {sfAttestationRewardAccount, soeREQUIRED},
90  {sfWasLockingChainSend, soeREQUIRED},
91  {sfXChainClaimID, soeREQUIRED},
92  {sfDestination, soeOPTIONAL},
93  });
94 
97  {
98  {sfAttestationSignerAccount, soeREQUIRED},
99  {sfPublicKey, soeREQUIRED},
100  {sfSignature, soeREQUIRED},
101  {sfAmount, soeREQUIRED},
102  {sfAccount, soeREQUIRED},
103  {sfAttestationRewardAccount, soeREQUIRED},
104  {sfWasLockingChainSend, soeREQUIRED},
105  {sfXChainAccountCreateCount, soeREQUIRED},
106  {sfDestination, soeREQUIRED},
107  {sfSignatureReward, soeREQUIRED},
108  });
109 
112  {
113  {sfAttestationSignerAccount, soeREQUIRED},
114  {sfPublicKey, soeREQUIRED},
115  {sfAmount, soeREQUIRED},
116  {sfAttestationRewardAccount, soeREQUIRED},
117  {sfWasLockingChainSend, soeREQUIRED},
118  {sfDestination, soeOPTIONAL},
119  });
120 
123  {
124  {sfAttestationSignerAccount, soeREQUIRED},
125  {sfPublicKey, soeREQUIRED},
126  {sfAmount, soeREQUIRED},
127  {sfSignatureReward, soeREQUIRED},
128  {sfAttestationRewardAccount, soeREQUIRED},
129  {sfWasLockingChainSend, soeREQUIRED},
130  {sfDestination, soeREQUIRED},
131  });
132 
135  {
136  {sfAccount, soeREQUIRED},
137  });
138 }
139 
140 InnerObjectFormats const&
141 InnerObjectFormats::getInstance()
142 {
143  static InnerObjectFormats instance;
144  return instance;
145 }
146 
147 SOTemplate const*
148 InnerObjectFormats::findSOTemplateBySField(SField const& sField) const
149 {
150  auto itemPtr = findByType(sField.getCode());
151  if (itemPtr)
152  return &(itemPtr->getSOTemplate());
153 
154  return nullptr;
155 }
156 
157 } // namespace ripple
ripple::InnerObjectFormats::InnerObjectFormats
InnerObjectFormats()
Create the object.
Definition: InnerObjectFormats.cpp:26
ripple::sfVoteEntry
const SField sfVoteEntry
ripple::sfXChainCreateAccountAttestationCollectionElement
const SField sfXChainCreateAccountAttestationCollectionElement
Json::StaticString::c_str
constexpr const char * c_str() const
Definition: json_value.h:73
ripple::SField::jsonName
const Json::StaticString jsonName
Definition: SField.h:141
ripple::SOTemplate
Defines the fields and their attributes within a STObject.
Definition: SOTemplate.h:82
ripple::sfXChainClaimProofSig
const SField sfXChainClaimProofSig
ripple::sfXChainCreateAccountProofSig
const SField sfXChainCreateAccountProofSig
ripple::sfSigner
const SField sfSigner
ripple::sfSignerEntry
const SField sfSignerEntry
ripple::sfNFToken
const SField sfNFToken
ripple::InnerObjectFormats
Manages the list of known inner object formats.
Definition: InnerObjectFormats.h:29
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::SField
Identifies fields.
Definition: SField.h:117
ripple::sfAuthAccount
const SField sfAuthAccount
ripple::sfXChainClaimAttestationCollectionElement
const SField sfXChainClaimAttestationCollectionElement
ripple::sfDisabledValidator
const SField sfDisabledValidator
ripple::SField::getCode
int getCode() const
Definition: SField.h:226
ripple::sfAuctionSlot
const SField sfAuctionSlot
ripple::KnownFormats< int, InnerObjectFormats >::add
Item const & add(char const *name, int type, std::initializer_list< SOElement > uniqueFields, std::initializer_list< SOElement > commonFields={})
Add a new format.
Definition: KnownFormats.h:170