whallets-cli.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. """CLI for users to manage the wallet database and run research functions"""
  2. #TODO:
  3. # 1) Interacting with APIs
  4. # 2) easy adding data to the wallets_dict.json
  5. # 3) Scanning through APIs based on given parameters
  6. # 4) Prints options for the user (-h)
  7. import json
  8. import texts_cli as tc
  9. def cli():
  10. """Main program for the cli"""
  11. print(tc.welcome_message())
  12. def main_menu():
  13. """main cli options"""
  14. def add_wallet():
  15. """A function to add wallet to the wallets_dict.json"""
  16. chain = input(tc._choose_chain())
  17. name = input(tc._prompt_name())
  18. address = input(tc._prompt_address())
  19. twtr = input(tc._prompt_twitter())
  20. ens = input(tc._prompt_ens())
  21. def check_wallet():
  22. """
  23. Scans through wallets to check if a new wallet is not already in the
  24. database"
  25. """
  26. def get_wallets():
  27. ''' Gets the info from the dictionary '''
  28. filename = 'wallets_dict.json'
  29. with open(filename) as f:
  30. all_wallets = json.load(f)
  31. evm_wallets = all_wallets['evm_wallets']
  32. spl_wallets = all_wallets['spl_wallets']
  33. return evm_wallets, spl_wallets
  34. def display_wallets(chain):
  35. """Displays the wallets according the given chain"""
  36. # Chains available 'evm','spl'
  37. # evm shows all the forks
  38. i = _chain_index(chain)
  39. dict = get_wallets()[i]
  40. print(f"\n\n{chain.upper()} WALLETS:")
  41. def _chain_index(chain):
  42. '''Asigns an index based on given parameter of the chain'''
  43. if chain.lower() == 'evm':
  44. i = 0
  45. elif chain.lower() == 'spl':
  46. i = 1
  47. return i
  48. def display_all_wallets():
  49. display_wallets('evm')
  50. display_wallets('spl')