texts_cli.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. """A module with all the display info for whallets-cli."""
  2. from tabulate import tabulate
  3. def _welcome_message():
  4. """welcoming message to the cli"""
  5. msg = \
  6. "\n=========================================\n"\
  7. "WELCOME TO WHALLETS CLI"\
  8. "\n========================================="
  9. return msg
  10. def _main_menu():
  11. """Displays the CLI main menu"""
  12. line_0 = ("**","Chose an operation from the menu:")
  13. line = ("---","---------------------------------",)
  14. line_1 = ("1 -","Add a wallet to the your list")
  15. line_2 = ("2 -","Remove a wallet from your list")
  16. line_3 = ("3 -","Display your wallet list")
  17. line_4 = ("4 -","Display recent whale TXs on your EVM list")
  18. line_5 = ("5 -","Display recent whale TXs on your SPL list")
  19. line_q = ("q -","Quit!")
  20. table = [
  21. line_0,
  22. line,
  23. line_1,
  24. line_2,
  25. line_3,
  26. line_4,
  27. line_5,
  28. line_q
  29. ]
  30. return table
  31. def _menu_choice():
  32. """Sentence asking user for the next step"""
  33. msg = "\nEnter number and press Enter: "
  34. return msg
  35. def _missing_operation():
  36. """Inform about non-existing users choice"""
  37. msg = "Sorry, but you had either choosen an unexisting option, "\
  38. "or this operation has not been developped yet."
  39. return msg
  40. def _ask_new_choice():
  41. """Message offering a new choice or quit"""
  42. msg = \
  43. "\n\n=========================================\n"\
  44. "Do you have another choice?\n1 - YES\n2 - NO (quit)\n"
  45. return msg
  46. def _choose_network():
  47. """Gives a choice of networks to work with"""
  48. line_0 = ("**","Please chose the network for the wallet address:")
  49. line = ("---", "---------------------------------",)
  50. line_1 = ("1 -","EVM; Etherum main net and any forks (BSC, Poly..)")
  51. line_2 = ("2 -","SPL; Solana Program Platform")
  52. line_3 = ("3 -","BTC; Bitcoin")
  53. table = [ line_0, line, line_1, line_2, line_3]
  54. return table
  55. def _prompt_new_info(item):
  56. """Ask or the wallet address"""
  57. msg = f"\nEnter the wallet {item}:\n(if unknown press Enter)\n"
  58. return msg
  59. def _ask_more_wallets():
  60. """ask user if an account has more wallet addresses"""
  61. msg_0 = \
  62. "\nDo you want to add another wallet to this username?" \
  63. "\n1 - YES (add more wallets)\n2 - NO (continue)\n"
  64. msg_1 = "\nEnter another wallet address:\n"
  65. return msg_0, msg_1
  66. def _prompt_twitter():
  67. """Ask or the wallet address"""
  68. msg = "\nEnter the twitter link (full address):\n"
  69. return msg
  70. def _prompt_info():
  71. """Ask or the wallet address"""
  72. msg = "\nEnter short info about the user:\n"
  73. return msg
  74. def _prompt_name():
  75. """Ask or the wallet address"""
  76. msg = "\nEnter user/wallet name/tag:\n"
  77. return msg
  78. def _prompt_ens():
  79. """Ask or the wallet address"""
  80. msg = "\nEnter user's ENS:\n"
  81. return msg
  82. def _display_wallet_check_result(z):
  83. """displays answer based on added data"""
  84. msg_0 = \
  85. f"\nThis {z} already exists in your wallet dictionary."\
  86. f"\nDo you want to continue?\n1 - YES (keep it duplicate)"\
  87. f"\n2 - NO (change the item)"\
  88. f"{_menu_choice()}"
  89. msg_1 = \
  90. f"This is your the wallet info:\n(Press Enter to save, 'q' to cancell)"
  91. return (msg_0, msg_1)
  92. def _enter_new_info(y):
  93. """Asks user for a correct information"""
  94. msg = f"\nPlease write a correct {y}:\n\n"
  95. return msg
  96. def _save_wallet_confirm(addresses, new_wallet):
  97. """print wallet and ask user if to save it"""
  98. network = new_wallet["Network"]
  99. username = new_wallet["username"]
  100. twtr = new_wallet["twitter address"]
  101. ens = new_wallet["ENS"]
  102. info = new_wallet["info/note"]
  103. # addr = list(addresses)
  104. line_0 = ("****","This wallet will be saved to your dictionary:")
  105. line = ("-----","----------------------------------------------")
  106. line_1 = (f"Network:",f"{network}")
  107. line_2 = (f"Name:",f"{username}")
  108. line_3 = (f"Twitter:",f"{twtr}")
  109. line_4 = (f"ENS:",f"{ens}")
  110. line_5 = (f"Info:", f"{info}")
  111. table = [
  112. line_0,
  113. line,
  114. line_1,
  115. line_2,
  116. line_3,
  117. line_4,
  118. line_5,
  119. ]
  120. for i, address in enumerate(addresses):
  121. line = (f"Address_{i}:", f"{address}")
  122. table.append(line)
  123. return table
  124. def _confirm_entry():
  125. """Asks user to confirm the wallet saving or repeat"""
  126. msg_0 = \
  127. "\nDo you want to save the wallet to the database?"\
  128. "\n1 - YES\n2 - NO\n"
  129. msg_1 = "\nThe wallet was saved to your database."
  130. msg_2 = \
  131. "\nDo you want to add another wallet?"\
  132. "\n1 - YES\n2 - NO\n"
  133. return msg_0, msg_1, msg_2
  134. # def _display_wallets(chain, user):
  135. # """Text template for table of wallet display function"""
  136. # line_0 = ("*****",f"{chain.upper} WALLETS")
  137. # line = ("=====================================================",)
  138. # line_1 = ("Username:",f"{user}")
  139. def _return_network(ntw_i):
  140. """Return network based on index"""
  141. if ntw_i == 0:
  142. ntw = "Cosmoss/EVM (ETH and forks)"
  143. elif ntw_i == 1:
  144. ntw = "Solana Program Library"
  145. elif ntw_i == 2:
  146. ntw = "Bitcoin"
  147. else:
  148. ntw = None
  149. return ntw