Skip to content

Commit 2da71be

Browse files
authored
docs: add TokenType docstring (hiero-ledger#1402)
Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
1 parent 61eda4f commit 2da71be

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

CHANGELOG.md

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

99
### Added
10+
- Added comprehensive docstring to `FeeAssessmentMethod` enum explaining inclusive vs exclusive fee assessment methods with usage examples. (#1391)
11+
- Added comprehensive docstring to `TokenType` enum explaining fungible vs non-fungible tokens with practical use cases. (#1392)
1012

1113
- Added a notification workflow that alerts the support team when an issue is labeled as a Good First Issue Candidate.[(#1296)]
1214
- Added comprehensive training documentation for the `Query` class, covering execution flow, payments, retries, and building child queries. (#1238)

src/hiero_sdk_python/tokens/fee_assessment_method.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,31 @@
22

33
class FeeAssessmentMethod(Enum):
44
"""
5-
Represents the fee assessment method for custom fees.
5+
Fee assessment method for custom token fees.
6+
7+
Determines whether custom fees are deducted from the transferred amount
8+
or charged separately from the payer's account.
9+
10+
Attributes:
11+
INCLUSIVE: Fee is deducted from the transferred amount.
12+
The recipient receives the transferred amount minus the fee.
13+
Used when the fee should be included in the transfer amount.
14+
15+
EXCLUSIVE: Fee is charged in addition to the transferred amount.
16+
The recipient receives the full transferred amount, and the payer
17+
pays the fee on top of that. Used when the fee should be
18+
charged separately from the transfer.
19+
20+
Example:
21+
>>> # Using inclusive fee assessment
22+
>>> assessment = FeeAssessmentMethod.INCLUSIVE
23+
>>> print(f"Fee type: {assessment}")
24+
Fee type: FeeAssessmentMethod.INCLUSIVE
25+
26+
>>> # Using exclusive fee assessment
27+
>>> assessment = FeeAssessmentMethod.EXCLUSIVE
28+
>>> print(f"Fee type: {assessment}")
29+
Fee type: FeeAssessmentMethod.EXCLUSIVE
630
"""
731

832
INCLUSIVE = 0

src/hiero_sdk_python/tokens/token_type.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,41 @@
33
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
55
Defines TokenType enum for distinguishing between fungible common tokens
6-
and non-fungible unique tokens on the Hedera network.
6+
and non-fungible unique tokens on Hedera network.
77
"""
88

99
from enum import Enum
1010

1111
class TokenType(Enum):
12-
"""Enum for Hedera token types: FUNGIBLE_COMMON or NON_FUNGIBLE_UNIQUE."""
12+
"""
13+
Token type for Hedera tokens.
14+
15+
Determines whether a token represents divisible, interchangeable units
16+
or unique, individually identifiable assets.
17+
18+
Attributes:
19+
FUNGIBLE_COMMON: Interchangeable tokens where each unit is equal.
20+
All tokens are identical and can be divided into smaller units.
21+
Used for currencies, utility tokens, or any asset where
22+
individual tokens are indistinguishable from each other.
23+
24+
NON_FUNGIBLE_UNIQUE: Unique tokens where each unit is distinct.
25+
Each token has its own metadata and identity.
26+
Used for NFTs, collectibles, or any asset where
27+
individual tokens have unique properties and cannot be replaced
28+
by other tokens of the same type.
29+
30+
Example:
31+
>>> # Creating a fungible token (like a currency)
32+
>>> token_type = TokenType.FUNGIBLE_COMMON
33+
>>> print(f"Token type: {token_type}")
34+
Token type: TokenType.FUNGIBLE_COMMON
35+
36+
>>> # Creating a non-fungible token (like an NFT)
37+
>>> token_type = TokenType.NON_FUNGIBLE_UNIQUE
38+
>>> print(f"Token type: {token_type}")
39+
Token type: TokenType.NON_FUNGIBLE_UNIQUE
40+
"""
41+
1342
FUNGIBLE_COMMON = 0
1443
NON_FUNGIBLE_UNIQUE = 1

0 commit comments

Comments
 (0)