From 2a530a117a9747b51ad331dff3bdcab86029ef28 Mon Sep 17 00:00:00 2001
From: matograine <tom.ngr@zaclys.net>
Date: Sun, 20 Sep 2020 12:24:01 +0200
Subject: [PATCH] [enh] #301 display pubkeys checksums while sending a
 transaction

---
 silkaj/tx.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/silkaj/tx.py b/silkaj/tx.py
index bcc5f499..e90483c7 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, pubkey_with_checksum
 
 from duniterpy.api.bma.tx import process
 from duniterpy.documents import BlockUID, Transaction
@@ -211,10 +211,11 @@ def check_transaction_values(
         pubkey = outputBackChange
         outputBackChange = check_public_key(outputBackChange, True)
         if not outputBackChange:
-            message_exit(pubkey)
+            message_exit(pubkey_with_checksum(pubkey))
     if enough_source:
         message_exit(
-            issuer_pubkey + " pubkey doesn’t have enough money for this transaction."
+            pubkey_with_checksum(issuer_pubkey)
+            + " pubkey doesn’t have enough money for this transaction."
         )
     return outputBackChange
 
@@ -351,7 +352,7 @@ async def generate_and_send_transaction(
         print("Generate Change Transaction")
     else:
         print("Generate Transaction:")
-    print("   - From:    " + issuers)
+    print("   - From:    " + pubkey_with_checksum(issuers))
     for tx_amount, outputAddress in zip(tx_amounts, outputAddresses):
         display_sent_tx(outputAddress, tx_amount)
     print("   - Total:   " + str(sum(tx_amounts) / 100))
@@ -376,7 +377,12 @@ async def generate_and_send_transaction(
 
 
 def display_sent_tx(outputAddress, amount):
-    print("   - To:     ", outputAddress, "\n   - Amount: ", amount / 100)
+    print(
+        "   - To:     ",
+        pubkey_with_checksum(outputAddress),
+        "\n   - Amount: ",
+        amount / 100,
+    )
 
 
 async def generate_transaction_document(
-- 
GitLab