1010from google .protobuf .wrappers_pb2 import (BytesValue , StringValue )
1111
1212from hiero_sdk_python .Duration import Duration
13- from hiero_sdk_python .crypto .private_key import PrivateKey
1413from hiero_sdk_python .hbar import Hbar
1514from hiero_sdk_python .timestamp import Timestamp
1615from hiero_sdk_python .tokens .token_id import TokenId
2322 SchedulableTransactionBody ,
2423)
2524from hiero_sdk_python .hapi .services import token_update_pb2 , transaction_pb2
25+ from hiero_sdk_python .utils .key_utils import Key , key_to_proto
2626
2727@dataclass
2828class TokenUpdateParams :
@@ -59,14 +59,14 @@ class TokenUpdateKeys:
5959 metadata_key: The new metadata key for the token.
6060 pause_key: The new pause key for the token.
6161 """
62- admin_key : Optional [PrivateKey ] = None
63- supply_key : Optional [PrivateKey ] = None
64- freeze_key : Optional [PrivateKey ] = None
65- wipe_key : Optional [PrivateKey ] = None
66- metadata_key : Optional [PrivateKey ] = None
67- pause_key : Optional [PrivateKey ] = None
68- kyc_key : Optional [PrivateKey ] = None
69- fee_schedule_key : Optional [PrivateKey ] = None
62+ admin_key : Optional [Key ] = None
63+ supply_key : Optional [Key ] = None
64+ freeze_key : Optional [Key ] = None
65+ wipe_key : Optional [Key ] = None
66+ metadata_key : Optional [Key ] = None
67+ pause_key : Optional [Key ] = None
68+ kyc_key : Optional [Key ] = None
69+ fee_schedule_key : Optional [Key ] = None
7070
7171
7272class TokenUpdateTransaction (Transaction ):
@@ -124,14 +124,14 @@ def __init__(
124124
125125 # Initialize keys attributes
126126 keys : TokenUpdateKeys = token_keys or TokenUpdateKeys ()
127- self .admin_key : Optional [PrivateKey ] = keys .admin_key
128- self .freeze_key : Optional [PrivateKey ] = keys .freeze_key
129- self .wipe_key : Optional [PrivateKey ] = keys .wipe_key
130- self .supply_key : Optional [PrivateKey ] = keys .supply_key
131- self .pause_key : Optional [PrivateKey ] = keys .pause_key
132- self .metadata_key : Optional [PrivateKey ] = keys .metadata_key
133- self .kyc_key : Optional [PrivateKey ] = keys .kyc_key
134- self .fee_schedule_key : Optional [PrivateKey ] = keys .fee_schedule_key
127+ self .admin_key : Optional [Key ] = keys .admin_key
128+ self .freeze_key : Optional [Key ] = keys .freeze_key
129+ self .wipe_key : Optional [Key ] = keys .wipe_key
130+ self .supply_key : Optional [Key ] = keys .supply_key
131+ self .pause_key : Optional [Key ] = keys .pause_key
132+ self .metadata_key : Optional [Key ] = keys .metadata_key
133+ self .kyc_key : Optional [Key ] = keys .kyc_key
134+ self .fee_schedule_key : Optional [Key ] = keys .fee_schedule_key
135135
136136 self .token_key_verification_mode : TokenKeyValidation = token_key_verification_mode
137137
@@ -284,13 +284,13 @@ def set_expiration_time(self, expiration_time: Timestamp) -> "TokenUpdateTransac
284284
285285 def set_admin_key (
286286 self ,
287- admin_key : PrivateKey
287+ admin_key : Key
288288 ) -> "TokenUpdateTransaction" :
289289 """
290290 Sets the new admin key for the token.
291291
292292 Args:
293- admin_key (PrivateKey ): The new admin key to set.
293+ admin_key (Key ): The new admin key to set (PrivateKey or PublicKey) .
294294
295295 Returns:
296296 TokenUpdateTransaction: This transaction instance.
@@ -301,13 +301,13 @@ def set_admin_key(
301301
302302 def set_freeze_key (
303303 self ,
304- freeze_key : PrivateKey
304+ freeze_key : Key
305305 ) -> "TokenUpdateTransaction" :
306306 """
307307 Sets the new freeze key for the token.
308308
309309 Args:
310- freeze_key (PrivateKey ): The new freeze key to set.
310+ freeze_key (Key ): The new freeze key to set (PrivateKey or PublicKey) .
311311
312312 Returns:
313313 TokenUpdateTransaction: This transaction instance.
@@ -318,13 +318,13 @@ def set_freeze_key(
318318
319319 def set_wipe_key (
320320 self ,
321- wipe_key : PrivateKey
321+ wipe_key : Key
322322 ) -> "TokenUpdateTransaction" :
323323 """
324324 Sets the new wipe key for the token.
325325
326326 Args:
327- wipe_key (PrivateKey ): The new wipe key to set.
327+ wipe_key (Key ): The new wipe key to set (PrivateKey or PublicKey) .
328328
329329 Returns:
330330 TokenUpdateTransaction: This transaction instance.
@@ -335,13 +335,13 @@ def set_wipe_key(
335335
336336 def set_supply_key (
337337 self ,
338- supply_key : PrivateKey
338+ supply_key : Key
339339 ) -> "TokenUpdateTransaction" :
340340 """
341341 Sets the new supply key for the token.
342342
343343 Args:
344- supply_key (PrivateKey ): The new supply key to set.
344+ supply_key (Key ): The new supply key to set (PrivateKey or PublicKey) .
345345
346346 Returns:
347347 TokenUpdateTransaction: This transaction instance.
@@ -352,13 +352,13 @@ def set_supply_key(
352352
353353 def set_pause_key (
354354 self ,
355- pause_key : PrivateKey
355+ pause_key : Key
356356 ) -> "TokenUpdateTransaction" :
357357 """
358358 Sets the new pause key for the token.
359359
360360 Args:
361- pause_key (PrivateKey ): The new pause key to set.
361+ pause_key (Key ): The new pause key to set (PrivateKey or PublicKey) .
362362
363363 Returns:
364364 TokenUpdateTransaction: This transaction instance.
@@ -369,13 +369,13 @@ def set_pause_key(
369369
370370 def set_metadata_key (
371371 self ,
372- metadata_key : PrivateKey
372+ metadata_key : Key
373373 ) -> "TokenUpdateTransaction" :
374374 """
375375 Sets the new metadata key for the token.
376376
377377 Args:
378- metadata_key (PrivateKey ): The new metadata key to set.
378+ metadata_key (Key ): The new metadata key to set (PrivateKey or PublicKey) .
379379
380380 Returns:
381381 TokenUpdateTransaction: This transaction instance.
@@ -384,12 +384,12 @@ def set_metadata_key(
384384 self .metadata_key = metadata_key
385385 return self
386386
387- def set_kyc_key (self , kyc_key : PrivateKey ) -> "TokenUpdateTransaction" :
387+ def set_kyc_key (self , kyc_key : Key ) -> "TokenUpdateTransaction" :
388388 """
389389 Sets the kyc key for the token
390390
391391 Args:
392- kyc_key (Private Key): The new kyc_key to set.
392+ kyc_key (Key): The new kyc_key to set (PrivateKey or PublicKey) .
393393
394394 Returns:
395395 TokenUpdateTransaction: This transaction instance.
@@ -398,12 +398,12 @@ def set_kyc_key(self, kyc_key: PrivateKey) -> "TokenUpdateTransaction":
398398 self .kyc_key = kyc_key
399399 return self
400400
401- def set_fee_schedule_key (self , fee_schedule_key : PrivateKey ) -> "TokenUpdateTransaction" :
401+ def set_fee_schedule_key (self , fee_schedule_key : Key ) -> "TokenUpdateTransaction" :
402402 """
403403 Sets the fee schedule key for the token
404404
405405 Args:
406- fee_schedule_key (Private Key): The new fee_schedule_key to set.
406+ fee_schedule_key (Key): The new fee_schedule_key to set (PrivateKey or PublicKey) .
407407
408408 Returns:
409409 TokenUpdateTransaction: This transaction instance.
@@ -507,18 +507,18 @@ def _set_keys_to_proto(
507507 Sets the keys to the protobuf transaction body.
508508 """
509509 if self .admin_key :
510- token_update_body .adminKey .CopyFrom (self .admin_key . public_key (). _to_proto ( ))
510+ token_update_body .adminKey .CopyFrom (key_to_proto ( self .admin_key ))
511511 if self .freeze_key :
512- token_update_body .freezeKey .CopyFrom (self .freeze_key . public_key (). _to_proto ( ))
512+ token_update_body .freezeKey .CopyFrom (key_to_proto ( self .freeze_key ))
513513 if self .wipe_key :
514- token_update_body .wipeKey .CopyFrom (self .wipe_key . public_key (). _to_proto ( ))
514+ token_update_body .wipeKey .CopyFrom (key_to_proto ( self .wipe_key ))
515515 if self .supply_key :
516- token_update_body .supplyKey .CopyFrom (self .supply_key . public_key (). _to_proto ( ))
516+ token_update_body .supplyKey .CopyFrom (key_to_proto ( self .supply_key ))
517517 if self .metadata_key :
518- token_update_body .metadata_key .CopyFrom (self .metadata_key . public_key (). _to_proto ( ))
518+ token_update_body .metadata_key .CopyFrom (key_to_proto ( self .metadata_key ))
519519 if self .pause_key :
520- token_update_body .pause_key .CopyFrom (self .pause_key . public_key (). _to_proto ( ))
520+ token_update_body .pause_key .CopyFrom (key_to_proto ( self .pause_key ))
521521 if self .kyc_key :
522- token_update_body .kycKey .CopyFrom (self .kyc_key . public_key (). _to_proto ( ))
522+ token_update_body .kycKey .CopyFrom (key_to_proto ( self .kyc_key ))
523523 if self .fee_schedule_key :
524- token_update_body .fee_schedule_key .CopyFrom (self .fee_schedule_key . public_key (). _to_proto ( ))
524+ token_update_body .fee_schedule_key .CopyFrom (key_to_proto ( self .fee_schedule_key ))
0 commit comments