diff --git a/silkaj/tui.py b/silkaj/tui.py index 6d73eb089624d3d5078f4ad34c9a88fc2ff1467d..2b09d00f7261902c4598d22b87253b86863f99a6 100644 --- a/silkaj/tui.py +++ b/silkaj/tui.py @@ -15,11 +15,12 @@ You should have received a copy of the GNU Affero General Public License along with Silkaj. If not, see <https://www.gnu.org/licenses/>. """ +import sys +import click from datetime import datetime -from silkaj import wot +from silkaj import wot, network_tools, constants from silkaj import crypto_tools as ct -from silkaj.constants import SHORT_PUBKEY_SIZE def display_amount(tx, message, amount, ud_value, currency_symbol): @@ -49,7 +50,9 @@ async def display_pubkey(tx, message, pubkey): tx.append([message + " (id)", id["uid"]]) -def display_pubkey_and_checksum(pubkey, short=False, length=SHORT_PUBKEY_SIZE): +def display_pubkey_and_checksum( + pubkey, short=False, length=constants.SHORT_PUBKEY_SIZE +): """ Returns "<pubkey>:<checksum>" in full form. returns `length` first chars of pubkey and checksum in short form. @@ -59,6 +62,13 @@ def display_pubkey_and_checksum(pubkey, short=False, length=SHORT_PUBKEY_SIZE): return short_pubkey + ":" + ct.gen_checksum(pubkey) +async def send_doc_confirmation(document_name): + if not click.confirm(f"Do you confirm sending this {document_name}?"): + client = network_tools.ClientInstance().client + await client.close() + sys.exit(constants.SUCCESS_EXIT_STATUS) + + def convert_time(timestamp, kind): ts = int(timestamp) date = "%Y-%m-%d"