[#246] Get pubkey

Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
Elizaveta Chichindaeva 2022-07-22 10:04:26 +03:00
parent a5764da57b
commit da9b723498
4 changed files with 23 additions and 11 deletions

View file

@ -1,3 +1,6 @@
import json
from neo3 import wallet
def dict_to_attrs(attrs: dict) -> str:
"""
@ -11,3 +14,13 @@ def dict_to_attrs(attrs: dict) -> str:
(str): string in "a=b,c=d" format.
"""
return ",".join(f"{key}={value}" for key, value in attrs.items())
def pub_key_hex(wallet_path: str, wallet_password=""):
wallet_content = ''
with open(wallet_path) as out:
wallet_content = json.load(out)
wallet_from_json = wallet.Wallet.from_json(wallet_content, password=wallet_password)
pub_key_64 = str(wallet_from_json.accounts[0].public_key)
return pub_key_64