texts_cli.py 5.5 KB

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