Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.

### Added
- Add `__repr__` method to `TokenId` class for cleaner debugging output (#1653)
- Add global `set_default_max_transaction_fee()` to Client. ([#2000](https://github.com/hiero-ledger/hiero-sdk-python/issues/2000))

### Src
- Updated `AccountUpdateTransaction.set_key()` to accept generic `Key` objects (including `KeyList` and threshold keys), rather than strictly requiring a `PublicKey`.
Expand Down
25 changes: 25 additions & 0 deletions src/hiero_sdk_python/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def __init__(self, network: Network = None) -> None:

self.logger: Logger = Logger(LogLevel.from_env(), "hiero_sdk_python")

self.default_max_transaction_fee: Hbar = None

@classmethod
def from_env(cls, network: Optional[NetworkName] = None) -> "Client":
"""
Expand Down Expand Up @@ -455,6 +457,29 @@ def set_max_backoff(self, max_backoff: Union[int, float]) -> "Client":
self._max_backoff = float(max_backoff)
return self

def set_default_max_transaction_fee(
self, default_max_transaction_fee: Hbar
) -> "Client":
"""
Set the maximum fee allowed per transaction.

Args:
default_max_transaction_fee (Hbar): Maximum fee allowed per transaction.

Returns:
Client: This client instance for fluent chaining.
"""
if not isinstance(default_max_transaction_fee, Hbar):
raise TypeError(
f"default_max_transaction_fee must be of type Hbar, got {(type(default_max_transaction_fee).__name__)}"
)

if default_max_transaction_fee.to_tinybars() < 0:
raise ValueError("default_max_transaction_fee must be >= 0")

self.default_max_transaction_fee = default_max_transaction_fee
return self

def update_network(self) -> "Client":
"""
Refresh the network node list from the mirror node.
Expand Down
Loading
Loading