Commit c85a3117 authored by Moul's avatar Moul Committed by Mael
Browse files

[enh] #69: display currencies symbols.

parent 6ebb29f6
......@@ -22,7 +22,7 @@ def currency_info(ep):
os.system("clear")
print("Connected to node:", ep[best_node(ep, 1)], ep["port"],
"\nCurrent block number:", current["number"],
"\nCurrency name:", current["currency"],
"\nCurrency name:", get_currency_symbol(current["currency"]),
"\nNumber of members:", current["membersCount"],
"\nMinimal Proof-of-Work:", current["powMin"],
"\nCurrent time:", convert_time(current["time"], "all"),
......@@ -245,23 +245,23 @@ def show_amount_from_pubkey(ep, pubkey, value):
# output
UDvalue = get_last_ud_value(ep)
current_blk = get_current_block(ep)
currency_name = str(current_blk["currency"])
currency_symbol = get_currency_symbol(current_blk["currency"])
if totalAmountInput - amount != 0:
print("Blockchain:")
print("-----------")
print("Relative =", round(amount / UDvalue, 2), "UD", currency_name)
print("Quantitative =", round(amount / 100, 2), currency_name + "\n")
print("Relative =", round(amount / UDvalue, 2), "UD", currency_symbol)
print("Quantitative =", round(amount / 100, 2), currency_symbol + "\n")
print("Pending Transaction:")
print("--------------------")
print("Relative =", round((totalAmountInput - amount) / UDvalue, 2), "UD", currency_name)
print("Quantitative =", round((totalAmountInput - amount) / 100, 2), currency_name + "\n")
print("Relative =", round((totalAmountInput - amount) / UDvalue, 2), "UD", currency_symbol)
print("Quantitative =", round((totalAmountInput - amount) / 100, 2), currency_symbol + "\n")
print("Total amount of: " + pubkey)
print("----------------------------------------------------------------")
print("Total Relative =", round(totalAmountInput / UDvalue, 2), "UD", currency_name)
print("Total Quantitative =", round(totalAmountInput / 100, 2), currency_name + "\n")
print("Total Relative =", round(totalAmountInput / UDvalue, 2), "UD", currency_symbol)
print("Total Quantitative =", round(totalAmountInput / 100, 2), currency_symbol + "\n")
def argos_info(ep):
......@@ -280,7 +280,7 @@ def argos_info(ep):
href = 'href=http://%s:%s/' % (ep[best_node(ep, 1)], ep["port"])
print("Connected to node:", ep[best_node(ep, 1)], ep["port"], "|", href,
"\nCurrent block number:", current["number"],
"\nCurrency name:", current["currency"],
"\nCurrency name:", get_currency_symbol(current["currency"]),
"\nNumber of members:", current["membersCount"],
"\nMinimal Proof-of-Work:", current["powMin"],
"\nCurrent time:", convert_time(current["time"], "all"),
......
SILKAJ_VERSION = "silkaj 0.4.0"
NO_MATCHING_ID = "No matching identity"
G1_SYMBOL = "Ğ1"
GTEST_SYMBOL = "ĞTest"
......@@ -43,6 +43,12 @@ def get_pubkeys_from_id(ep, uid):
def get_current_block(ep):
return request(ep, "blockchain/current")
def get_currency_symbol(currency):
if currency == "g1":
return G1_SYMBOL
elif currency == "g1-test":
return GTEST_SYMBOL
def sign_document_from_seed(document, seed):
seed = bytes(seed, 'utf-8')
......
......@@ -68,9 +68,9 @@ def transaction_confirmation(ep, c, issuer_pubkey, amount, ud, output, comment):
Generate transaction confirmation
"""
tx = list()
currency_name = get_current_block(ep)["currency"]
tx.append(["amount (" + currency_name + ")", amount / 100])
tx.append(["amount (UD " + currency_name + ")", amount / ud])
currency_symbol = get_currency_symbol(get_current_block(ep)["currency"])
tx.append(["amount (" + currency_symbol + ")", amount / 100])
tx.append(["amount (UD " + currency_symbol + ")", amount / ud])
tx.append(["from", issuer_pubkey])
id_from = get_uid_from_pubkey(ep, issuer_pubkey)
if id_from is not NO_MATCHING_ID:
......@@ -130,7 +130,7 @@ def generate_transaction_document(ep, issuers, AmountTransfered, listinput_and_a
totalAmountInput = listinput_and_amount[1]
current_blk = get_current_block(ep)
currency_name = str(current_blk["currency"])
currency_symbol = get_currency_symbol(current_blk["currency"])
blockstamp_current = str(current_blk["number"]) + "-" + str(current_blk["hash"])
curentUnitBase = current_blk["unitbase"]
......
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