texts_cli.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 = \
  62. "\nDo you want to add another wallet to this username?" \
  63. "\n1 - YES (add more wallets)\n2 - NO (continue)\n"
  64. return msg
  65. def _prompt_twitter():
  66. """Ask or the wallet address"""
  67. msg = "\nEnter the twitter link (full address):\n"
  68. return msg
  69. def _prompt_info():
  70. """Ask or the wallet address"""
  71. msg = "\nEnter short info about the user:\n"
  72. return msg
  73. def _prompt_name():
  74. """Ask or the wallet address"""
  75. msg = "\nEnter user/wallet name/tag:\n"
  76. return msg
  77. def _prompt_ens():
  78. """Ask or the wallet address"""
  79. msg = "\nEnter user's ENS:\n"
  80. return msg
  81. def _display_wallet_check_result(y):
  82. """displays answer based on added data"""
  83. msg_0 = \
  84. f"{y.title()} already exists in your wallet dictionary."\
  85. f"\nDo you want to continue?\n1 - YES (keep it duplicate)"\
  86. f"\n2 - NO (change the item)"\
  87. f"{_menu_choice()}"
  88. msg_1 = \
  89. f"This is your the wallet info:\n(Press Enter to save, 'q' to cancell)"
  90. return (msg_0, msg_1)
  91. def _enter_new_info(y):
  92. """Asks user for a correct information"""
  93. msg = f"\nPlease write a correct {y}:\n\n"
  94. return msg
  95. def _save_wallet_confirm(ntw_i, name, addr, twtr, ens, inf):
  96. """print wallet and ask user if to save it"""
  97. ntw = _return_network(ntw_i)
  98. line_0 = ("****","This wallet will be saved to your dictionary:")
  99. line = ("-----","----------------------------------------------")
  100. line_1 = (f"Network:",f"{ntw}")
  101. line_2 = (f"Name:",f"{name}")
  102. line_3 = (f"Address:",f"{addr}")
  103. line_4 = (f"Twitter:",f"{twtr}")
  104. line_5 = (f"ENS:",f"{ens}")
  105. line_6 = (f"Info:", f"{inf}")
  106. table = [
  107. line_0,
  108. line,
  109. line_1,
  110. line_2,
  111. line_3,
  112. line_4,
  113. line_5,
  114. line_6
  115. ]
  116. return table
  117. # def _display_wallets(chain, user):
  118. # """Text template for table of wallet display function"""
  119. # line_0 = ("*****",f"{chain.upper} WALLETS")
  120. # line = ("=====================================================",)
  121. # line_1 = ("Username:",f"{user}")
  122. def _return_network(ntw_i):
  123. """Return network based on index"""
  124. if ntw_i == 0:
  125. ntw = "Cosmoss/EVM (ETH and forks)"
  126. elif ntw_i == 1:
  127. ntw = "Solana Program Library"
  128. elif ntw_i == 2:
  129. ntw = "Bitcoin"
  130. else:
  131. ntw = None
  132. return ntw