Skip to content

Commit 64cfe32

Browse files
mathew1046Copilot
andauthored
docs: Add module docstring to examples/account/account_allowance_approve_transaction_hbar.py (#1218)
Signed-off-by: Mathew Joseph <[email protected]> Signed-off-by: Mathew Joseph <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent fbeb1a0 commit 64cfe32

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
99

1010

1111
### Added
12+
- Added a module-level docstring to the HBAR allowance approval example to clarify
13+
delegated spending behavior and key concepts. [#1202](https://github.com/hiero-ledger/hiero-sdk-python/issues/1202)
1214
- Added a GitHub Actions workflow to validate broken Markdown links in pull requests.
1315
- Added method chaining examples to the developer training guide (`docs/sdk_developers/training/coding_token_transactions.md`) (#1194)
1416
- examples/mypy.ini for stricter type checking in example scripts

examples/account/account_allowance_approve_transaction_hbar.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
"""
2-
Example demonstrating hbar allowance approval and usage.
2+
Example: Approving an HBAR allowance and transferring HBAR using it.
3+
4+
Why:
5+
This example demonstrates how to approve and consume an HBAR allowance
6+
using the Hiero Python SDK when interacting with the Hedera network.
7+
8+
Key Concepts:
9+
- Owner: The account that owns the HBAR and grants the allowance.
10+
- Spender: The account authorized to spend HBAR on behalf of the Owner.
11+
- Receiver: The account that receives the transferred HBAR.
12+
- HBAR Allowance: Permission granted by the Owner allowing the Spender to
13+
transfer a specified amount of HBAR without taking custody of the funds.
14+
15+
High-Level Steps:
16+
Prerequisites:
17+
1. Initialize a client with an existing operator account as the Owner.
18+
19+
Required:
20+
2. Create Spender and Receiver accounts.
21+
3. Approve an HBAR allowance from the Owner to the Spender.
22+
4. Submit a transfer transaction that consumes the allowance, moving
23+
HBAR from the Owner to the Receiver.
24+
25+
Notes:
26+
The transfer transaction is generated, signed, and paid for by the Spender,
27+
not the Owner. This reflects the delegated spending model described in the
28+
Hedera allowance documentation. This example focuses solely on HBAR
29+
allowances and does not demonstrate revoking allowances or token/NFT usage.
330
"""
431

32+
533
import os
634
import sys
735

0 commit comments

Comments
 (0)