Commit 21ef948f authored by Moul's avatar Moul
Browse files

[enh] #7: Use async for get_uid_from_pubkey()

parent 4274ae9f
......@@ -42,7 +42,7 @@ async def send_certification(cli_args):
# Check whether current user is member
issuer_pubkey = get_publickey_from_seed(seed)
issuer_id = get_uid_from_pubkey(issuer_pubkey)
issuer_id = await get_uid_from_pubkey(issuer_pubkey)
if not await is_member(issuer_pubkey, issuer_id):
message_exit("Current identity is not member.")
......
......@@ -264,7 +264,7 @@ def list_blocks(nbr, last):
j += 1
for pubkey in issuers_dict.keys():
issuer = issuers_dict[pubkey]
uid = get_uid_from_pubkey(issuer["pubkey"])
uid = await get_uid_from_pubkey(issuer["pubkey"])
for issuer2 in list_issuers:
if (
issuer2.get("pubkey") is not None
......
......@@ -57,7 +57,7 @@ async def send_transaction(cli_args):
or cli_args.contains_switches("y")
or input(
tabulate(
transaction_confirmation(
await transaction_confirmation(
issuer_pubkey, pubkey_amount[0], tx_amount, outputAddresses, comment
),
tablefmt="fancy_grid",
......@@ -126,7 +126,7 @@ def check_transaction_values(
)
def transaction_confirmation(
async def transaction_confirmation(
issuer_pubkey, pubkey_amount, tx_amount, outputAddresses, comment
):
"""
......@@ -159,12 +159,12 @@ def transaction_confirmation(
]
)
tx.append(["from (pubkey)", issuer_pubkey])
id_from = get_uid_from_pubkey(issuer_pubkey)
id_from = await get_uid_from_pubkey(issuer_pubkey)
if id_from is not NO_MATCHING_ID:
tx.append(["from (id)", id_from])
for outputAddress in outputAddresses:
tx.append(["to (pubkey)", outputAddress])
id_to = get_uid_from_pubkey(outputAddress)
id_to = await get_uid_from_pubkey(outputAddress)
if id_to is not NO_MATCHING_ID:
tx.append(["to (id)", id_to])
tx.append(["comment", comment])
......
......@@ -149,7 +149,7 @@ async def id_pubkey_correspondence(id_pubkey):
if check_public_key(id_pubkey, False):
print(
"{} public key corresponds to identity: {}".format(
id_pubkey, get_uid_from_pubkey(id_pubkey)
id_pubkey, await get_uid_from_pubkey(id_pubkey)
)
)
else:
......@@ -183,7 +183,7 @@ async def get_informations_for_identity(id):
message_exit(NO_MATCHING_ID)
def get_uid_from_pubkey(pubkey):
async def get_uid_from_pubkey(pubkey):
try:
client = ClientInstance().client
results = await client(wot.lookup, pubkey)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment