Skip to content

Commit 2c25745

Browse files
authored
chore: remove duplicate token info methods (#430)
Signed-off-by: Akshat Baranwal <[email protected]> Signed-off-by: Akshat Baranwal <[email protected]>
1 parent 272cc3d commit 2c25745

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
3939
- Replace Hendrik Ebbers with Sophie Bulloch in the MAINTAINERS.md file
4040
- Improved `CONTRIBUTING.md` by explaining the /docs folder structure and fixing broken hyperlinks.(#431)
4141

42+
4243
### Fixed
4344

4445
- Incompatible Types assignment in token_transfer_list.py
45-
- Corrected references to \_\_require_not_frozen() to \_require_not_frozen() and removed the surplus \_is_frozen
46+
- Corrected references to _require_not_frozen() and removed the surplus _is_frozen
47+
- Removed duplicate static methods in `TokenInfo` class:
48+
- `_copy_msg_to_proto`
49+
- `_copy_key_if_present`
50+
- `_parse_custom_fees`
51+
Kept robust versions with proper docstrings and error handling.
4652
- Add strict type hints to `TransactionGetReceiptQuery` (#420)
4753

4854
## [0.1.5] - 2025-09-25

src/hiero_sdk_python/tokens/token_info.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -246,30 +246,10 @@ def set_custom_fees(self, custom_fees: List[Any]) -> "TokenInfo":
246246
set_customFees = set_custom_fees
247247

248248
# === helpers ===
249-
@staticmethod
250-
def _copy_key_if_present(dst: "TokenInfo", setter: str, key_msg) -> None:
251-
# In proto3, keys are a oneof; check presence via WhichOneof
252-
if key_msg is not None and hasattr(key_msg, "WhichOneof") and key_msg.WhichOneof("key"):
253-
getattr(dst, setter)(PublicKey._from_proto(key_msg))
254-
255-
@staticmethod
256-
def _parse_custom_fees(proto_obj) -> List[CustomFee]:
257-
out: List[CustomFee] = []
258-
for fee_proto in getattr(proto_obj, "custom_fees", []): # snake_case matches your generated proto
259-
if fee_proto.HasField("fixed_fee"):
260-
out.append(CustomFixedFee._from_proto(fee_proto))
261-
elif fee_proto.HasField("fractional_fee"):
262-
out.append(CustomFractionalFee._from_proto(fee_proto))
263-
elif fee_proto.HasField("royalty_fee"):
264-
out.append(CustomRoyaltyFee._from_proto(fee_proto))
265-
return out
266249

267-
@staticmethod
268-
def _copy_msg_to_proto(src_obj, dst_proto, src_attr: str, dst_field: str) -> None:
269-
val = getattr(src_obj, src_attr)
270-
if val:
271-
getattr(dst_proto, dst_field).CopyFrom(val._to_proto())
250+
272251

252+
273253
@staticmethod
274254
def _get(proto_obj, *names):
275255
"""Get the first present attribute from a list of possible names (camelCase/snake_case)."""

0 commit comments

Comments
 (0)