-
Notifications
You must be signed in to change notification settings - Fork 96
Description
AccountTransaction currently only accepts PublicKey values for the key field, including its helper methods such as set_key, set_key_without_alias, and set_key_with_alias.
This causes inconsistent with the other SDKs which allows both PrivateKey and PublicKey.
Solution:
- Align key handling with TokenCreateTransaction, where:
Key = Union[PrivateKey, PublicKey]- Update type annotations in the constructor and field definitions:
def __init__(
self,
key: Optional[Key] = None,
...
) -> None:
self.key: Optional[Key] = key
...- Update all relevant setters:
def set_key(self, key: Key):
def set_key_without_alias(self, key: Key):
def set_key_with_alias(self, key: Key, ecdsa_key: Optional[Key]):- Add helper methods to handle proto conversion and EVM address derivation:
#eg
def _derive_evm_address(self, key: Key):
return key.to_evm_address() if isinstance(key, PublicKey) else key.public_key().to_evm_address()
def _to_proto_key(self, key: Optional[Key]) -> Optional[basic_types_pb2.Key]:
if key is None:
return None
return key.public_key()._to_proto() if isinstance(key, PrivateKey) else key._to_proto()- Update or add integration and unit tests to verify correct handling of both key types.
exploreriii
Metadata
Metadata
Assignees
Labels
No labels