hiero-ledger / hiero-ledger/hiero-sdk-python
Add global `set_max_transaction_fee()` to Client
- Dominant language
- Python
- Stars
- 63
- Forks
- 298
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 38
Description
**Description**
The Python SDK currently requires setting the `max_transaction_fee` on each Transaction instance individually. This differs from other SDKs such as the JavaScript and Java SDKs, which allow configuring a default maximum transaction fee at the client level.
Introduce a global default max transaction fee at the `Client` level, while still allowing per-transaction overrides.
**Proposed Solution:**
- [ ] Introduce new filed `default_max_transaction_fee` in `client.py` default value as `None`
- [ ] Add a setter method to in Client `set_max_transaction_fee()`
- [ ] Update `_default_transaction_fee` to be `2Hbar` in the `transaction.py`
- [ ] Add setter method `set_max_transaction_fee()` in transaction.py to set the value of `self.transaction_fee`
- [ ] Update `freeze_with()` in transaction.py to `resolve max_transaction_fee` value
```python
def freeze_with(self, client):
...
if self._transaction_body_bytes:
return self
if self.transaction_id is None:
self.transaction_id = client.generate_transaction_id()
# Resolve max_transaction_fee:
if self.transaction_fee is None:
self.transaction_fee = (
self.client.default_transaction_fee if self.client.default_max_transaction_fee is not None
else self._default_transaction_fee
)
...
```
This change is non-breaking and only enhances configuration flexibility. Existing behavior remains unchanged.
Contributor guide
Assessment
This issue has not been assessed yet.