Update protocol autogen files

This commit is contained in:
JCW
2026-07-08 16:09:56 +01:00
parent 080d5de281
commit 9a24c623ee
8 changed files with 438 additions and 27 deletions

View File

@@ -68,14 +68,27 @@ public:
}
/**
* @brief Get sfOwnerNode (SoeRequired)
* @return The field value.
* @brief Get sfOwnerNode (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
SF_UINT64::type::value_type
protocol_autogen::Optional<SF_UINT64::type::value_type>
getOwnerNode() const
{
return this->sle_->at(sfOwnerNode);
if (hasOwnerNode())
return this->sle_->at(sfOwnerNode);
return std::nullopt;
}
/**
* @brief Check if sfOwnerNode is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasOwnerNode() const
{
return this->sle_->isFieldPresent(sfOwnerNode);
}
/**
@@ -578,7 +591,6 @@ public:
* @brief Construct a new LoanBuilder with required fields.
* @param previousTxnID The sfPreviousTxnID field value.
* @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value.
* @param ownerNode The sfOwnerNode field value.
* @param loanBrokerNode The sfLoanBrokerNode field value.
* @param loanBrokerID The sfLoanBrokerID field value.
* @param loanSequence The sfLoanSequence field value.
@@ -587,12 +599,11 @@ public:
* @param paymentInterval The sfPaymentInterval field value.
* @param periodicPayment The sfPeriodicPayment field value.
*/
LoanBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq,std::decay_t<typename SF_UINT64::type::value_type> const& ownerNode,std::decay_t<typename SF_UINT64::type::value_type> const& loanBrokerNode,std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID,std::decay_t<typename SF_UINT32::type::value_type> const& loanSequence,std::decay_t<typename SF_ACCOUNT::type::value_type> const& borrower,std::decay_t<typename SF_UINT32::type::value_type> const& startDate,std::decay_t<typename SF_UINT32::type::value_type> const& paymentInterval,std::decay_t<typename SF_NUMBER::type::value_type> const& periodicPayment)
LoanBuilder(std::decay_t<typename SF_UINT256::type::value_type> const& previousTxnID,std::decay_t<typename SF_UINT32::type::value_type> const& previousTxnLgrSeq,std::decay_t<typename SF_UINT64::type::value_type> const& loanBrokerNode,std::decay_t<typename SF_UINT256::type::value_type> const& loanBrokerID,std::decay_t<typename SF_UINT32::type::value_type> const& loanSequence,std::decay_t<typename SF_ACCOUNT::type::value_type> const& borrower,std::decay_t<typename SF_UINT32::type::value_type> const& startDate,std::decay_t<typename SF_UINT32::type::value_type> const& paymentInterval,std::decay_t<typename SF_NUMBER::type::value_type> const& periodicPayment)
: LedgerEntryBuilderBase<LoanBuilder>(ltLOAN)
{
setPreviousTxnID(previousTxnID);
setPreviousTxnLgrSeq(previousTxnLgrSeq);
setOwnerNode(ownerNode);
setLoanBrokerNode(loanBrokerNode);
setLoanBrokerID(loanBrokerID);
setLoanSequence(loanSequence);
@@ -641,7 +652,7 @@ public:
}
/**
* @brief Set sfOwnerNode (SoeRequired)
* @brief Set sfOwnerNode (SoeOptional)
* @return Reference to this builder for method chaining.
*/
LoanBuilder&

View File

@@ -287,6 +287,30 @@ public:
{
return this->sle_->isFieldPresent(sfScale);
}
/**
* @brief Get sfAssetsReserved (SoeDefault)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_NUMBER::type::value_type>
getAssetsReserved() const
{
if (hasAssetsReserved())
return this->sle_->at(sfAssetsReserved);
return std::nullopt;
}
/**
* @brief Check if sfAssetsReserved is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasAssetsReserved() const
{
return this->sle_->isFieldPresent(sfAssetsReserved);
}
};
/**
@@ -506,6 +530,17 @@ public:
return *this;
}
/**
* @brief Set sfAssetsReserved (SoeDefault)
* @return Reference to this builder for method chaining.
*/
VaultBuilder&
setAssetsReserved(std::decay_t<typename SF_NUMBER::type::value_type> const& value)
{
object_[sfAssetsReserved] = value;
return *this;
}
/**
* @brief Build and return the completed Vault wrapper.
* @param index The ledger entry index.

View File

@@ -0,0 +1,129 @@
// This file is auto-generated. Do not edit.
#pragma once
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/STParsedJSON.h>
#include <xrpl/protocol/jss.h>
#include <xrpl/protocol_autogen/TransactionBase.h>
#include <xrpl/protocol_autogen/TransactionBuilderBase.h>
#include <xrpl/json/json_value.h>
#include <stdexcept>
#include <optional>
namespace xrpl::transactions {
class LoanAcceptBuilder;
/**
* @brief Transaction: LoanAccept
*
* Type: ttLOAN_ACCEPT (83)
* Delegable: Delegation::NotDelegable
* Amendment: featureLendingProtocolV1_1
* Privileges: NoPriv
*
* Immutable wrapper around STTx providing type-safe field access.
* Use LoanAcceptBuilder to construct new transactions.
*/
class LoanAccept : public TransactionBase
{
public:
static constexpr xrpl::TxType txType = ttLOAN_ACCEPT;
/**
* @brief Construct a LoanAccept transaction wrapper from an existing STTx object.
* @throws std::runtime_error if the transaction type doesn't match.
*/
explicit LoanAccept(std::shared_ptr<STTx const> tx)
: TransactionBase(std::move(tx))
{
// Verify transaction type
if (tx_->getTxnType() != txType)
{
throw std::runtime_error("Invalid transaction type for LoanAccept");
}
}
// Transaction-specific field getters
/**
* @brief Get sfLoanID (SoeRequired)
* @return The field value.
*/
[[nodiscard]]
SF_UINT256::type::value_type
getLoanID() const
{
return this->tx_->at(sfLoanID);
}
};
/**
* @brief Builder for LoanAccept transactions.
*
* Provides a fluent interface for constructing transactions with method chaining.
* Uses STObject internally for flexible transaction construction.
* Inherits common field setters from TransactionBuilderBase.
*/
class LoanAcceptBuilder : public TransactionBuilderBase<LoanAcceptBuilder>
{
public:
/**
* @brief Construct a new LoanAcceptBuilder with required fields.
* @param account The account initiating the transaction.
* @param loanID The sfLoanID field value.
* @param sequence Optional sequence number for the transaction.
* @param fee Optional fee for the transaction.
*/
LoanAcceptBuilder(SF_ACCOUNT::type::value_type account,
std::decay_t<typename SF_UINT256::type::value_type> const& loanID, std::optional<SF_UINT32::type::value_type> sequence = std::nullopt,
std::optional<SF_AMOUNT::type::value_type> fee = std::nullopt
)
: TransactionBuilderBase<LoanAcceptBuilder>(ttLOAN_ACCEPT, account, sequence, fee)
{
setLoanID(loanID);
}
/**
* @brief Construct a LoanAcceptBuilder from an existing STTx object.
* @param tx The existing transaction to copy from.
* @throws std::runtime_error if the transaction type doesn't match.
*/
LoanAcceptBuilder(std::shared_ptr<STTx const> tx)
{
if (tx->getTxnType() != ttLOAN_ACCEPT)
{
throw std::runtime_error("Invalid transaction type for LoanAcceptBuilder");
}
object_ = *tx;
}
/** @brief Transaction-specific field setters */
/**
* @brief Set sfLoanID (SoeRequired)
* @return Reference to this builder for method chaining.
*/
LoanAcceptBuilder&
setLoanID(std::decay_t<typename SF_UINT256::type::value_type> const& value)
{
object_[sfLoanID] = value;
return *this;
}
/**
* @brief Build and return the LoanAccept wrapper.
* @param publicKey The public key for signing.
* @param secretKey The secret key for signing.
* @return The constructed transaction wrapper.
*/
LoanAccept
build(PublicKey const& publicKey, SecretKey const& secretKey)
{
sign(publicKey, secretKey);
return LoanAccept{std::make_shared<STTx>(std::move(object_))};
}
};
} // namespace xrpl::transactions

View File

@@ -84,6 +84,32 @@ public:
return this->tx_->isFieldPresent(sfData);
}
/**
* @brief Get sfBorrower (SoeOptional)
* @return The field value, or std::nullopt if not present.
*/
[[nodiscard]]
protocol_autogen::Optional<SF_ACCOUNT::type::value_type>
getBorrower() const
{
if (hasBorrower())
{
return this->tx_->at(sfBorrower);
}
return std::nullopt;
}
/**
* @brief Check if sfBorrower is present.
* @return True if the field is present, false otherwise.
*/
[[nodiscard]]
bool
hasBorrower() const
{
return this->tx_->isFieldPresent(sfBorrower);
}
/**
* @brief Get sfCounterparty (SoeOptional)
* @return The field value, or std::nullopt if not present.
@@ -524,6 +550,17 @@ public:
return *this;
}
/**
* @brief Set sfBorrower (SoeOptional)
* @return Reference to this builder for method chaining.
*/
LoanSetBuilder&
setBorrower(std::decay_t<typename SF_ACCOUNT::type::value_type> const& value)
{
object_[sfBorrower] = value;
return *this;
}
/**
* @brief Set sfCounterparty (SoeOptional)
* @return Reference to this builder for method chaining.