rippled
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 <ripple/protocol/TxFormats.h>
21 #include <ripple/protocol/jss.h>
22 
23 namespace ripple {
24 
26 {
27  // Fields shared by all txFormats:
28  static const std::initializer_list<SOElement> commonFields{
34  {sfPreviousTxnID, soeOPTIONAL}, // emulate027
37  {sfFee, soeREQUIRED},
42  {sfSigners, soeOPTIONAL}, // submit_multisigned
44  };
45 
46  add(jss::AccountSet,
48  {
60  },
61  commonFields);
62 
63  add(jss::TrustSet,
65  {
70  },
71  commonFields);
72 
73  add(jss::OfferCreate,
75  {
81  },
82  commonFields);
83 
84  add(jss::OfferCancel,
86  {
89  },
90  commonFields);
91 
92  add(jss::SetRegularKey,
94  {
97  },
98  commonFields);
99 
100  add(jss::Payment,
101  ttPAYMENT,
102  {
106  {sfPaths, soeDEFAULT},
111  },
112  commonFields);
113 
114  add(jss::EscrowCreate,
116  {
124  },
125  commonFields);
126 
127  add(jss::EscrowFinish,
129  {
130  {sfOwner, soeREQUIRED},
135  },
136  commonFields);
137 
138  add(jss::EscrowCancel,
140  {
141  {sfOwner, soeREQUIRED},
144  },
145  commonFields);
146 
147  add(jss::EnableAmendment,
148  ttAMENDMENT,
149  {
152  },
153  commonFields);
154 
155  add(jss::SetFee,
156  ttFEE,
157  {
159  // Old version uses raw numbers
164  // New version uses Amounts
168  },
169  commonFields);
170 
171  add(jss::UNLModify,
172  ttUNL_MODIFY,
173  {
177  },
178  commonFields);
179 
180  add(jss::TicketCreate,
182  {
185  },
186  commonFields);
187 
188  // The SignerEntries are optional because a SignerList is deleted by
189  // setting the SignerQuorum to zero and omitting SignerEntries.
190  add(jss::SignerListSet,
192  {
196  },
197  commonFields);
198 
199  add(jss::PaymentChannelCreate,
201  {
209  },
210  commonFields);
211 
212  add(jss::PaymentChannelFund,
214  {
219  },
220  commonFields);
221 
222  add(jss::PaymentChannelClaim,
224  {
231  },
232  commonFields);
233 
234  add(jss::CheckCreate,
236  {
243  },
244  commonFields);
245 
246  add(jss::CheckCash,
247  ttCHECK_CASH,
248  {
253  },
254  commonFields);
255 
256  add(jss::CheckCancel,
258  {
261  },
262  commonFields);
263 
264  add(jss::AccountDelete,
266  {
270  },
271  commonFields);
272 
273  add(jss::DepositPreauth,
275  {
279  },
280  commonFields);
281 
282  add(jss::NFTokenMint,
284  {
288  {sfURI, soeOPTIONAL},
290  },
291  commonFields);
292 
293  add(jss::NFTokenBurn,
295  {
297  {sfOwner, soeOPTIONAL},
299  },
300  commonFields);
301 
302  add(jss::NFTokenCreateOffer,
304  {
308  {sfOwner, soeOPTIONAL},
311  },
312  commonFields);
313 
314  add(jss::NFTokenCancelOffer,
316  {
319  },
320  commonFields);
321 
322  add(jss::NFTokenAcceptOffer,
324  {
329  },
330  commonFields);
331 }
332 
333 TxFormats const&
335 {
336  static TxFormats const instance;
337  return instance;
338 }
339 
340 } // namespace ripple
ripple::ttNFTOKEN_CREATE_OFFER
@ ttNFTOKEN_CREATE_OFFER
This transaction creates a new offer to buy or sell an NFT.
Definition: TxFormats.h:134
ripple::sfOfferSequence
const SF_UINT32 sfOfferSequence
ripple::ttACCOUNT_DELETE
@ ttACCOUNT_DELETE
This transaction type deletes an existing account.
Definition: TxFormats.h:122
ripple::sfPaths
const SField sfPaths
ripple::sfUNLModifyValidator
const SF_VL sfUNLModifyValidator
ripple::sfSourceTag
const SF_UINT32 sfSourceTag
ripple::sfBaseFeeDrops
const SF_AMOUNT sfBaseFeeDrops
ripple::sfReserveBase
const SF_UINT32 sfReserveBase
ripple::sfSendMax
const SF_AMOUNT sfSendMax
ripple::sfSigners
const SField sfSigners
ripple::sfLedgerSequence
const SF_UINT32 sfLedgerSequence
ripple::sfNFTokenOffers
const SF_VECTOR256 sfNFTokenOffers
ripple::sfDestination
const SF_ACCOUNT sfDestination
ripple::ttREGULAR_KEY_SET
@ ttREGULAR_KEY_SET
This transaction type sets or clears an account's "regular key".
Definition: TxFormats.h:74
ripple::sfAmount
const SF_AMOUNT sfAmount
ripple::sfNFTokenID
const SF_UINT256 sfNFTokenID
ripple::sfWalletSize
const SF_UINT32 sfWalletSize
ripple::sfCheckID
const SF_UINT256 sfCheckID
ripple::ttSIGNER_LIST_SET
@ ttSIGNER_LIST_SET
This transaction type modifies the signer list associated with an account.
Definition: TxFormats.h:95
ripple::sfQualityOut
const SF_UINT32 sfQualityOut
ripple::sfOwner
const SF_ACCOUNT sfOwner
ripple::sfSequence
const SF_UINT32 sfSequence
ripple::sfRegularKey
const SF_ACCOUNT sfRegularKey
ripple::ttESCROW_CANCEL
@ ttESCROW_CANCEL
This transaction type cancels an existing escrow.
Definition: TxFormats.h:71
ripple::sfSigningPubKey
const SF_VL sfSigningPubKey
ripple::ttFEE
@ ttFEE
This system-generated transaction type is used to update the network's fee settings.
Definition: TxFormats.h:152
ripple::ttOFFER_CANCEL
@ ttOFFER_CANCEL
This transaction type cancels existing offers to trade one asset for another.
Definition: TxFormats.h:83
ripple::ttPAYCHAN_CREATE
@ ttPAYCHAN_CREATE
This transaction type creates a new unidirectional XRP payment channel.
Definition: TxFormats.h:98
ripple::sfQualityIn
const SF_UINT32 sfQualityIn
ripple::sfSetFlag
const SF_UINT32 sfSetFlag
ripple::soeREQUIRED
@ soeREQUIRED
Definition: SOTemplate.h:35
ripple::sfTicketSequence
const SF_UINT32 sfTicketSequence
ripple::ttNFTOKEN_ACCEPT_OFFER
@ ttNFTOKEN_ACCEPT_OFFER
This transaction accepts an existing offer to buy or sell an existing NFT.
Definition: TxFormats.h:140
ripple::ttAMENDMENT
@ ttAMENDMENT
This system-generated transaction type is used to update the status of the various amendments.
Definition: TxFormats.h:146
ripple::sfTransferFee
const SF_UINT16 sfTransferFee
ripple::ttCHECK_CANCEL
@ ttCHECK_CANCEL
This transaction type cancels an existing check.
Definition: TxFormats.h:113
ripple::sfExpiration
const SF_UINT32 sfExpiration
ripple::sfSignerQuorum
const SF_UINT32 sfSignerQuorum
ripple::ttPAYMENT
@ ttPAYMENT
This transaction type executes a payment.
Definition: TxFormats.h:59
ripple::sfTakerPays
const SF_AMOUNT sfTakerPays
ripple::sfTransactionType
const SF_UINT16 sfTransactionType
ripple::sfDeliverMin
const SF_AMOUNT sfDeliverMin
ripple::sfLimitAmount
const SF_AMOUNT sfLimitAmount
ripple::ttUNL_MODIFY
@ ttUNL_MODIFY
This system-generated transaction type is used to update the network's negative UNL.
Definition: TxFormats.h:158
ripple::sfSettleDelay
const SF_UINT32 sfSettleDelay
ripple::sfUnauthorize
const SF_ACCOUNT sfUnauthorize
ripple::sfMemos
const SField sfMemos
ripple::ttCHECK_CREATE
@ ttCHECK_CREATE
This transaction type creates a new check.
Definition: TxFormats.h:107
ripple::TxFormats::getInstance
static TxFormats const & getInstance()
Definition: TxFormats.cpp:334
ripple::sfNFTokenMinter
const SF_ACCOUNT sfNFTokenMinter
ripple::ttTRUST_SET
@ ttTRUST_SET
This transaction type modifies a trustline between two accounts.
Definition: TxFormats.h:119
ripple::sfReserveIncrement
const SF_UINT32 sfReserveIncrement
ripple::soeOPTIONAL
@ soeOPTIONAL
Definition: SOTemplate.h:36
ripple::TxFormats::TxFormats
TxFormats()
Create the object.
Definition: TxFormats.cpp:25
ripple::ttNFTOKEN_MINT
@ ttNFTOKEN_MINT
This transaction mints a new NFT.
Definition: TxFormats.h:128
ripple::ttESCROW_CREATE
@ ttESCROW_CREATE
This transaction type creates an escrow object.
Definition: TxFormats.h:62
ripple::sfTicketCount
const SF_UINT32 sfTicketCount
ripple::sfAccountTxnID
const SF_UINT256 sfAccountTxnID
ripple::ttESCROW_FINISH
@ ttESCROW_FINISH
This transaction type completes an existing escrow.
Definition: TxFormats.h:65
ripple::sfTakerGets
const SF_AMOUNT sfTakerGets
ripple::sfTransferRate
const SF_UINT32 sfTransferRate
ripple::sfTickSize
const SF_UINT8 sfTickSize
ripple::sfPreviousTxnID
const SF_UINT256 sfPreviousTxnID
ripple::sfAuthorize
const SF_ACCOUNT sfAuthorize
ripple::sfReserveIncrementDrops
const SF_AMOUNT sfReserveIncrementDrops
ripple::sfClearFlag
const SF_UINT32 sfClearFlag
ripple::TxFormats
Manages the list of known transaction formats.
Definition: TxFormats.h:164
ripple::sfReserveBaseDrops
const SF_AMOUNT sfReserveBaseDrops
ripple::ttNFTOKEN_CANCEL_OFFER
@ ttNFTOKEN_CANCEL_OFFER
This transaction cancels an existing offer to buy or sell an existing NFT.
Definition: TxFormats.h:137
ripple::ttOFFER_CREATE
@ ttOFFER_CREATE
This transaction type creates an offer to trade one asset for another.
Definition: TxFormats.h:80
ripple::sfUNLModifyDisabling
const SF_UINT8 sfUNLModifyDisabling
ripple::sfEmailHash
const SF_UINT128 sfEmailHash
ripple::ttACCOUNT_SET
@ ttACCOUNT_SET
This transaction type adjusts various account settings.
Definition: TxFormats.h:68
ripple::sfSignerEntries
const SField sfSignerEntries
ripple::sfOperationLimit
const SF_UINT32 sfOperationLimit
ripple::sfBaseFee
const SF_UINT64 sfBaseFee
ripple::sfNFTokenBuyOffer
const SF_UINT256 sfNFTokenBuyOffer
ripple::sfTxnSignature
const SF_VL sfTxnSignature
ripple::sfURI
const SF_VL sfURI
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::sfWalletLocator
const SF_UINT256 sfWalletLocator
ripple::sfCondition
const SF_VL sfCondition
ripple::sfIssuer
const SF_ACCOUNT sfIssuer
ripple::ttDEPOSIT_PREAUTH
@ ttDEPOSIT_PREAUTH
This transaction type grants or revokes authorization to transfer funds.
Definition: TxFormats.h:116
ripple::sfInvoiceID
const SF_UINT256 sfInvoiceID
ripple::sfFlags
const SF_UINT32 sfFlags
ripple::sfDestinationTag
const SF_UINT32 sfDestinationTag
ripple::ttCHECK_CASH
@ ttCHECK_CASH
This transaction type cashes an existing check.
Definition: TxFormats.h:110
ripple::sfSignature
const SF_VL sfSignature
ripple::ttPAYCHAN_FUND
@ ttPAYCHAN_FUND
This transaction type funds an existing unidirectional XRP payment channel.
Definition: TxFormats.h:101
ripple::sfBalance
const SF_AMOUNT sfBalance
ripple::sfReferenceFeeUnits
const SF_UINT32 sfReferenceFeeUnits
ripple::ttPAYCHAN_CLAIM
@ ttPAYCHAN_CLAIM
This transaction type submits a claim against an existing unidirectional payment channel.
Definition: TxFormats.h:104
ripple::sfCancelAfter
const SF_UINT32 sfCancelAfter
ripple::sfMessageKey
const SF_VL sfMessageKey
ripple::ttNFTOKEN_BURN
@ ttNFTOKEN_BURN
This transaction burns (i.e.
Definition: TxFormats.h:131
ripple::sfFinishAfter
const SF_UINT32 sfFinishAfter
ripple::sfChannel
const SF_UINT256 sfChannel
ripple::sfNFTokenTaxon
const SF_UINT32 sfNFTokenTaxon
ripple::sfFee
const SF_AMOUNT sfFee
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::sfNetworkID
const SF_UINT32 sfNetworkID
ripple::sfDomain
const SF_VL sfDomain
ripple::sfLastLedgerSequence
const SF_UINT32 sfLastLedgerSequence
ripple::sfAmendment
const SF_UINT256 sfAmendment
ripple::sfFulfillment
const SF_VL sfFulfillment
ripple::sfPublicKey
const SF_VL sfPublicKey
ripple::sfNFTokenSellOffer
const SF_UINT256 sfNFTokenSellOffer
ripple::ttTICKET_CREATE
@ ttTICKET_CREATE
This transaction type creates a new set of tickets.
Definition: TxFormats.h:89
ripple::soeDEFAULT
@ soeDEFAULT
Definition: SOTemplate.h:37
ripple::sfNFTokenBrokerFee
const SF_AMOUNT sfNFTokenBrokerFee
ripple::KnownFormats< TxType, TxFormats >::add
Item const & add(char const *name, TxType type, std::initializer_list< SOElement > uniqueFields, std::initializer_list< SOElement > commonFields={})
Add a new format.
Definition: KnownFormats.h:170
std::initializer_list