Use the converter for address from the python client library
import random
from exonum_client import ModuleManager, ExonumClient, MessageGenerator
-from exonum_client.crypto import Hash
class ExonumCryptoAdvancedClient:
@@ -81,22 +80,12 @@ class ExonumCryptoAdvancedClient:
transfer = self.cryptocurrency_module.Transfer()
transfer.amount = amount
transfer.seed = gen_seed()
- transfer.to.CopyFrom(self._convert_to_caller_address(to_wallet))
+ hash_address = self.msg_generator.pk_to_hash_address(to_wallet)
+ transfer.to.CopyFrom(self.types_module.Hash(data=hash_address.value))
transfer_tx = self.msg_generator.create_message(transfer)
transfer_tx.sign(from_wallet)
return self.client.public_api.send_transaction(transfer_tx)
- # TODO Move this implementation to python client ECR-4136
- def _convert_to_caller_address(self, wallet):
- caller = self.runtime_module.Caller()
- caller.transaction_author.CopyFrom(
- self.types_module.PublicKey(data=wallet.value)
- )
- address = self.types_module.Hash(
- data=Hash.hash_data(caller.SerializeToString()).value
- )
- return address
-
def gen_seed():
"""Method to generate seed"""
