texts_cli.py 3.9 KB

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