// This file is auto-generated. Do not edit. #pragma once #include #include #include #include #include #include #include #include namespace xrpl::ledger_entries { class FeeSettingsBuilder; /** * @brief Ledger Entry: FeeSettings * * Type: ltFEE_SETTINGS (0x0073) * RPC Name: fee * * Immutable wrapper around SLE providing type-safe field access. * Use FeeSettingsBuilder to construct new ledger entries. */ class FeeSettings : public LedgerEntryBase { public: static constexpr LedgerEntryType entryType = ltFEE_SETTINGS; /** * @brief Construct a FeeSettings ledger entry wrapper from an existing SLE object. * @throws std::runtime_error if the ledger entry type doesn't match. */ explicit FeeSettings(std::shared_ptr sle) : LedgerEntryBase(std::move(sle)) { // Verify ledger entry type if (sle_->getType() != entryType) { throw std::runtime_error("Invalid ledger entry type for FeeSettings"); } } // Ledger entry-specific field getters /** * @brief Get sfBaseFee (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getBaseFee() const { if (hasBaseFee()) return this->sle_->at(sfBaseFee); return std::nullopt; } /** * @brief Check if sfBaseFee is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasBaseFee() const { return this->sle_->isFieldPresent(sfBaseFee); } /** * @brief Get sfReferenceFeeUnits (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getReferenceFeeUnits() const { if (hasReferenceFeeUnits()) return this->sle_->at(sfReferenceFeeUnits); return std::nullopt; } /** * @brief Check if sfReferenceFeeUnits is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasReferenceFeeUnits() const { return this->sle_->isFieldPresent(sfReferenceFeeUnits); } /** * @brief Get sfReserveBase (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getReserveBase() const { if (hasReserveBase()) return this->sle_->at(sfReserveBase); return std::nullopt; } /** * @brief Check if sfReserveBase is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasReserveBase() const { return this->sle_->isFieldPresent(sfReserveBase); } /** * @brief Get sfReserveIncrement (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getReserveIncrement() const { if (hasReserveIncrement()) return this->sle_->at(sfReserveIncrement); return std::nullopt; } /** * @brief Check if sfReserveIncrement is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasReserveIncrement() const { return this->sle_->isFieldPresent(sfReserveIncrement); } /** * @brief Get sfBaseFeeDrops (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getBaseFeeDrops() const { if (hasBaseFeeDrops()) return this->sle_->at(sfBaseFeeDrops); return std::nullopt; } /** * @brief Check if sfBaseFeeDrops is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasBaseFeeDrops() const { return this->sle_->isFieldPresent(sfBaseFeeDrops); } /** * @brief Get sfReserveBaseDrops (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getReserveBaseDrops() const { if (hasReserveBaseDrops()) return this->sle_->at(sfReserveBaseDrops); return std::nullopt; } /** * @brief Check if sfReserveBaseDrops is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasReserveBaseDrops() const { return this->sle_->isFieldPresent(sfReserveBaseDrops); } /** * @brief Get sfReserveIncrementDrops (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getReserveIncrementDrops() const { if (hasReserveIncrementDrops()) return this->sle_->at(sfReserveIncrementDrops); return std::nullopt; } /** * @brief Check if sfReserveIncrementDrops is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasReserveIncrementDrops() const { return this->sle_->isFieldPresent(sfReserveIncrementDrops); } /** * @brief Get sfPreviousTxnID (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getPreviousTxnID() const { if (hasPreviousTxnID()) return this->sle_->at(sfPreviousTxnID); return std::nullopt; } /** * @brief Check if sfPreviousTxnID is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasPreviousTxnID() const { return this->sle_->isFieldPresent(sfPreviousTxnID); } /** * @brief Get sfPreviousTxnLgrSeq (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getPreviousTxnLgrSeq() const { if (hasPreviousTxnLgrSeq()) return this->sle_->at(sfPreviousTxnLgrSeq); return std::nullopt; } /** * @brief Check if sfPreviousTxnLgrSeq is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasPreviousTxnLgrSeq() const { return this->sle_->isFieldPresent(sfPreviousTxnLgrSeq); } }; /** * @brief Builder for FeeSettings ledger entries. * * Provides a fluent interface for constructing ledger entries with method chaining. * Uses Json::Value internally for flexible ledger entry construction. * Inherits common field setters from LedgerEntryBuilderBase. */ class FeeSettingsBuilder : public LedgerEntryBuilderBase { public: /** * @brief Construct a new FeeSettingsBuilder with required fields. */ FeeSettingsBuilder() : LedgerEntryBuilderBase(ltFEE_SETTINGS) { } /** * @brief Construct a FeeSettingsBuilder from an existing SLE object. * @param sle The existing ledger entry to copy from. * @throws std::runtime_error if the ledger entry type doesn't match. */ FeeSettingsBuilder(std::shared_ptr sle) { if (sle->at(sfLedgerEntryType) != ltFEE_SETTINGS) { throw std::runtime_error("Invalid ledger entry type for FeeSettings"); } object_ = *sle; } /** @brief Ledger entry-specific field setters */ /** * @brief Set sfBaseFee (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setBaseFee(std::decay_t const& value) { object_[sfBaseFee] = value; return *this; } /** * @brief Set sfReferenceFeeUnits (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setReferenceFeeUnits(std::decay_t const& value) { object_[sfReferenceFeeUnits] = value; return *this; } /** * @brief Set sfReserveBase (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setReserveBase(std::decay_t const& value) { object_[sfReserveBase] = value; return *this; } /** * @brief Set sfReserveIncrement (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setReserveIncrement(std::decay_t const& value) { object_[sfReserveIncrement] = value; return *this; } /** * @brief Set sfBaseFeeDrops (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setBaseFeeDrops(std::decay_t const& value) { object_[sfBaseFeeDrops] = value; return *this; } /** * @brief Set sfReserveBaseDrops (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setReserveBaseDrops(std::decay_t const& value) { object_[sfReserveBaseDrops] = value; return *this; } /** * @brief Set sfReserveIncrementDrops (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setReserveIncrementDrops(std::decay_t const& value) { object_[sfReserveIncrementDrops] = value; return *this; } /** * @brief Set sfPreviousTxnID (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setPreviousTxnID(std::decay_t const& value) { object_[sfPreviousTxnID] = value; return *this; } /** * @brief Set sfPreviousTxnLgrSeq (soeOPTIONAL) * @return Reference to this builder for method chaining. */ FeeSettingsBuilder& setPreviousTxnLgrSeq(std::decay_t const& value) { object_[sfPreviousTxnLgrSeq] = value; return *this; } /** * @brief Build and return the completed FeeSettings wrapper. * @param index The ledger entry index. * @return The constructed ledger entry wrapper. */ FeeSettings build(uint256 const& index) { return FeeSettings{std::make_shared(std::move(object_), index)}; } }; } // namespace xrpl::ledger_entries