From 2ed465996eb2af0d7f2db19c1a9e58d3f4333ccc Mon Sep 17 00:00:00 2001 From: JCW Date: Tue, 14 Jul 2026 12:03:25 +0100 Subject: [PATCH] Update auto generated files --- .../protocol_autogen/transactions/LoanSet.h | 37 +++++++++++++++++++ .../transactions/LoanSetTests.cpp | 21 +++++++++++ 2 files changed, 58 insertions(+) diff --git a/include/xrpl/protocol_autogen/transactions/LoanSet.h b/include/xrpl/protocol_autogen/transactions/LoanSet.h index aef9ef0e74..fdec138746 100644 --- a/include/xrpl/protocol_autogen/transactions/LoanSet.h +++ b/include/xrpl/protocol_autogen/transactions/LoanSet.h @@ -482,6 +482,32 @@ public: { return this->tx_->isFieldPresent(sfGracePeriod); } + + /** + * @brief Get sfStartDate (SoeOptional) + * @return The field value, or std::nullopt if not present. + */ + [[nodiscard]] + protocol_autogen::Optional + getStartDate() const + { + if (hasStartDate()) + { + return this->tx_->at(sfStartDate); + } + return std::nullopt; + } + + /** + * @brief Check if sfStartDate is present. + * @return True if the field is present, false otherwise. + */ + [[nodiscard]] + bool + hasStartDate() const + { + return this->tx_->isFieldPresent(sfStartDate); + } }; /** @@ -726,6 +752,17 @@ public: return *this; } + /** + * @brief Set sfStartDate (SoeOptional) + * @return Reference to this builder for method chaining. + */ + LoanSetBuilder& + setStartDate(std::decay_t const& value) + { + object_[sfStartDate] = value; + return *this; + } + /** * @brief Build and return the LoanSet wrapper. * @param publicKey The public key for signing. diff --git a/src/tests/libxrpl/protocol_autogen/transactions/LoanSetTests.cpp b/src/tests/libxrpl/protocol_autogen/transactions/LoanSetTests.cpp index 2c177d489f..83609c162f 100644 --- a/src/tests/libxrpl/protocol_autogen/transactions/LoanSetTests.cpp +++ b/src/tests/libxrpl/protocol_autogen/transactions/LoanSetTests.cpp @@ -47,6 +47,7 @@ TEST(TransactionsLoanSetTests, BuilderSettersRoundTrip) auto const paymentTotalValue = canonical_UINT32(); auto const paymentIntervalValue = canonical_UINT32(); auto const gracePeriodValue = canonical_UINT32(); + auto const startDateValue = canonical_UINT32(); LoanSetBuilder builder{ accountValue, @@ -73,6 +74,7 @@ TEST(TransactionsLoanSetTests, BuilderSettersRoundTrip) builder.setPaymentTotal(paymentTotalValue); builder.setPaymentInterval(paymentIntervalValue); builder.setGracePeriod(gracePeriodValue); + builder.setStartDate(startDateValue); auto tx = builder.build(publicKey, secretKey); @@ -230,6 +232,14 @@ TEST(TransactionsLoanSetTests, BuilderSettersRoundTrip) EXPECT_TRUE(tx.hasGracePeriod()); } + { + auto const& expected = startDateValue; + auto const actualOpt = tx.getStartDate(); + ASSERT_TRUE(actualOpt.has_value()) << "Optional field sfStartDate should be present"; + expectEqualField(expected, *actualOpt, "sfStartDate"); + EXPECT_TRUE(tx.hasStartDate()); + } + } // 2 & 4) Start from an STTx, construct a builder from it, build a new wrapper, @@ -264,6 +274,7 @@ TEST(TransactionsLoanSetTests, BuilderFromStTxRoundTrip) auto const paymentTotalValue = canonical_UINT32(); auto const paymentIntervalValue = canonical_UINT32(); auto const gracePeriodValue = canonical_UINT32(); + auto const startDateValue = canonical_UINT32(); // Build an initial transaction LoanSetBuilder initialBuilder{ @@ -290,6 +301,7 @@ TEST(TransactionsLoanSetTests, BuilderFromStTxRoundTrip) initialBuilder.setPaymentTotal(paymentTotalValue); initialBuilder.setPaymentInterval(paymentIntervalValue); initialBuilder.setGracePeriod(gracePeriodValue); + initialBuilder.setStartDate(startDateValue); auto initialTx = initialBuilder.build(publicKey, secretKey); @@ -432,6 +444,13 @@ TEST(TransactionsLoanSetTests, BuilderFromStTxRoundTrip) expectEqualField(expected, *actualOpt, "sfGracePeriod"); } + { + auto const& expected = startDateValue; + auto const actualOpt = rebuiltTx.getStartDate(); + ASSERT_TRUE(actualOpt.has_value()) << "Optional field sfStartDate should be present"; + expectEqualField(expected, *actualOpt, "sfStartDate"); + } + } // 3) Verify wrapper throws when constructed from wrong transaction type. @@ -523,6 +542,8 @@ TEST(TransactionsLoanSetTests, OptionalFieldsReturnNullopt) EXPECT_FALSE(tx.getPaymentInterval().has_value()); EXPECT_FALSE(tx.hasGracePeriod()); EXPECT_FALSE(tx.getGracePeriod().has_value()); + EXPECT_FALSE(tx.hasStartDate()); + EXPECT_FALSE(tx.getStartDate().has_value()); } }