diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f82e3825..b9d929de2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1. ### Added +- Added method chaining examples to the developer training guide (`docs/sdk_developers/training/coding_token_transactions.md`) (#1194) - examples/mypy.ini for stricter type checking in example scripts - Added a GitHub Actions workflow that reminds contributors to link pull requests to issues. - Added `__str__` and `__repr__` methods to `AccountInfo` class for improved logging and debugging experience (#1098) diff --git a/docs/sdk_developers/training/coding_token_transactions.md b/docs/sdk_developers/training/coding_token_transactions.md index 04d602986..29f3a88f0 100644 --- a/docs/sdk_developers/training/coding_token_transactions.md +++ b/docs/sdk_developers/training/coding_token_transactions.md @@ -65,6 +65,24 @@ def set_account_id(self, account_id: AccountId) -> "TokenAssociateTransaction": ``` +This feature enables chaining. + +For example: + +### Standard Usage + +```python +tx.set_account_id(account_id) +tx.set_token_id(token_id) +tx.freeze() +tx.execute(client) +``` +or +### Method Chaining +```python +tx.set_account_id(account_id).set_token_id(token_id).freeze().execute(client) +``` + ## 4. Protobuf Conversion The Hedera network communicates via Protocol Buffers (Protobuf). Your transaction class is responsible for converting its Python fields into a Protobuf message.