void LedgerFormats::addCommonFields (Item& item)
{
    item
        << SOElement(sfLedgerIndex,             SOE_OPTIONAL)
        << SOElement(sfLedgerEntryType,         SOE_REQUIRED)
        << SOElement(sfFlags,                   SOE_REQUIRED)
        ;
}
InnerObjectFormats::InnerObjectFormats ()
{
    add (sfSignerEntry.getJsonName ().c_str (), sfSignerEntry.getCode ())
        << SOElement (sfAccount,              SOE_REQUIRED)
        << SOElement (sfSignerWeight,         SOE_REQUIRED)
        ;

    add (sfSigner.getJsonName ().c_str (), sfSigner.getCode ())
        << SOElement (sfAccount,              SOE_REQUIRED)
        << SOElement (sfSigningPubKey,        SOE_REQUIRED)
        << SOElement (sfTxnSignature,         SOE_REQUIRED)
        ;
}
Beispiel #3
0
void TxFormats::addCommonFields (Item& item)
{
    item
        << SOElement(sfTransactionType,     SOE_REQUIRED)
        << SOElement(sfFlags,               SOE_OPTIONAL)
        << SOElement(sfSourceTag,           SOE_OPTIONAL)
        << SOElement(sfAccount,             SOE_REQUIRED) 
        << SOElement(sfSequence,            SOE_REQUIRED) 
        << SOElement(sfPreviousTxnID,       SOE_OPTIONAL) 
        << SOElement(sfFee,                 SOE_REQUIRED) 
        << SOElement(sfOperationLimit,      SOE_OPTIONAL) 
        << SOElement(sfSigningPubKey,       SOE_REQUIRED) 
        << SOElement(sfTxnSignature,        SOE_OPTIONAL)
        ;
}
Beispiel #4
0
        FormatHolder ()
        {
            format.push_back (SOElement (sfFlags,           SOE_REQUIRED));
            format.push_back (SOElement (sfLedgerHash,      SOE_REQUIRED));
            format.push_back (SOElement (sfLedgerSequence,  SOE_OPTIONAL));
            format.push_back (SOElement (sfCloseTime,       SOE_OPTIONAL));
            format.push_back (SOElement (sfLoadFee,         SOE_OPTIONAL));
            format.push_back (SOElement (sfAmendments,      SOE_OPTIONAL));
            format.push_back (SOElement (sfBaseFee,         SOE_OPTIONAL));
            format.push_back (SOElement (sfReserveBase,     SOE_OPTIONAL));
            format.push_back (SOElement (sfReserveIncrement, SOE_OPTIONAL));
            format.push_back (SOElement (sfSigningTime,     SOE_REQUIRED));
            format.push_back (SOElement (sfSigningPubKey,   SOE_REQUIRED));
            format.push_back (SOElement (sfSignature,       SOE_OPTIONAL));
            format.push_back (SOElement (sfConsensusHash,   SOE_OPTIONAL));
            format.push_back (SOElement (sfCookie,          SOE_OPTIONAL));

        }
LedgerFormats::LedgerFormats ()
{
    add ("AccountRoot", ltACCOUNT_ROOT)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfOwnerCount,          SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfAccountTxnID,        SOE_OPTIONAL)
            << SOElement (sfRegularKey,          SOE_OPTIONAL)
            << SOElement (sfTransferRate,        SOE_OPTIONAL)
            << SOElement (sfDomain,              SOE_OPTIONAL)
            << SOElement (sfInflationDest,       SOE_OPTIONAL)
            << SOElement (sfSetAuthKey,          SOE_OPTIONAL)
            ;

    add ("Contract", ltCONTRACT)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfIssuer,              SOE_REQUIRED)
            << SOElement (sfOwner,               SOE_REQUIRED)
            << SOElement (sfExpiration,          SOE_REQUIRED)
            << SOElement (sfBondAmount,          SOE_REQUIRED)
            << SOElement (sfCreateCode,          SOE_OPTIONAL)
            << SOElement (sfFundCode,            SOE_OPTIONAL)
            << SOElement (sfRemoveCode,          SOE_OPTIONAL)
            << SOElement (sfExpireCode,          SOE_OPTIONAL)
            ;

    add ("DirectoryNode", ltDIR_NODE)
            << SOElement (sfOwner,               SOE_OPTIONAL)  // for owner directories
            << SOElement (sfTakerPaysCurrency,   SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerPaysIssuer,     SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerGetsCurrency,   SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerGetsIssuer,     SOE_OPTIONAL)  // for order book directories
            << SOElement (sfExchangeRate,        SOE_OPTIONAL)  // for order book directories
            << SOElement (sfIndexes,             SOE_REQUIRED)
            << SOElement (sfRootIndex,           SOE_REQUIRED)
            << SOElement (sfIndexNext,           SOE_OPTIONAL)
            << SOElement (sfIndexPrevious,       SOE_OPTIONAL)
            ;

    add ("GeneratorMap", ltGENERATOR_MAP)
            << SOElement (sfGenerator,           SOE_REQUIRED)
            ;

    add ("Nickname", ltNICKNAME)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfMinimumOffer,        SOE_OPTIONAL)
            ;

    add ("Offer", ltOFFER)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfTakerPays,           SOE_REQUIRED)
            << SOElement (sfTakerGets,           SOE_REQUIRED)
            << SOElement (sfBookDirectory,       SOE_REQUIRED)
            << SOElement (sfBookNode,            SOE_REQUIRED)
            << SOElement (sfOwnerNode,           SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfExpiration,          SOE_OPTIONAL)
            ;

    add ("RippleState", ltRIPPLE_STATE)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfLowLimit,            SOE_REQUIRED)
            << SOElement (sfHighLimit,           SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfLowNode,             SOE_OPTIONAL)
            << SOElement (sfLowQualityIn,        SOE_OPTIONAL)
            << SOElement (sfLowQualityOut,       SOE_OPTIONAL)
            << SOElement (sfHighNode,            SOE_OPTIONAL)
            << SOElement (sfHighQualityIn,       SOE_OPTIONAL)
            << SOElement (sfHighQualityOut,      SOE_OPTIONAL)
            ;

    add ("Ownership", ltOWNERSHIP)
            << SOElement (sfAccount,         SOE_REQUIRED)
            << SOElement (sfObjectId,         SOE_REQUIRED)
            << SOElement (sfObjectName,         SOE_REQUIRED)
            << SOElement (sfObjectDesc,         SOE_OPTIONAL)
            << SOElement (sfQuantity,         SOE_OPTIONAL)
            ;

    add ("ObjectDescription", ltOBJECT_DESC)
            << SOElement (sfObjectName,         SOE_REQUIRED)
            << SOElement (sfObjectDesc,         SOE_REQUIRED)
            ;

    add ("LedgerHashes", ltLEDGER_HASHES)
            << SOElement (sfLastLedgerSequence,  SOE_OPTIONAL)
            << SOElement (sfHashes,              SOE_REQUIRED)
            ;

    add ("EnabledAmendments", ltAMENDMENTS)
            << SOElement (sfAmendments, SOE_REQUIRED)
            ;

    add ("FeeSettings", ltFEE_SETTINGS)
            << SOElement (sfBaseFee,             SOE_REQUIRED)
            << SOElement (sfReferenceFeeUnits,   SOE_REQUIRED)
            << SOElement (sfReserveBase,         SOE_REQUIRED)
            << SOElement (sfReserveIncrement,    SOE_REQUIRED)
            ;
}
Beispiel #6
0
LedgerFormats::LedgerFormats ()
{
    add ("AccountRoot", ltACCOUNT_ROOT)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfOwnerCount,          SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfAccountTxnID,        SOE_OPTIONAL)
            << SOElement (sfRegularKey,          SOE_OPTIONAL)
            << SOElement (sfEmailHash,           SOE_OPTIONAL)
            << SOElement (sfWalletLocator,       SOE_OPTIONAL)
            << SOElement (sfWalletSize,          SOE_OPTIONAL)
            << SOElement (sfMessageKey,          SOE_OPTIONAL)
            << SOElement (sfTransferRate,        SOE_OPTIONAL)
            << SOElement (sfDomain,              SOE_OPTIONAL)
            ;

    add ("DirectoryNode", ltDIR_NODE)
            << SOElement (sfOwner,               SOE_OPTIONAL)  // for owner directories
            << SOElement (sfTakerPaysCurrency,   SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerPaysIssuer,     SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerGetsCurrency,   SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerGetsIssuer,     SOE_OPTIONAL)  // for order book directories
            << SOElement (sfExchangeRate,        SOE_OPTIONAL)  // for order book directories
            << SOElement (sfIndexes,             SOE_REQUIRED)
            << SOElement (sfRootIndex,           SOE_REQUIRED)
            << SOElement (sfIndexNext,           SOE_OPTIONAL)
            << SOElement (sfIndexPrevious,       SOE_OPTIONAL)
            ;

    add ("Offer", ltOFFER)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfTakerPays,           SOE_REQUIRED)
            << SOElement (sfTakerGets,           SOE_REQUIRED)
            << SOElement (sfBookDirectory,       SOE_REQUIRED)
            << SOElement (sfBookNode,            SOE_REQUIRED)
            << SOElement (sfOwnerNode,           SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfExpiration,          SOE_OPTIONAL)
            ;

    add ("RippleState", ltRIPPLE_STATE)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfLowLimit,            SOE_REQUIRED)
            << SOElement (sfHighLimit,           SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfLowNode,             SOE_OPTIONAL)
            << SOElement (sfLowQualityIn,        SOE_OPTIONAL)
            << SOElement (sfLowQualityOut,       SOE_OPTIONAL)
            << SOElement (sfHighNode,            SOE_OPTIONAL)
            << SOElement (sfHighQualityIn,       SOE_OPTIONAL)
            << SOElement (sfHighQualityOut,      SOE_OPTIONAL)
            ;

    add ("SuspendedPayment", ltSUSPAY) <<
        SOElement (sfAccount,           SOE_REQUIRED) <<
        SOElement (sfDestination,       SOE_REQUIRED) <<
        SOElement (sfAmount,            SOE_REQUIRED) <<
        SOElement (sfDigest,            SOE_OPTIONAL) <<
        SOElement (sfCancelAfter,       SOE_OPTIONAL) <<
        SOElement (sfFinishAfter,       SOE_OPTIONAL) <<
        SOElement (sfSourceTag,         SOE_OPTIONAL) <<
        SOElement (sfDestinationTag,    SOE_OPTIONAL) <<
        SOElement (sfOwnerNode,         SOE_REQUIRED) <<
        SOElement (sfPreviousTxnID,     SOE_REQUIRED) <<
        SOElement (sfPreviousTxnLgrSeq, SOE_REQUIRED);

    add ("LedgerHashes", ltLEDGER_HASHES)
            << SOElement (sfFirstLedgerSequence, SOE_OPTIONAL) // Remove if we do a ledger restart
            << SOElement (sfLastLedgerSequence,  SOE_OPTIONAL)
            << SOElement (sfHashes,              SOE_REQUIRED)
            ;

    add ("Amendments", ltAMENDMENTS)
            << SOElement (sfLedgerSequence,      SOE_OPTIONAL)
            << SOElement (sfAmendments,          SOE_OPTIONAL) // Enabled
            << SOElement (sfMajorities,          SOE_OPTIONAL)
            ;

    add ("FeeSettings", ltFEE_SETTINGS)
            << SOElement (sfLedgerSequence,      SOE_OPTIONAL)
            << SOElement (sfBaseFee,             SOE_REQUIRED)
            << SOElement (sfReferenceFeeUnits,   SOE_REQUIRED)
            << SOElement (sfReserveBase,         SOE_REQUIRED)
            << SOElement (sfReserveIncrement,    SOE_REQUIRED)
            ;

    add ("Ticket", ltTICKET)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfOwnerNode,           SOE_REQUIRED)
            << SOElement (sfTarget,              SOE_OPTIONAL)
            << SOElement (sfExpiration,          SOE_OPTIONAL)
            ;

    // All fields are SOE_REQUIRED because there is always a
    // SignerEntries.  If there are no SignerEntries the node is deleted.
    add ("SignerList", ltSIGNER_LIST)
            << SOElement (sfOwnerNode,           SOE_REQUIRED)
            << SOElement (sfSignerQuorum,        SOE_REQUIRED)
            << SOElement (sfSignerEntries,       SOE_REQUIRED)
            << SOElement (sfSignerListID,        SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            ;
}
Beispiel #7
0
LedgerFormats::LedgerFormats ()
{
    add ("AccountRoot", ltACCOUNT_ROOT)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfOwnerCount,          SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfAccountTxnID,        SOE_OPTIONAL)
            << SOElement (sfRegularKey,          SOE_OPTIONAL)
            << SOElement (sfEmailHash,           SOE_OPTIONAL)
            << SOElement (sfWalletLocator,       SOE_OPTIONAL)
            << SOElement (sfWalletSize,          SOE_OPTIONAL)
            << SOElement (sfMessageKey,          SOE_OPTIONAL)
            << SOElement (sfTransferRate,        SOE_OPTIONAL)
            << SOElement (sfDomain,              SOE_OPTIONAL)
            ;

    add ("DirectoryNode", ltDIR_NODE)
            << SOElement (sfOwner,               SOE_OPTIONAL)  // for owner directories
            << SOElement (sfTakerPaysCurrency,   SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerPaysIssuer,     SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerGetsCurrency,   SOE_OPTIONAL)  // for order book directories
            << SOElement (sfTakerGetsIssuer,     SOE_OPTIONAL)  // for order book directories
            << SOElement (sfExchangeRate,        SOE_OPTIONAL)  // for order book directories
            << SOElement (sfIndexes,             SOE_REQUIRED)
            << SOElement (sfRootIndex,           SOE_REQUIRED)
            << SOElement (sfIndexNext,           SOE_OPTIONAL)
            << SOElement (sfIndexPrevious,       SOE_OPTIONAL)
            ;

    add ("GeneratorMap", ltGENERATOR_MAP)
            << SOElement (sfGenerator,           SOE_REQUIRED)
            ;

    add ("Offer", ltOFFER)
            << SOElement (sfAccount,             SOE_REQUIRED)
            << SOElement (sfSequence,            SOE_REQUIRED)
            << SOElement (sfTakerPays,           SOE_REQUIRED)
            << SOElement (sfTakerGets,           SOE_REQUIRED)
            << SOElement (sfBookDirectory,       SOE_REQUIRED)
            << SOElement (sfBookNode,            SOE_REQUIRED)
            << SOElement (sfOwnerNode,           SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfExpiration,          SOE_OPTIONAL)
            ;

    add ("RippleState", ltRIPPLE_STATE)
            << SOElement (sfBalance,             SOE_REQUIRED)
            << SOElement (sfLowLimit,            SOE_REQUIRED)
            << SOElement (sfHighLimit,           SOE_REQUIRED)
            << SOElement (sfPreviousTxnID,       SOE_REQUIRED)
            << SOElement (sfPreviousTxnLgrSeq,   SOE_REQUIRED)
            << SOElement (sfLowNode,             SOE_OPTIONAL)
            << SOElement (sfLowQualityIn,        SOE_OPTIONAL)
            << SOElement (sfLowQualityOut,       SOE_OPTIONAL)
            << SOElement (sfHighNode,            SOE_OPTIONAL)
            << SOElement (sfHighQualityIn,       SOE_OPTIONAL)
            << SOElement (sfHighQualityOut,      SOE_OPTIONAL)
            ;

    add ("LedgerHashes", ltLEDGER_HASHES)
            << SOElement (sfFirstLedgerSequence, SOE_OPTIONAL) // Remove if we do a ledger restart
            << SOElement (sfLastLedgerSequence,  SOE_OPTIONAL)
            << SOElement (sfHashes,              SOE_REQUIRED)
            ;

    add ("EnabledAmendments", ltAMENDMENTS)
            << SOElement (sfAmendments, SOE_REQUIRED)
            ;

    add ("FeeSettings", ltFEE_SETTINGS)
            << SOElement (sfBaseFee,             SOE_REQUIRED)
            << SOElement (sfReferenceFeeUnits,   SOE_REQUIRED)
            << SOElement (sfReserveBase,         SOE_REQUIRED)
            << SOElement (sfReserveIncrement,    SOE_REQUIRED)
            ;
}
static bool TFInit()
{
	TransactionFormat* tf;

	DECLARE_TF(AccountSet, ttACCOUNT_SET)
		<< SOElement(sfEmailHash,		SOE_OPTIONAL)
		<< SOElement(sfWalletLocator,	SOE_OPTIONAL)
		<< SOElement(sfWalletSize,		SOE_OPTIONAL)
		<< SOElement(sfMessageKey,		SOE_OPTIONAL)
		<< SOElement(sfDomain,			SOE_OPTIONAL)
		<< SOElement(sfTransferRate,	SOE_OPTIONAL)
		;

	DECLARE_TF(TrustSet, ttTRUST_SET)
		<< SOElement(sfLimitAmount,		SOE_OPTIONAL)
		<< SOElement(sfQualityIn,		SOE_OPTIONAL)
		<< SOElement(sfQualityOut,		SOE_OPTIONAL)
		;

	DECLARE_TF(OfferCreate, ttOFFER_CREATE)
		<< SOElement(sfTakerPays,		SOE_REQUIRED)
		<< SOElement(sfTakerGets,		SOE_REQUIRED)
		<< SOElement(sfExpiration,		SOE_OPTIONAL)
		;

	DECLARE_TF(OfferCancel, ttOFFER_CANCEL)
		<< SOElement(sfOfferSequence,	SOE_REQUIRED)
		;

	DECLARE_TF(SetRegularKey, ttREGULAR_KEY_SET)
		<< SOElement(sfRegularKey,	SOE_REQUIRED)
		;

	DECLARE_TF(Payment, ttPAYMENT)
		<< SOElement(sfDestination,		SOE_REQUIRED)
		<< SOElement(sfAmount,			SOE_REQUIRED)
		<< SOElement(sfSendMax,			SOE_OPTIONAL)
		<< SOElement(sfPaths,			SOE_DEFAULT)
		<< SOElement(sfInvoiceID,		SOE_OPTIONAL)
		<< SOElement(sfDestinationTag,	SOE_OPTIONAL)
		;

	DECLARE_TF(Contract, ttCONTRACT)
		<< SOElement(sfExpiration,		SOE_REQUIRED)
		<< SOElement(sfBondAmount,		SOE_REQUIRED)
		<< SOElement(sfStampEscrow,		SOE_REQUIRED)
		<< SOElement(sfRippleEscrow,	SOE_REQUIRED)
		<< SOElement(sfCreateCode,		SOE_OPTIONAL)
		<< SOElement(sfFundCode,		SOE_OPTIONAL)
		<< SOElement(sfRemoveCode,		SOE_OPTIONAL)
		<< SOElement(sfExpireCode,		SOE_OPTIONAL)
		;

	DECLARE_TF(RemoveContract, ttCONTRACT_REMOVE)
		<< SOElement(sfTarget,			SOE_REQUIRED)
		;

	DECLARE_TF(EnableFeature, ttFEATURE)
		<< SOElement(sfFeature,			SOE_REQUIRED)
		;

	DECLARE_TF(SetFee, ttFEE)
		<< SOElement(sfFeatures,			SOE_REQUIRED)
		<< SOElement(sfBaseFee,				SOE_REQUIRED)
		<< SOElement(sfReferenceFeeUnits,	SOE_REQUIRED)
		<< SOElement(sfReserveBase,			SOE_REQUIRED)
		<< SOElement(sfReserveIncrement,	SOE_REQUIRED)
     ;

	return true;
}
Beispiel #9
0
void TxFormats::addCommonFields (Item& item)
{
    item
        << SOElement(sfTransactionType,     SOE_REQUIRED)
        << SOElement(sfFlags,               SOE_OPTIONAL)
        << SOElement(sfSourceTag,           SOE_OPTIONAL)
        << SOElement(sfAccount,             SOE_REQUIRED)
        << SOElement(sfSequence,            SOE_REQUIRED)
        << SOElement(sfPreviousTxnID,       SOE_OPTIONAL) // emulate027
        << SOElement(sfLastLedgerSequence,  SOE_OPTIONAL)
        << SOElement(sfAccountTxnID,        SOE_OPTIONAL)
        << SOElement(sfFee,                 SOE_REQUIRED)
        << SOElement(sfOperationLimit,      SOE_OPTIONAL)
        << SOElement(sfMemos,               SOE_OPTIONAL)
        << SOElement(sfSigningPubKey,       SOE_REQUIRED)
        << SOElement(sfTxnSignature,        SOE_OPTIONAL)
        << SOElement(sfMultiSigners,        SOE_OPTIONAL) // submit_multisigned
        ;
}
Beispiel #10
0
TxFormats::TxFormats ()
{
    add ("AccountSet", ttACCOUNT_SET)
        << SOElement (sfEmailHash,           SOE_OPTIONAL)
        << SOElement (sfWalletLocator,       SOE_OPTIONAL)
        << SOElement (sfWalletSize,          SOE_OPTIONAL)
        << SOElement (sfMessageKey,          SOE_OPTIONAL)
        << SOElement (sfDomain,              SOE_OPTIONAL)
        << SOElement (sfTransferRate,        SOE_OPTIONAL)
        << SOElement (sfSetFlag,             SOE_OPTIONAL)
        << SOElement (sfClearFlag,           SOE_OPTIONAL)
        ;

    add ("TrustSet", ttTRUST_SET)
        << SOElement (sfLimitAmount,         SOE_OPTIONAL)
        << SOElement (sfQualityIn,           SOE_OPTIONAL)
        << SOElement (sfQualityOut,          SOE_OPTIONAL)
        ;

    add ("OfferCreate", ttOFFER_CREATE)
        << SOElement (sfTakerPays,           SOE_REQUIRED)
        << SOElement (sfTakerGets,           SOE_REQUIRED)
        << SOElement (sfExpiration,          SOE_OPTIONAL)
        << SOElement (sfOfferSequence,       SOE_OPTIONAL)
        ;

    add ("OfferCancel", ttOFFER_CANCEL)
        << SOElement (sfOfferSequence,       SOE_REQUIRED)
        ;

    add ("SetRegularKey", ttREGULAR_KEY_SET)
        << SOElement (sfRegularKey,          SOE_OPTIONAL)
        ;

    add ("Payment", ttPAYMENT)
        << SOElement (sfDestination,         SOE_REQUIRED)
        << SOElement (sfAmount,              SOE_REQUIRED)
        << SOElement (sfSendMax,             SOE_OPTIONAL)
        << SOElement (sfPaths,               SOE_DEFAULT)
        << SOElement (sfInvoiceID,           SOE_OPTIONAL)
        << SOElement (sfDestinationTag,      SOE_OPTIONAL)
        << SOElement (sfDeliverMin,          SOE_OPTIONAL)
        ;

    add ("EnableAmendment", ttAMENDMENT)
        << SOElement (sfLedgerSequence,      SOE_OPTIONAL)
        << SOElement (sfAmendment,           SOE_REQUIRED)
        ;

    add ("SetFee", ttFEE)
        << SOElement (sfLedgerSequence,      SOE_OPTIONAL)
        << SOElement (sfBaseFee,             SOE_REQUIRED)
        << SOElement (sfReferenceFeeUnits,   SOE_REQUIRED)
        << SOElement (sfReserveBase,         SOE_REQUIRED)
        << SOElement (sfReserveIncrement,    SOE_REQUIRED)
        ;

    add ("TicketCreate", ttTICKET_CREATE)
        << SOElement (sfTarget,              SOE_OPTIONAL)
        << SOElement (sfExpiration,          SOE_OPTIONAL)
        ;

    add ("TicketCancel", ttTICKET_CANCEL)
        << SOElement (sfTicketID,            SOE_REQUIRED)
        ;

    // The SignerEntries are optional because a SignerList is deleted by
    // setting the SignerQuorum to zero and omitting SignerEntries.
    add ("SignerListSet", ttSIGNER_LIST_SET)
        << SOElement (sfSignerQuorum,        SOE_REQUIRED)
        << SOElement (sfSignerEntries,       SOE_OPTIONAL)
        ;
}
Beispiel #11
0
    void testSerialization ()
    {
        testcase ("serialization");

        unexpected (sfGeneric.isUseful (), "sfGeneric must not be useful");

        SField const& sfTestVL = SField::getField (STI_VL, 255);
        SField const& sfTestH256 = SField::getField (STI_HASH256, 255);
        SField const& sfTestU32 = SField::getField (STI_UINT32, 255);
        SField const& sfTestObject = SField::getField (STI_OBJECT, 255);

        SOTemplate elements;
        elements.push_back (SOElement (sfFlags, SOE_REQUIRED));
        elements.push_back (SOElement (sfTestVL, SOE_REQUIRED));
        elements.push_back (SOElement (sfTestH256, SOE_OPTIONAL));
        elements.push_back (SOElement (sfTestU32, SOE_REQUIRED));

        STObject object1 (elements, sfTestObject);
        STObject object2 (object1);

        unexpected (object1.getSerializer () != object2.getSerializer (),
            "STObject error 1");

        unexpected (object1.isFieldPresent (sfTestH256) ||
            !object1.isFieldPresent (sfTestVL), "STObject error");

        object1.makeFieldPresent (sfTestH256);

        unexpected (!object1.isFieldPresent (sfTestH256), "STObject Error 2");

        unexpected (object1.getFieldH256 (sfTestH256) != uint256 (),
            "STObject error 3");

        if (object1.getSerializer () == object2.getSerializer ())
        {
            WriteLog (lsINFO, STObject) << "O1: " << object1.getJson (0);
            WriteLog (lsINFO, STObject) << "O2: " << object2.getJson (0);
            fail ("STObject error 4");
        }
        else
        {
            pass ();
        }

        object1.makeFieldAbsent (sfTestH256);

        unexpected (object1.isFieldPresent (sfTestH256), "STObject error 5");

        unexpected (object1.getFlags () != 0, "STObject error 6");

        unexpected (object1.getSerializer () != object2.getSerializer (),
            "STObject error 7");

        STObject copy (object1);

        unexpected (object1.isFieldPresent (sfTestH256), "STObject error 8");

        unexpected (copy.isFieldPresent (sfTestH256), "STObject error 9");

        unexpected (object1.getSerializer () != copy.getSerializer (),
            "STObject error 10");

        copy.setFieldU32 (sfTestU32, 1);

        unexpected (object1.getSerializer () == copy.getSerializer (),
            "STObject error 11");

        for (int i = 0; i < 1000; i++)
        {
            Blob j (i, 2);

            object1.setFieldVL (sfTestVL, j);

            Serializer s;
            object1.add (s);
            SerialIter it (s.slice());

            STObject object3 (elements, it, sfTestObject);

            unexpected (object1.getFieldVL (sfTestVL) != j, "STObject error");

            unexpected (object3.getFieldVL (sfTestVL) != j, "STObject error");
        }
    }
Beispiel #12
0
TxFormats::TxFormats ()
{
    add ("AccountSet", ttACCOUNT_SET)
            << SOElement (sfEmailHash,       SOE_OPTIONAL)
            << SOElement (sfWalletLocator,   SOE_OPTIONAL)
            << SOElement (sfWalletSize,      SOE_OPTIONAL)
            << SOElement (sfMessageKey,      SOE_OPTIONAL)
            << SOElement (sfDomain,          SOE_OPTIONAL)
            << SOElement (sfTransferRate,    SOE_OPTIONAL)
            << SOElement (sfSetFlag,         SOE_OPTIONAL)
            << SOElement (sfClearFlag,       SOE_OPTIONAL)
            ;

    add ("TrustSet", ttTRUST_SET)
            << SOElement (sfLimitAmount,     SOE_OPTIONAL)
            << SOElement (sfQualityIn,       SOE_OPTIONAL)
            << SOElement (sfQualityOut,      SOE_OPTIONAL)
            ;

    add ("OfferCreate", ttOFFER_CREATE)
            << SOElement (sfTakerPays,       SOE_REQUIRED)
            << SOElement (sfTakerGets,       SOE_REQUIRED)
            << SOElement (sfExpiration,      SOE_OPTIONAL)
            << SOElement (sfOfferSequence,   SOE_OPTIONAL)
            ;

    add ("OfferCancel", ttOFFER_CANCEL)
            << SOElement (sfOfferSequence,   SOE_REQUIRED)
            ;

    add ("SetRegularKey", ttREGULAR_KEY_SET)
            << SOElement (sfRegularKey,  SOE_OPTIONAL)
            ;

    add ("Payment", ttPAYMENT)
            << SOElement (sfDestination,     SOE_REQUIRED)
            << SOElement (sfAmount,          SOE_REQUIRED)
            << SOElement (sfSendMax,         SOE_OPTIONAL)
            << SOElement (sfPaths,           SOE_DEFAULT)
            << SOElement (sfInvoiceID,       SOE_OPTIONAL)
            << SOElement (sfDestinationTag,  SOE_OPTIONAL)
            ;

    add ("Contract", ttCONTRACT)
            << SOElement (sfExpiration,      SOE_REQUIRED)
            << SOElement (sfBondAmount,      SOE_REQUIRED)
            << SOElement (sfStampEscrow,     SOE_REQUIRED)
            << SOElement (sfRippleEscrow,    SOE_REQUIRED)
            << SOElement (sfCreateCode,      SOE_OPTIONAL)
            << SOElement (sfFundCode,        SOE_OPTIONAL)
            << SOElement (sfRemoveCode,      SOE_OPTIONAL)
            << SOElement (sfExpireCode,      SOE_OPTIONAL)
            ;

    add ("RemoveContract", ttCONTRACT_REMOVE)
            << SOElement (sfTarget,          SOE_REQUIRED)
            ;

    add ("EnableAmendment", ttAMENDMENT)
            << SOElement (sfAmendment,         SOE_REQUIRED)
            ;

    add ("SetFee", ttFEE)
            << SOElement (sfBaseFee,             SOE_REQUIRED)
            << SOElement (sfReferenceFeeUnits,   SOE_REQUIRED)
            << SOElement (sfReserveBase,         SOE_REQUIRED)
            << SOElement (sfReserveIncrement,    SOE_REQUIRED)
            ;
}