Skip to content
15 changes: 15 additions & 0 deletions src/hiero_sdk_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
# Errors
from .exceptions import PrecheckError, ReceiptStatusError

# Fee
from .fees.fee_estimate import FeeEstimate
from .fees.fee_estimate_mode import FeeEstimateMode
from .fees.fee_estimate_response import FeeEstimateResponse
from .fees.fee_extra import FeeExtra
from .fees.network_fee import NetworkFee

# File
from .file.file_append_transaction import FileAppendTransaction
from .file.file_contents_query import FileContentsQuery
Expand Down Expand Up @@ -77,6 +84,7 @@
# Queries
from .query.account_balance_query import CryptoGetAccountBalanceQuery
from .query.account_info_query import AccountInfoQuery
from .query.fee_estimate_query import FeeEstimateQuery
from .query.token_info_query import TokenInfoQuery
from .query.token_nft_info_query import TokenNftInfoQuery
from .query.topic_info_query import TopicInfoQuery
Expand Down Expand Up @@ -227,6 +235,7 @@
"TopicDeleteTransaction",
"TopicId",
# Queries
"FeeEstimateQuery",
"TopicInfoQuery",
"TopicMessageQuery",
"TransactionGetReceiptQuery",
Expand Down Expand Up @@ -257,6 +266,12 @@
"FileContentsQuery",
"FileUpdateTransaction",
"FileDeleteTransaction",
# Fee
"FeeEstimateMode",
"FeeEstimate",
"FeeEstimateResponse",
"FeeExtra",
"NetworkFee",
# Contract
"ContractCreateTransaction",
"ContractCallQuery",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(
self.chunk_size: int = chunk_size or 1024
self.max_chunks: int = max_chunks or 20

self._current_index = 0
self._current_chunk_index = 0
self._total_chunks = self.get_required_chunks()
self._initial_transaction_id: TransactionId | None = None
self._transaction_ids: list[TransactionId] = []
Expand Down Expand Up @@ -192,7 +192,7 @@ def _build_proto_body(self) -> consensus_submit_message_pb2.ConsensusSubmitMessa

content = self.message.encode("utf-8")

start_index = self._current_index * self.chunk_size
start_index = self._current_chunk_index * self.chunk_size
end_index = min(start_index + self.chunk_size, len(content))
chunk_content = content[start_index:end_index]

Expand All @@ -206,7 +206,7 @@ def _build_proto_body(self) -> consensus_submit_message_pb2.ConsensusSubmitMessa
consensus_submit_message_pb2.ConsensusMessageChunkInfo(
initialTransactionID=self._initial_transaction_id._to_proto(),
total=self._total_chunks,
number=self._current_index + 1,
number=self._current_chunk_index + 1,
)
)

Expand Down Expand Up @@ -371,7 +371,7 @@ def execute_all(
responses = []

for chunk_index in range(self.get_required_chunks()):
self._current_index = chunk_index
self._current_chunk_index = chunk_index

if self._transaction_ids and chunk_index < len(self._transaction_ids):
self.transaction_id = self._transaction_ids[chunk_index]
Expand Down
19 changes: 19 additions & 0 deletions src/hiero_sdk_python/fees/fee_estimate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Fee estimation models for calculating base and extra fees.

This module defines the FeeEstimate dataclass, which aggregates
a base fee with optional extra fee components.
"""

from __future__ import annotations

from dataclasses import dataclass, field

from hiero_sdk_python.fees.fee_extra import FeeExtra


@dataclass(frozen=True)
class FeeEstimate:
"""Represents a fee estimate composed of a base amount and optional extras."""

base: int
extras: list[FeeExtra] = field(default_factory=list)
Comment thread
manishdait marked this conversation as resolved.
15 changes: 15 additions & 0 deletions src/hiero_sdk_python/fees/fee_estimate_mode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Enumeration of fee estimation modes.

Defines the available strategies for calculating fee estimates.
"""

from __future__ import annotations

from enum import Enum


class FeeEstimateMode(str, Enum):
"""Supported modes for fee estimation."""

STATE = "STATE"
INTRINSIC = "INTRINSIC"
25 changes: 25 additions & 0 deletions src/hiero_sdk_python/fees/fee_estimate_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Response model for fee estimation results.

Contains the calculated fees across different categories along with
the estimation mode and optional notes.
"""

from __future__ import annotations

from dataclasses import dataclass

from hiero_sdk_python.fees.fee_estimate import FeeEstimate
from hiero_sdk_python.fees.fee_estimate_mode import FeeEstimateMode
from hiero_sdk_python.fees.network_fee import NetworkFee


@dataclass(frozen=True)
class FeeEstimateResponse:
"""Represents the result of a fee estimation operation."""

mode: FeeEstimateMode
network_fee: NetworkFee | None = None
node_fee: FeeEstimate | None = None
service_fee: FeeEstimate | None = None
total: int = 0
high_volume_multiplier: int = 0
17 changes: 17 additions & 0 deletions src/hiero_sdk_python/fees/fee_extra.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations

from dataclasses import dataclass


@dataclass(frozen=True)
class FeeExtra:
"""
Represents additional fee details associated with a transaction or operation.
"""

name: str | None = None
included: int | None = None
count: int | None = None
charged: int | None = None
fee_per_unit: int | None = None
subtotal: int | None = None
9 changes: 9 additions & 0 deletions src/hiero_sdk_python/fees/network_fee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from __future__ import annotations

from dataclasses import dataclass


@dataclass(frozen=True)
class NetworkFee:
multiplier: int
subtotal: int
Loading
Loading