mirror of
https://github.com/Xahau/xahaud.git
synced 2026-09-27 23:48:05 +00:00
Rearrange sources
This commit is contained in:
281
src/libxrpl/protocol/InnerObjectFormats.cpp
Normal file
281
src/libxrpl/protocol/InnerObjectFormats.cpp
Normal file
@@ -0,0 +1,281 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/InnerObjectFormats.h>
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/SOTemplate.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
InnerObjectFormats::InnerObjectFormats()
|
||||
{
|
||||
// inner objects with the default fields have to be
|
||||
// constructed with STObject::makeInnerObject()
|
||||
|
||||
add(sfEmitDetails.jsonName.c_str(),
|
||||
sfEmitDetails.getCode(),
|
||||
{{sfEmitGeneration, soeREQUIRED},
|
||||
{sfEmitBurden, soeREQUIRED},
|
||||
{sfEmitParentTxnID, soeREQUIRED},
|
||||
{sfEmitNonce, soeREQUIRED},
|
||||
{sfEmitCallback, soeOPTIONAL},
|
||||
{sfEmitHookHash, soeREQUIRED}});
|
||||
|
||||
add(sfSignerEntry.jsonName.c_str(),
|
||||
sfSignerEntry.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSignerWeight, soeREQUIRED},
|
||||
{sfWalletLocator, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfSigner.jsonName.c_str(),
|
||||
sfSigner.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfSigningPubKey, soeREQUIRED},
|
||||
{sfTxnSignature, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfMajority.jsonName.c_str(),
|
||||
sfMajority.getCode(),
|
||||
{
|
||||
{sfAmendment, soeREQUIRED},
|
||||
{sfCloseTime, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfDisabledValidator.jsonName.c_str(),
|
||||
sfDisabledValidator.getCode(),
|
||||
{
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfFirstLedgerSequence, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfHookExecution.jsonName.c_str(),
|
||||
sfHookExecution.getCode(),
|
||||
{{sfHookResult, soeREQUIRED},
|
||||
{sfHookHash, soeREQUIRED},
|
||||
{sfHookAccount, soeREQUIRED},
|
||||
{sfHookReturnCode, soeREQUIRED},
|
||||
{sfHookReturnString, soeREQUIRED},
|
||||
{sfHookInstructionCount, soeREQUIRED},
|
||||
{sfHookExecutionIndex, soeREQUIRED},
|
||||
{sfHookStateChangeCount, soeREQUIRED},
|
||||
{sfHookEmitCount, soeREQUIRED},
|
||||
{sfFlags, soeOPTIONAL}});
|
||||
|
||||
add(sfHookEmission.jsonName.c_str(),
|
||||
sfHookEmission.getCode(),
|
||||
{{sfHookHash, soeREQUIRED},
|
||||
{sfHookAccount, soeREQUIRED},
|
||||
{sfEmittedTxnID, soeREQUIRED},
|
||||
{sfEmitNonce, soeOPTIONAL}});
|
||||
|
||||
add(sfHookDefinition.jsonName.c_str(),
|
||||
sfHookDefinition.getCode(),
|
||||
{{sfCreateCode, soeREQUIRED},
|
||||
{sfHookNamespace, soeREQUIRED},
|
||||
{sfHookParameters, soeREQUIRED},
|
||||
{sfHookOn, soeOPTIONAL},
|
||||
{sfHookOnIncoming, soeOPTIONAL},
|
||||
{sfHookOnOutgoing, soeOPTIONAL},
|
||||
{sfHookCanEmit, soeOPTIONAL},
|
||||
{sfHookApiVersion, soeREQUIRED},
|
||||
{sfFlags, soeREQUIRED},
|
||||
{sfFee, soeREQUIRED}});
|
||||
|
||||
add(sfHook.jsonName.c_str(),
|
||||
sfHook.getCode(),
|
||||
{{sfHookHash, soeOPTIONAL},
|
||||
{sfCreateCode, soeOPTIONAL},
|
||||
{sfHookGrants, soeOPTIONAL},
|
||||
{sfHookNamespace, soeOPTIONAL},
|
||||
{sfHookParameters, soeOPTIONAL},
|
||||
{sfHookOn, soeOPTIONAL},
|
||||
{sfHookOnIncoming, soeOPTIONAL},
|
||||
{sfHookOnOutgoing, soeOPTIONAL},
|
||||
{sfHookCanEmit, soeOPTIONAL},
|
||||
{sfHookApiVersion, soeOPTIONAL},
|
||||
{sfFlags, soeOPTIONAL}});
|
||||
|
||||
add(sfHookGrant.jsonName.c_str(),
|
||||
sfHookGrant.getCode(),
|
||||
{{sfHookHash, soeREQUIRED},
|
||||
{sfAuthorize, soeOPTIONAL},
|
||||
{sfFlags, soeOPTIONAL}});
|
||||
|
||||
add(sfHookParameter.jsonName.c_str(),
|
||||
sfHookParameter.getCode(),
|
||||
{{sfHookParameterName, soeREQUIRED},
|
||||
{sfHookParameterValue, soeOPTIONAL}});
|
||||
|
||||
add(sfNFToken.jsonName.c_str(),
|
||||
sfNFToken.getCode(),
|
||||
{
|
||||
{sfNFTokenID, soeREQUIRED},
|
||||
{sfURI, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfGenesisMint.jsonName.c_str(),
|
||||
sfGenesisMint.getCode(),
|
||||
{
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfAmount, soeOPTIONAL},
|
||||
{sfGovernanceFlags, soeOPTIONAL},
|
||||
{sfGovernanceMarks, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfActiveValidator.jsonName.c_str(),
|
||||
sfActiveValidator.getCode(),
|
||||
{
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAccount, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfImportVLKey.jsonName.c_str(),
|
||||
sfImportVLKey.getCode(),
|
||||
{
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAccount, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfAmountEntry.jsonName.c_str(),
|
||||
sfAmountEntry.getCode(),
|
||||
{
|
||||
{sfAmount, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfMintURIToken.jsonName.c_str(),
|
||||
sfMintURIToken.getCode(),
|
||||
{
|
||||
{sfURI, soeREQUIRED},
|
||||
{sfDigest, soeOPTIONAL},
|
||||
{sfFlags, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfRemark.jsonName.c_str(),
|
||||
sfRemark.getCode(),
|
||||
{
|
||||
{sfRemarkName, soeREQUIRED},
|
||||
{sfRemarkValue, soeOPTIONAL},
|
||||
{sfFlags, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfVoteEntry.jsonName.c_str(),
|
||||
sfVoteEntry.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfTradingFee, soeDEFAULT},
|
||||
{sfVoteWeight, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfAuctionSlot.jsonName.c_str(),
|
||||
sfAuctionSlot.getCode(),
|
||||
{{sfAccount, soeREQUIRED},
|
||||
{sfExpiration, soeREQUIRED},
|
||||
{sfDiscountedFee, soeDEFAULT},
|
||||
{sfPrice, soeREQUIRED},
|
||||
{sfAuthAccounts, soeOPTIONAL}});
|
||||
|
||||
add(sfXChainClaimAttestationCollectionElement.jsonName.c_str(),
|
||||
sfXChainClaimAttestationCollectionElement.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfSignature, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfXChainClaimID, soeREQUIRED},
|
||||
{sfDestination, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfXChainCreateAccountAttestationCollectionElement.jsonName.c_str(),
|
||||
sfXChainCreateAccountAttestationCollectionElement.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfSignature, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfAccount, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfXChainAccountCreateCount, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfXChainClaimProofSig.jsonName.c_str(),
|
||||
sfXChainClaimProofSig.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfDestination, soeOPTIONAL},
|
||||
});
|
||||
|
||||
add(sfXChainCreateAccountProofSig.jsonName.c_str(),
|
||||
sfXChainCreateAccountProofSig.getCode(),
|
||||
{
|
||||
{sfAttestationSignerAccount, soeREQUIRED},
|
||||
{sfPublicKey, soeREQUIRED},
|
||||
{sfAmount, soeREQUIRED},
|
||||
{sfSignatureReward, soeREQUIRED},
|
||||
{sfAttestationRewardAccount, soeREQUIRED},
|
||||
{sfWasLockingChainSend, soeREQUIRED},
|
||||
{sfDestination, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfAuthAccount.jsonName.c_str(),
|
||||
sfAuthAccount.getCode(),
|
||||
{
|
||||
{sfAccount, soeREQUIRED},
|
||||
});
|
||||
|
||||
add(sfPriceData.jsonName.c_str(),
|
||||
sfPriceData.getCode(),
|
||||
{
|
||||
{sfBaseAsset, soeREQUIRED},
|
||||
{sfQuoteAsset, soeREQUIRED},
|
||||
{sfAssetPrice, soeOPTIONAL},
|
||||
{sfScale, soeDEFAULT},
|
||||
});
|
||||
}
|
||||
|
||||
InnerObjectFormats const&
|
||||
InnerObjectFormats::getInstance()
|
||||
{
|
||||
static InnerObjectFormats instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
SOTemplate const*
|
||||
InnerObjectFormats::findSOTemplateBySField(SField const& sField) const
|
||||
{
|
||||
auto itemPtr = findByType(sField.getCode());
|
||||
if (itemPtr)
|
||||
return &(itemPtr->getSOTemplate());
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace ripple
|
||||
Reference in New Issue
Block a user