// This file is auto-generated. Do not edit. #pragma once #include #include #include #include #include #include #include #include namespace xrpl::ledger_entries { class EscrowBuilder; /** * @brief Ledger Entry: Escrow * * Type: ltESCROW (0x0075) * RPC Name: escrow * * Immutable wrapper around SLE providing type-safe field access. * Use EscrowBuilder to construct new ledger entries. */ class Escrow : public LedgerEntryBase { public: static constexpr LedgerEntryType entryType = ltESCROW; /** * @brief Construct a Escrow ledger entry wrapper from an existing SLE object. * @throws std::runtime_error if the ledger entry type doesn't match. */ explicit Escrow(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 Escrow"); } } // Ledger entry-specific field getters /** * @brief Get sfAccount (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_ACCOUNT::type::value_type getAccount() const { return this->sle_->at(sfAccount); } /** * @brief Get sfSequence (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getSequence() const { if (hasSequence()) return this->sle_->at(sfSequence); return std::nullopt; } /** * @brief Check if sfSequence is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasSequence() const { return this->sle_->isFieldPresent(sfSequence); } /** * @brief Get sfDestination (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_ACCOUNT::type::value_type getDestination() const { return this->sle_->at(sfDestination); } /** * @brief Get sfAmount (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_AMOUNT::type::value_type getAmount() const { return this->sle_->at(sfAmount); } /** * @brief Get sfCondition (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getCondition() const { if (hasCondition()) return this->sle_->at(sfCondition); return std::nullopt; } /** * @brief Check if sfCondition is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasCondition() const { return this->sle_->isFieldPresent(sfCondition); } /** * @brief Get sfCancelAfter (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getCancelAfter() const { if (hasCancelAfter()) return this->sle_->at(sfCancelAfter); return std::nullopt; } /** * @brief Check if sfCancelAfter is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasCancelAfter() const { return this->sle_->isFieldPresent(sfCancelAfter); } /** * @brief Get sfFinishAfter (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getFinishAfter() const { if (hasFinishAfter()) return this->sle_->at(sfFinishAfter); return std::nullopt; } /** * @brief Check if sfFinishAfter is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasFinishAfter() const { return this->sle_->isFieldPresent(sfFinishAfter); } /** * @brief Get sfSourceTag (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getSourceTag() const { if (hasSourceTag()) return this->sle_->at(sfSourceTag); return std::nullopt; } /** * @brief Check if sfSourceTag is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasSourceTag() const { return this->sle_->isFieldPresent(sfSourceTag); } /** * @brief Get sfDestinationTag (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getDestinationTag() const { if (hasDestinationTag()) return this->sle_->at(sfDestinationTag); return std::nullopt; } /** * @brief Check if sfDestinationTag is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasDestinationTag() const { return this->sle_->isFieldPresent(sfDestinationTag); } /** * @brief Get sfOwnerNode (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_UINT64::type::value_type getOwnerNode() const { return this->sle_->at(sfOwnerNode); } /** * @brief Get sfPreviousTxnID (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_UINT256::type::value_type getPreviousTxnID() const { return this->sle_->at(sfPreviousTxnID); } /** * @brief Get sfPreviousTxnLgrSeq (soeREQUIRED) * @return The field value. */ [[nodiscard]] SF_UINT32::type::value_type getPreviousTxnLgrSeq() const { return this->sle_->at(sfPreviousTxnLgrSeq); } /** * @brief Get sfDestinationNode (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getDestinationNode() const { if (hasDestinationNode()) return this->sle_->at(sfDestinationNode); return std::nullopt; } /** * @brief Check if sfDestinationNode is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasDestinationNode() const { return this->sle_->isFieldPresent(sfDestinationNode); } /** * @brief Get sfTransferRate (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getTransferRate() const { if (hasTransferRate()) return this->sle_->at(sfTransferRate); return std::nullopt; } /** * @brief Check if sfTransferRate is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasTransferRate() const { return this->sle_->isFieldPresent(sfTransferRate); } /** * @brief Get sfIssuerNode (soeOPTIONAL) * @return The field value, or std::nullopt if not present. */ [[nodiscard]] protocol_autogen::Optional getIssuerNode() const { if (hasIssuerNode()) return this->sle_->at(sfIssuerNode); return std::nullopt; } /** * @brief Check if sfIssuerNode is present. * @return True if the field is present, false otherwise. */ [[nodiscard]] bool hasIssuerNode() const { return this->sle_->isFieldPresent(sfIssuerNode); } }; /** * @brief Builder for Escrow 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 EscrowBuilder : public LedgerEntryBuilderBase { public: /** * @brief Construct a new EscrowBuilder with required fields. * @param account The sfAccount field value. * @param destination The sfDestination field value. * @param amount The sfAmount field value. * @param ownerNode The sfOwnerNode field value. * @param previousTxnID The sfPreviousTxnID field value. * @param previousTxnLgrSeq The sfPreviousTxnLgrSeq field value. */ EscrowBuilder(std::decay_t const& account,std::decay_t const& destination,std::decay_t const& amount,std::decay_t const& ownerNode,std::decay_t const& previousTxnID,std::decay_t const& previousTxnLgrSeq) : LedgerEntryBuilderBase(ltESCROW) { setAccount(account); setDestination(destination); setAmount(amount); setOwnerNode(ownerNode); setPreviousTxnID(previousTxnID); setPreviousTxnLgrSeq(previousTxnLgrSeq); } /** * @brief Construct a EscrowBuilder 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. */ EscrowBuilder(std::shared_ptr sle) { if (sle->at(sfLedgerEntryType) != ltESCROW) { throw std::runtime_error("Invalid ledger entry type for Escrow"); } object_ = *sle; } /** @brief Ledger entry-specific field setters */ /** * @brief Set sfAccount (soeREQUIRED) * @return Reference to this builder for method chaining. */ EscrowBuilder& setAccount(std::decay_t const& value) { object_[sfAccount] = value; return *this; } /** * @brief Set sfSequence (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setSequence(std::decay_t const& value) { object_[sfSequence] = value; return *this; } /** * @brief Set sfDestination (soeREQUIRED) * @return Reference to this builder for method chaining. */ EscrowBuilder& setDestination(std::decay_t const& value) { object_[sfDestination] = value; return *this; } /** * @brief Set sfAmount (soeREQUIRED) * @return Reference to this builder for method chaining. */ EscrowBuilder& setAmount(std::decay_t const& value) { object_[sfAmount] = value; return *this; } /** * @brief Set sfCondition (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setCondition(std::decay_t const& value) { object_[sfCondition] = value; return *this; } /** * @brief Set sfCancelAfter (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setCancelAfter(std::decay_t const& value) { object_[sfCancelAfter] = value; return *this; } /** * @brief Set sfFinishAfter (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setFinishAfter(std::decay_t const& value) { object_[sfFinishAfter] = value; return *this; } /** * @brief Set sfSourceTag (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setSourceTag(std::decay_t const& value) { object_[sfSourceTag] = value; return *this; } /** * @brief Set sfDestinationTag (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setDestinationTag(std::decay_t const& value) { object_[sfDestinationTag] = value; return *this; } /** * @brief Set sfOwnerNode (soeREQUIRED) * @return Reference to this builder for method chaining. */ EscrowBuilder& setOwnerNode(std::decay_t const& value) { object_[sfOwnerNode] = value; return *this; } /** * @brief Set sfPreviousTxnID (soeREQUIRED) * @return Reference to this builder for method chaining. */ EscrowBuilder& setPreviousTxnID(std::decay_t const& value) { object_[sfPreviousTxnID] = value; return *this; } /** * @brief Set sfPreviousTxnLgrSeq (soeREQUIRED) * @return Reference to this builder for method chaining. */ EscrowBuilder& setPreviousTxnLgrSeq(std::decay_t const& value) { object_[sfPreviousTxnLgrSeq] = value; return *this; } /** * @brief Set sfDestinationNode (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setDestinationNode(std::decay_t const& value) { object_[sfDestinationNode] = value; return *this; } /** * @brief Set sfTransferRate (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setTransferRate(std::decay_t const& value) { object_[sfTransferRate] = value; return *this; } /** * @brief Set sfIssuerNode (soeOPTIONAL) * @return Reference to this builder for method chaining. */ EscrowBuilder& setIssuerNode(std::decay_t const& value) { object_[sfIssuerNode] = value; return *this; } /** * @brief Build and return the completed Escrow wrapper. * @param index The ledger entry index. * @return The constructed ledger entry wrapper. */ Escrow build(uint256 const& index) { return Escrow{std::make_shared(std::move(object_), index)}; } }; } // namespace xrpl::ledger_entries