// This file is auto-generated. Do not edit. #pragma once #include #include #include #include #include #include #include #include namespace xrpl::transactions { class LoanBrokerSetBuilder; /** * @brief Transaction: LoanBrokerSet * * Type: ttLOAN_BROKER_SET (74) * Delegable: Delegation::notDelegable * Amendment: featureLendingProtocol * Privileges: createPseudoAcct | mayAuthorizeMPT * * Immutable wrapper around STTx providing type-safe field access. * Use LoanBrokerSetBuilder to construct new transactions. */ class LoanBrokerSet : public TransactionBase { public: static constexpr xrpl::TxType txType = ttLOAN_BROKER_SET; /** * @brief Construct a LoanBrokerSet transaction wrapper from an existing STTx object. * @throws std::runtime_error if the transaction type doesn't match. */ explicit LoanBrokerSet(std::shared_ptr tx) : TransactionBase(std::move(tx)) { // Verify transaction type if (tx_->getTxnType() != txType) { throw std::runtime_error("Invalid transaction type for LoanBrokerSet"); } } // Transaction-specific field getters /** * @brief Get sfVaultID (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_UINT256::type::value_type getVaultID() const { return this->tx_->at(sfVaultID); } /** * @brief Get sfLoanBrokerID (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getLoanBrokerID() const { if (hasLoanBrokerID()) { return this->tx_->at(sfLoanBrokerID); } return std::nullopt; } /** * @brief Check if sfLoanBrokerID is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasLoanBrokerID() const { return this->tx_->isFieldPresent(sfLoanBrokerID); } /** * @brief Get sfData (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getData() const { if (hasData()) { return this->tx_->at(sfData); } return std::nullopt; } /** * @brief Check if sfData is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasData() const { return this->tx_->isFieldPresent(sfData); } /** * @brief Get sfManagementFeeRate (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getManagementFeeRate() const { if (hasManagementFeeRate()) { return this->tx_->at(sfManagementFeeRate); } return std::nullopt; } /** * @brief Check if sfManagementFeeRate is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasManagementFeeRate() const { return this->tx_->isFieldPresent(sfManagementFeeRate); } /** * @brief Get sfDebtMaximum (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getDebtMaximum() const { if (hasDebtMaximum()) { return this->tx_->at(sfDebtMaximum); } return std::nullopt; } /** * @brief Check if sfDebtMaximum is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasDebtMaximum() const { return this->tx_->isFieldPresent(sfDebtMaximum); } /** * @brief Get sfCoverRateMinimum (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getCoverRateMinimum() const { if (hasCoverRateMinimum()) { return this->tx_->at(sfCoverRateMinimum); } return std::nullopt; } /** * @brief Check if sfCoverRateMinimum is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasCoverRateMinimum() const { return this->tx_->isFieldPresent(sfCoverRateMinimum); } /** * @brief Get sfCoverRateLiquidation (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getCoverRateLiquidation() const { if (hasCoverRateLiquidation()) { return this->tx_->at(sfCoverRateLiquidation); } return std::nullopt; } /** * @brief Check if sfCoverRateLiquidation is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasCoverRateLiquidation() const { return this->tx_->isFieldPresent(sfCoverRateLiquidation); } }; /** * @brief Builder for LoanBrokerSet transactions. * * Provides a fluent interface for constructing transactions with method chaining. * Uses Json::Value internally for flexible transaction construction. * Inherits common field setters from TransactionBuilderBase. */ class LoanBrokerSetBuilder : public TransactionBuilderBase { public: /** * @brief Construct a new LoanBrokerSetBuilder with required fields. * @param account The account initiating the transaction. * @param vaultID The sfVaultID field value. * @param sequence Optional sequence number for the transaction. * @param fee Optional fee for the transaction. */ LoanBrokerSetBuilder(SF_ACCOUNT::type::value_type account, std::decay_t const& vaultID, std::optional sequence = std::nullopt, std::optional fee = std::nullopt ) : TransactionBuilderBase(ttLOAN_BROKER_SET, account, sequence, fee) { setVaultID(vaultID); } /** * @brief Construct a LoanBrokerSetBuilder from an existing STTx object. * @param tx The existing transaction to copy from. * @throws std::runtime_error if the transaction type doesn't match. */ LoanBrokerSetBuilder(std::shared_ptr tx) { if (tx->getTxnType() != ttLOAN_BROKER_SET) { throw std::runtime_error("Invalid transaction type for LoanBrokerSetBuilder"); } object_ = *tx; } /** @brief Transaction-specific field setters */ /** * @brief Set sfVaultID (soeREQUIRED) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setVaultID(std::decay_t const& value) { object_[sfVaultID] = value; return *this; } /** * @brief Set sfLoanBrokerID (soeOPTIONAL) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setLoanBrokerID(std::decay_t const& value) { object_[sfLoanBrokerID] = value; return *this; } /** * @brief Set sfData (soeOPTIONAL) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setData(std::decay_t const& value) { object_[sfData] = value; return *this; } /** * @brief Set sfManagementFeeRate (soeOPTIONAL) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setManagementFeeRate(std::decay_t const& value) { object_[sfManagementFeeRate] = value; return *this; } /** * @brief Set sfDebtMaximum (soeOPTIONAL) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setDebtMaximum(std::decay_t const& value) { object_[sfDebtMaximum] = value; return *this; } /** * @brief Set sfCoverRateMinimum (soeOPTIONAL) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setCoverRateMinimum(std::decay_t const& value) { object_[sfCoverRateMinimum] = value; return *this; } /** * @brief Set sfCoverRateLiquidation (soeOPTIONAL) * @return Reference to this builder for method chaining. */ LoanBrokerSetBuilder& setCoverRateLiquidation(std::decay_t const& value) { object_[sfCoverRateLiquidation] = value; return *this; } /** * @brief Build and return the LoanBrokerSet wrapper. * @param publicKey The public key for signing. * @param secretKey The secret key for signing. * @return The constructed transaction wrapper. */ LoanBrokerSet build(PublicKey const& publicKey, SecretKey const& secretKey) { sign(publicKey, secretKey); return LoanBrokerSet{std::make_shared(std::move(object_))}; } }; } // namespace xrpl::transactions