Skip to content

Commit 43fb57f

Browse files
authored
chore: modularized script of examples/custom_fee.py (#666)
Signed-off-by: nikhil-nari <nikhilgreyshines@gmail.com>
1 parent 9fe0bcc commit 43fb57f

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2020
- chore: Update env.example NETWORK to encourage testnet or local usage (#659)
2121
- chore: fix type hint for TokenCancelAirdropTransaction pending_airdrops parameter
2222
- chore: Moved documentation file `common_issues.md` from `examples/sdk_developers/` to `docs/sdk_developers/` for unified documentation management (#516).
23+
- chore: Refactored the script of examples/custom_fee.py into modular functions
2324

2425
### Fixed
2526

examples/custom_fee.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
from hiero_sdk_python.account.account_id import AccountId
1111
from hiero_sdk_python.tokens.token_id import TokenId
1212

13-
def main():
14-
# Create a CustomFixedFee
13+
14+
15+
def custom_fixed_fee():
1516
fixed_fee = CustomFixedFee(
1617
amount=100,
1718
denominating_token_id=TokenId(0, 0, 123),
@@ -23,13 +24,12 @@ def main():
2324
print(f"Denominating Token ID: {fixed_fee.denominating_token_id}")
2425
print(f"Fee Collector Account ID: {fixed_fee.fee_collector_account_id}")
2526
print(f"All Collectors Exempt: {fixed_fee.all_collectors_are_exempt}")
26-
2727
# Convert to protobuf
2828
fixed_fee_proto = fixed_fee._to_proto()
2929

3030
print("Fixed Fee Protobuf:", fixed_fee_proto)
3131

32-
# Create a CustomFractionalFee
32+
def custom_fractional_fee() :
3333
fractional_fee = CustomFractionalFee(
3434
numerator=1,
3535
denominator=10,
@@ -53,7 +53,7 @@ def main():
5353

5454
print("Fractional Fee Protobuf:", fractional_fee_proto)
5555

56-
# Create a CustomRoyaltyFee
56+
def custom_royalty_fee():
5757
fallback_fee = CustomFixedFee(
5858
amount=50,
5959
denominating_token_id=TokenId(0, 0, 789),
@@ -78,5 +78,17 @@ def main():
7878

7979
print("Royalty Fee Protobuf:", royalty_fee_proto)
8080

81+
def custom_fee():
82+
#create a CustomFixedFee
83+
custom_fixed_fee()
84+
#create a CustomFractionalFee
85+
custom_fractional_fee()
86+
#create a CustomRoyaltyFee
87+
custom_royalty_fee()
88+
89+
def main():
90+
#setup a Client
91+
custom_fee()
92+
8193
if __name__ == "__main__":
8294
main()

0 commit comments

Comments
 (0)