diff --git a/silkaj/tui.py b/silkaj/tui.py index 955a223234ab1b38c774da37061bd20902e67f59..a76d094085511fe0e824df36daecf9897ecd6f5e 100644 --- a/silkaj/tui.py +++ b/silkaj/tui.py @@ -43,7 +43,7 @@ async def display_pubkey(tx, message, pubkey): """ Displays a pubkey and the eventually associated id. """ - tx.append([message + " (pubkey)", pubkey]) + tx.append([message + " (pubkey:checksum)", display_pubkey_and_checksum(pubkey)]) id = await wot.is_member(pubkey) if id: tx.append([message + " (id)", id["uid"]]) diff --git a/silkaj/tx.py b/silkaj/tx.py index b482cd278c09a2d6ab8c50eae6e0f34057a0eafa..03779a6020ec7d63e859c5bd07f047d1697646dc 100644 --- a/silkaj/tx.py +++ b/silkaj/tx.py @@ -34,7 +34,7 @@ from silkaj.constants import ( CENT_MULT_TO_UNIT, ASYNC_SLEEP, ) -from silkaj.tui import display_amount, display_pubkey +from silkaj.tui import display_amount, display_pubkey, display_pubkey_and_checksum from duniterpy.api.bma.tx import process from duniterpy.documents import BlockUID, Transaction @@ -211,7 +211,8 @@ def check_transaction_values( outputBackChange = validate_checksum(outputBackChange) if enough_source: message_exit( - issuer_pubkey + " pubkey doesn’t have enough money for this transaction." + display_pubkey_and_checksum(issuer_pubkey) + + " pubkey doesn’t have enough money for this transaction." ) return outputBackChange @@ -348,7 +349,7 @@ async def generate_and_send_transaction( print("Generate Change Transaction") else: print("Generate Transaction:") - print(" - From: " + issuers) + print(" - From: " + display_pubkey_and_checksum(issuers)) for tx_amount, outputAddress in zip(tx_amounts, outputAddresses): display_sent_tx(outputAddress, tx_amount) print(" - Total: " + str(sum(tx_amounts) / 100)) @@ -373,7 +374,12 @@ async def generate_and_send_transaction( def display_sent_tx(outputAddress, amount): - print(" - To: ", outputAddress, "\n - Amount: ", amount / 100) + print( + " - To: ", + display_pubkey_and_checksum(outputAddress), + "\n - Amount: ", + amount / 100, + ) async def generate_transaction_document( diff --git a/tests/test_tui.py b/tests/test_tui.py index b66b825553e7e89a9f68dd6cc438220e11717d7a..dfabcc28baf377b2489b1b24b4bb349c229b7874 100644 --- a/tests/test_tui.py +++ b/tests/test_tui.py @@ -25,7 +25,7 @@ import patched @pytest.mark.parametrize( "message, amount, currency_symbol", [("Total", 1000, G1_SYMBOL)] ) -def test_display_amount(message, amount, currency_symbol, monkeypatch): +def test_display_amount(message, amount, currency_symbol): ud_value = patched.mock_ud_value amount_UD = round(amount / ud_value, 2) expected = [ @@ -57,7 +57,7 @@ def test_display_amount(message, amount, currency_symbol, monkeypatch): async def test_display_pubkey(message, pubkey, id, monkeypatch): monkeypatch.setattr("silkaj.wot.is_member", patched.is_member) - expected = [[message + " (pubkey)", pubkey]] + expected = [[message + " (pubkey:checksum)", display_pubkey_and_checksum(pubkey)]] if id: expected.append([message + " (id)", id]) tx = list()