Codegen update

This commit is contained in:
Oleksandr
2026-06-03 18:29:55 -04:00
parent 9ef1949309
commit 03fb6d1e0c
7 changed files with 109 additions and 75 deletions

View File

@@ -520,7 +520,7 @@ public:
}
/**
* @brief Get sfSponsoredOwnerCount (soeDEFAULT)
* @brief Get sfSponsoredOwnerCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -544,7 +544,7 @@ public:
}
/**
* @brief Get sfSponsoringOwnerCount (soeDEFAULT)
* @brief Get sfSponsoringOwnerCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -568,7 +568,7 @@ public:
}
/**
* @brief Get sfSponsoringAccountCount (soeDEFAULT)
* @brief Get sfSponsoringAccountCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -892,7 +892,7 @@ public:
}
/**
* @brief Set sfSponsoredOwnerCount (soeDEFAULT)
* @brief Set sfSponsoredOwnerCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
@@ -903,7 +903,7 @@ public:
}
/**
* @brief Set sfSponsoringOwnerCount (soeDEFAULT)
* @brief Set sfSponsoringOwnerCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&
@@ -914,7 +914,7 @@ public:
}
/**
* @brief Set sfSponsoringAccountCount (soeDEFAULT)
* @brief Set sfSponsoringAccountCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
AccountRootBuilder&

View File

@@ -245,7 +245,7 @@ public:
}
/**
* @brief Get sfHighSponsor (soeOPTIONAL)
* @brief Get sfHighSponsor (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -269,7 +269,7 @@ public:
}
/**
* @brief Get sfLowSponsor (soeOPTIONAL)
* @brief Get sfLowSponsor (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -459,7 +459,7 @@ public:
}
/**
* @brief Set sfHighSponsor (soeOPTIONAL)
* @brief Set sfHighSponsor (SoeOptional)
* @return Reference to this builder for method chaining.
*/
RippleStateBuilder&
@@ -470,7 +470,7 @@ public:
}
/**
* @brief Set sfLowSponsor (soeOPTIONAL)
* @brief Set sfLowSponsor (SoeOptional)
* @return Reference to this builder for method chaining.
*/
RippleStateBuilder&

View File

@@ -46,7 +46,7 @@ public:
// Ledger entry-specific field getters
/**
* @brief Get sfPreviousTxnID (soeREQUIRED)
* @brief Get sfPreviousTxnID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
@@ -57,7 +57,7 @@ public:
}
/**
* @brief Get sfPreviousTxnLgrSeq (soeREQUIRED)
* @brief Get sfPreviousTxnLgrSeq (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
@@ -68,7 +68,7 @@ public:
}
/**
* @brief Get sfOwner (soeREQUIRED)
* @brief Get sfOwner (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
@@ -79,7 +79,7 @@ public:
}
/**
* @brief Get sfSponsee (soeREQUIRED)
* @brief Get sfSponsee (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
@@ -90,7 +90,7 @@ public:
}
/**
* @brief Get sfFeeAmount (soeOPTIONAL)
* @brief Get sfFeeAmount (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -114,7 +114,7 @@ public:
}
/**
* @brief Get sfMaxFee (soeOPTIONAL)
* @brief Get sfMaxFee (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -138,7 +138,7 @@ public:
}
/**
* @brief Get sfReserveCount (soeDEFAULT)
* @brief Get sfReserveCount (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -162,7 +162,7 @@ public:
}
/**
* @brief Get sfOwnerNode (soeREQUIRED)
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
@@ -173,7 +173,7 @@ public:
}
/**
* @brief Get sfSponseeNode (soeREQUIRED)
* @brief Get sfSponseeNode (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
@@ -188,7 +188,7 @@ public:
* @brief Builder for Sponsorship ledger entries.
*
* Provides a fluent interface for constructing ledger entries with method chaining.
* Uses Json::Value internally for flexible ledger entry construction.
* Uses STObject internally for flexible ledger entry construction.
* Inherits common field setters from LedgerEntryBuilderBase.
*/
class SponsorshipBuilder : public LedgerEntryBuilderBase<SponsorshipBuilder>
@@ -231,7 +231,7 @@ public:
/** @brief Ledger entry-specific field setters */
/**
* @brief Set sfPreviousTxnID (soeREQUIRED)
* @brief Set sfPreviousTxnID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -242,7 +242,7 @@ public:
}
/**
* @brief Set sfPreviousTxnLgrSeq (soeREQUIRED)
* @brief Set sfPreviousTxnLgrSeq (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -253,7 +253,7 @@ public:
}
/**
* @brief Set sfOwner (soeREQUIRED)
* @brief Set sfOwner (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -264,7 +264,7 @@ public:
}
/**
* @brief Set sfSponsee (soeREQUIRED)
* @brief Set sfSponsee (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -275,7 +275,7 @@ public:
}
/**
* @brief Set sfFeeAmount (soeOPTIONAL)
* @brief Set sfFeeAmount (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -286,7 +286,7 @@ public:
}
/**
* @brief Set sfMaxFee (soeOPTIONAL)
* @brief Set sfMaxFee (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -297,7 +297,7 @@ public:
}
/**
* @brief Set sfReserveCount (soeDEFAULT)
* @brief Set sfReserveCount (SoeDefault)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -308,7 +308,7 @@ public:
}
/**
* @brief Set sfOwnerNode (soeREQUIRED)
* @brief Set sfOwnerNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&
@@ -319,7 +319,7 @@ public:
}
/**
* @brief Set sfSponseeNode (soeREQUIRED)
* @brief Set sfSponseeNode (SoeRequired)
* @return Reference to this builder for method chaining.
*/
SponsorshipBuilder&

View File

@@ -19,9 +19,9 @@ class SponsorshipSetBuilder;
* @brief Transaction: SponsorshipSet
*
* Type: ttSPONSORSHIP_SET (86)
* Delegable: Delegation::delegable
* Delegable: Delegation::Delegable
* Amendment: featureSponsor
* Privileges: noPriv
* Privileges: NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SponsorshipSetBuilder to construct new transactions.
@@ -48,7 +48,7 @@ public:
// Transaction-specific field getters
/**
* @brief Get sfCounterpartySponsor (soeOPTIONAL)
* @brief Get sfCounterpartySponsor (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -74,7 +74,7 @@ public:
}
/**
* @brief Get sfSponsee (soeOPTIONAL)
* @brief Get sfSponsee (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -100,7 +100,7 @@ public:
}
/**
* @brief Get sfFeeAmount (soeOPTIONAL)
* @brief Get sfFeeAmount (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -126,7 +126,7 @@ public:
}
/**
* @brief Get sfMaxFee (soeOPTIONAL)
* @brief Get sfMaxFee (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -152,7 +152,7 @@ public:
}
/**
* @brief Get sfReserveCount (soeOPTIONAL)
* @brief Get sfReserveCount (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -182,7 +182,7 @@ public:
* @brief Builder for SponsorshipSet transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses Json::Value internally for flexible transaction construction.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class SponsorshipSetBuilder : public TransactionBuilderBase<SponsorshipSetBuilder>
@@ -219,7 +219,7 @@ public:
/** @brief Transaction-specific field setters */
/**
* @brief Set sfCounterpartySponsor (soeOPTIONAL)
* @brief Set sfCounterpartySponsor (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipSetBuilder&
@@ -230,7 +230,7 @@ public:
}
/**
* @brief Set sfSponsee (soeOPTIONAL)
* @brief Set sfSponsee (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipSetBuilder&
@@ -241,7 +241,7 @@ public:
}
/**
* @brief Set sfFeeAmount (soeOPTIONAL)
* @brief Set sfFeeAmount (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipSetBuilder&
@@ -252,7 +252,7 @@ public:
}
/**
* @brief Set sfMaxFee (soeOPTIONAL)
* @brief Set sfMaxFee (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipSetBuilder&
@@ -263,7 +263,7 @@ public:
}
/**
* @brief Set sfReserveCount (soeOPTIONAL)
* @brief Set sfReserveCount (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipSetBuilder&

View File

@@ -19,9 +19,9 @@ class SponsorshipTransferBuilder;
* @brief Transaction: SponsorshipTransfer
*
* Type: ttSPONSORSHIP_TRANSFER (85)
* Delegable: Delegation::delegable
* Delegable: Delegation::Delegable
* Amendment: featureSponsor
* Privileges: noPriv
* Privileges: NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use SponsorshipTransferBuilder to construct new transactions.
@@ -48,7 +48,7 @@ public:
// Transaction-specific field getters
/**
* @brief Get sfObjectID (soeOPTIONAL)
* @brief Get sfObjectID (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -74,7 +74,7 @@ public:
}
/**
* @brief Get sfSponsee (soeOPTIONAL)
* @brief Get sfSponsee (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
@@ -104,7 +104,7 @@ public:
* @brief Builder for SponsorshipTransfer transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses Json::Value internally for flexible transaction construction.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class SponsorshipTransferBuilder : public TransactionBuilderBase<SponsorshipTransferBuilder>
@@ -141,7 +141,7 @@ public:
/** @brief Transaction-specific field setters */
/**
* @brief Set sfObjectID (soeOPTIONAL)
* @brief Set sfObjectID (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipTransferBuilder&
@@ -152,7 +152,7 @@ public:
}
/**
* @brief Set sfSponsee (soeOPTIONAL)
* @brief Set sfSponsee (SoeOptional)
* @return Reference to this builder for method chaining.
*/
SponsorshipTransferBuilder&

View File

@@ -1,14 +1,16 @@
// Auto-generated unit tests for transaction SponsorshipSet
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/SecretKey.h>
#include <xrpl/protocol/Seed.h>
#include <xrpl/protocol_autogen/transactions/AccountSet.h>
#include <xrpl/protocol_autogen/transactions/SponsorshipSet.h>
#include <gtest/gtest.h>
#include <protocol_autogen/TestHelpers.h>
#include <xrpl/protocol/SecretKey.h>
#include <xrpl/protocol/Seed.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol_autogen/transactions/SponsorshipSet.h>
#include <xrpl/protocol_autogen/transactions/AccountSet.h>
#include <string>
namespace xrpl::transactions {
@@ -33,7 +35,11 @@ TEST(TransactionsSponsorshipSetTests, BuilderSettersRoundTrip)
auto const maxFeeValue = canonical_AMOUNT();
auto const reserveCountValue = canonical_UINT32();
SponsorshipSetBuilder builder{accountValue, sequenceValue, feeValue};
SponsorshipSetBuilder builder{
accountValue,
sequenceValue,
feeValue
};
// Set optional fields
builder.setCounterpartySponsor(counterpartySponsorValue);
@@ -61,8 +67,7 @@ TEST(TransactionsSponsorshipSetTests, BuilderSettersRoundTrip)
{
auto const& expected = counterpartySponsorValue;
auto const actualOpt = tx.getCounterpartySponsor();
ASSERT_TRUE(actualOpt.has_value())
<< "Optional field sfCounterpartySponsor should be present";
ASSERT_TRUE(actualOpt.has_value()) << "Optional field sfCounterpartySponsor should be present";
expectEqualField(expected, *actualOpt, "sfCounterpartySponsor");
EXPECT_TRUE(tx.hasCounterpartySponsor());
}
@@ -98,6 +103,7 @@ TEST(TransactionsSponsorshipSetTests, BuilderSettersRoundTrip)
expectEqualField(expected, *actualOpt, "sfReserveCount");
EXPECT_TRUE(tx.hasReserveCount());
}
}
// 2 & 4) Start from an STTx, construct a builder from it, build a new wrapper,
@@ -121,7 +127,11 @@ TEST(TransactionsSponsorshipSetTests, BuilderFromStTxRoundTrip)
auto const reserveCountValue = canonical_UINT32();
// Build an initial transaction
SponsorshipSetBuilder initialBuilder{accountValue, sequenceValue, feeValue};
SponsorshipSetBuilder initialBuilder{
accountValue,
sequenceValue,
feeValue
};
initialBuilder.setCounterpartySponsor(counterpartySponsorValue);
initialBuilder.setSponsee(sponseeValue);
@@ -149,8 +159,7 @@ TEST(TransactionsSponsorshipSetTests, BuilderFromStTxRoundTrip)
{
auto const& expected = counterpartySponsorValue;
auto const actualOpt = rebuiltTx.getCounterpartySponsor();
ASSERT_TRUE(actualOpt.has_value())
<< "Optional field sfCounterpartySponsor should be present";
ASSERT_TRUE(actualOpt.has_value()) << "Optional field sfCounterpartySponsor should be present";
expectEqualField(expected, *actualOpt, "sfCounterpartySponsor");
}
@@ -181,13 +190,15 @@ TEST(TransactionsSponsorshipSetTests, BuilderFromStTxRoundTrip)
ASSERT_TRUE(actualOpt.has_value()) << "Optional field sfReserveCount should be present";
expectEqualField(expected, *actualOpt, "sfReserveCount");
}
}
// 3) Verify wrapper throws when constructed from wrong transaction type.
TEST(TransactionsSponsorshipSetTests, WrapperThrowsOnWrongTxType)
{
// Build a valid transaction of a different type
auto const [pk, sk] = generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongType"));
auto const [pk, sk] =
generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongType"));
auto const account = calcAccountID(pk);
AccountSetBuilder wrongBuilder{account, 1, canonical_AMOUNT()};
@@ -200,7 +211,8 @@ TEST(TransactionsSponsorshipSetTests, WrapperThrowsOnWrongTxType)
TEST(TransactionsSponsorshipSetTests, BuilderThrowsOnWrongTxType)
{
// Build a valid transaction of a different type
auto const [pk, sk] = generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongTypeBuilder"));
auto const [pk, sk] =
generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongTypeBuilder"));
auto const account = calcAccountID(pk);
AccountSetBuilder wrongBuilder{account, 1, canonical_AMOUNT()};
@@ -223,7 +235,11 @@ TEST(TransactionsSponsorshipSetTests, OptionalFieldsReturnNullopt)
// Transaction-specific required field values
SponsorshipSetBuilder builder{accountValue, sequenceValue, feeValue};
SponsorshipSetBuilder builder{
accountValue,
sequenceValue,
feeValue
};
// Do NOT set optional fields
@@ -242,4 +258,4 @@ TEST(TransactionsSponsorshipSetTests, OptionalFieldsReturnNullopt)
EXPECT_FALSE(tx.getReserveCount().has_value());
}
} // namespace xrpl::transactions
}

View File

@@ -1,14 +1,16 @@
// Auto-generated unit tests for transaction SponsorshipTransfer
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/SecretKey.h>
#include <xrpl/protocol/Seed.h>
#include <xrpl/protocol_autogen/transactions/AccountSet.h>
#include <xrpl/protocol_autogen/transactions/SponsorshipTransfer.h>
#include <gtest/gtest.h>
#include <protocol_autogen/TestHelpers.h>
#include <xrpl/protocol/SecretKey.h>
#include <xrpl/protocol/Seed.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol_autogen/transactions/SponsorshipTransfer.h>
#include <xrpl/protocol_autogen/transactions/AccountSet.h>
#include <string>
namespace xrpl::transactions {
@@ -30,7 +32,11 @@ TEST(TransactionsSponsorshipTransferTests, BuilderSettersRoundTrip)
auto const objectIDValue = canonical_UINT256();
auto const sponseeValue = canonical_ACCOUNT();
SponsorshipTransferBuilder builder{accountValue, sequenceValue, feeValue};
SponsorshipTransferBuilder builder{
accountValue,
sequenceValue,
feeValue
};
// Set optional fields
builder.setObjectID(objectIDValue);
@@ -67,6 +73,7 @@ TEST(TransactionsSponsorshipTransferTests, BuilderSettersRoundTrip)
expectEqualField(expected, *actualOpt, "sfSponsee");
EXPECT_TRUE(tx.hasSponsee());
}
}
// 2 & 4) Start from an STTx, construct a builder from it, build a new wrapper,
@@ -87,7 +94,11 @@ TEST(TransactionsSponsorshipTransferTests, BuilderFromStTxRoundTrip)
auto const sponseeValue = canonical_ACCOUNT();
// Build an initial transaction
SponsorshipTransferBuilder initialBuilder{accountValue, sequenceValue, feeValue};
SponsorshipTransferBuilder initialBuilder{
accountValue,
sequenceValue,
feeValue
};
initialBuilder.setObjectID(objectIDValue);
initialBuilder.setSponsee(sponseeValue);
@@ -122,13 +133,15 @@ TEST(TransactionsSponsorshipTransferTests, BuilderFromStTxRoundTrip)
ASSERT_TRUE(actualOpt.has_value()) << "Optional field sfSponsee should be present";
expectEqualField(expected, *actualOpt, "sfSponsee");
}
}
// 3) Verify wrapper throws when constructed from wrong transaction type.
TEST(TransactionsSponsorshipTransferTests, WrapperThrowsOnWrongTxType)
{
// Build a valid transaction of a different type
auto const [pk, sk] = generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongType"));
auto const [pk, sk] =
generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongType"));
auto const account = calcAccountID(pk);
AccountSetBuilder wrongBuilder{account, 1, canonical_AMOUNT()};
@@ -141,7 +154,8 @@ TEST(TransactionsSponsorshipTransferTests, WrapperThrowsOnWrongTxType)
TEST(TransactionsSponsorshipTransferTests, BuilderThrowsOnWrongTxType)
{
// Build a valid transaction of a different type
auto const [pk, sk] = generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongTypeBuilder"));
auto const [pk, sk] =
generateKeyPair(KeyType::Secp256k1, generateSeed("testWrongTypeBuilder"));
auto const account = calcAccountID(pk);
AccountSetBuilder wrongBuilder{account, 1, canonical_AMOUNT()};
@@ -164,7 +178,11 @@ TEST(TransactionsSponsorshipTransferTests, OptionalFieldsReturnNullopt)
// Transaction-specific required field values
SponsorshipTransferBuilder builder{accountValue, sequenceValue, feeValue};
SponsorshipTransferBuilder builder{
accountValue,
sequenceValue,
feeValue
};
// Do NOT set optional fields
@@ -177,4 +195,4 @@ TEST(TransactionsSponsorshipTransferTests, OptionalFieldsReturnNullopt)
EXPECT_FALSE(tx.getSponsee().has_value());
}
} // namespace xrpl::transactions
}