Skip to content

Commit a9a4fed

Browse files
committed
fix: address remaining CodeRabbit comments — file_create key types, nullable fields, misleading comment
Signed-off-by: Mounil Kanakhara <mounilkankhara@gmail.com>
1 parent ebd98c8 commit a9a4fed

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/hiero_sdk_python/file/file_create_transaction.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import time
44

55
from hiero_sdk_python.channels import _Channel
6+
from hiero_sdk_python.crypto.key import Key
67
from hiero_sdk_python.crypto.public_key import PublicKey
78
from hiero_sdk_python.executable import _Method
89
from hiero_sdk_python.hapi.services import file_create_pb2
@@ -199,10 +200,10 @@ def _from_proto(self, proto: file_create_pb2.FileCreateTransactionBody) -> FileC
199200
Returns:
200201
FileCreateTransaction: This transaction instance.
201202
"""
202-
self.keys = [PublicKey._from_proto(key) for key in proto.keys.keys] if proto.keys.keys else []
203-
self.contents = proto.contents
203+
self.keys = [Key.from_proto_key(key) for key in proto.keys.keys] if proto.keys.keys else []
204+
self.contents = proto.contents or None
204205
self.expiration_time = (
205206
Timestamp._from_protobuf(proto.expirationTime) if proto.HasField("expirationTime") else None
206207
)
207-
self.file_memo = proto.memo
208+
self.file_memo = proto.memo or None
208209
return self

src/hiero_sdk_python/transaction/transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __init__(self) -> None:
123123
# This allows us to maintain the signatures for each unique transaction
124124
# and ensures that the correct signatures are used when submitting transactions
125125
self._signature_map: dict[bytes, basic_types_pb2.SignatureMap] = {}
126-
# changed from int: 2_000_000 to Hbar: 0.02
126+
# changed from int: 2_000_000 to Hbar: 2
127127
self._default_transaction_fee = Hbar(2)
128128
self.operator_account_id = None
129129
self.batch_key: Key | None = None

tests/unit/file_create_transaction_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ def test_file_create_transaction_from_proto():
259259
from_proto = FileCreateTransaction()._from_proto(file_create_pb2.FileCreateTransactionBody())
260260

261261
# Verify empty protobuf deserializes to empty/default values
262-
assert from_proto.contents == b""
263-
assert from_proto.file_memo == ""
262+
assert from_proto.contents is None
263+
assert from_proto.file_memo is None
264264
assert from_proto.keys == []
265265

266266

0 commit comments

Comments
 (0)