serinko 4 лет назад
Родитель
Сommit
75077baabc
2 измененных файлов с 24 добавлено и 24 удалено
  1. 5 2
      texts_cli.py
  2. 19 22
      whallets_cli.py

+ 5 - 2
texts_cli.py

@@ -70,11 +70,14 @@ def _prompt_new_info(item):
 
 def _ask_more_wallets():
     """ask user if an account has more wallet addresses"""
-    msg = \
+    msg_0 = \
         "\nDo you want to add another wallet to this username?" \
         "\n1 - YES (add more wallets)\n2 - NO (continue)\n"
+    msg_1 = "\nEnter another wallet address:\n"
+
+    return msg_0, msg_1
+
 
-    return msg
 
 def _prompt_twitter():
     """Ask or the wallet address"""

+ 19 - 22
whallets_cli.py

@@ -62,10 +62,8 @@ def _new_choice():
 
 def add_wallet():
     """A function to add wallet to the wallets_dict.json"""
-    ntw_i, name, addr, inf, twtr, ens = _get_inputs()
-    wlt = check_wallet(ntw_i, name, addr, twtr, ens, inf)
-    ntw_i, name, addr, twtr, ens, inf = \
-        wlt[0], wlt[1], wlt[2], wlt[3], wlt[4], wlt[5]
+    new_wallet = get_inputs()
+    
     print(tabulate(tc._save_wallet_confirm(ntw_i, name, addr, twtr, ens, inf)))
 
 
@@ -74,36 +72,35 @@ def remove_wallet():
     """Removes wallet from the wallet dictionary"""
     # This function needs to be developped
 
-def _get_inputs():
+def get_inputs():
     """Get infor to add a new wallet"""
     ntw_i = _check_network()
-    items_dict = {
+    network = tc._return_network(ntw_i)
+    new_wallet = {
+            "Network": network,
             "username":" ",
             "twitter address":" ",
             "ENS":" ",
             "info/note":" ",
             "address": []
     }
-    wallet = []
-    adresses = []
 
-    for item, value in items_dict:
+    addresses = []
+
+    for item, value in new_wallet.items():
         x = input(tc._prompt_info(item))
         new_item = check_wallet_item(ntw_i,x)
         if item == 'address':
-            x = input(tc._ask_more_wallets())
-            if x == '1':
-                
-
-        wallet.append(item)
-
-
-    name = input(tc._prompt_name())
-    addr = input(tc._prompt_address())
-    inf = input(tc._prompt_info())
-    twtr = input(tc._prompt_twitter())
-    ens = input(tc._prompt_ens())
-    return ntw_i, name, addr, inf, twtr, ens
+            addresses.append(new_item)
+            y = input(tc._ask_more_wallets()[0])
+            while y == '1':
+                new_item = input(tc._ask_more_wallets()[1])
+                addresses.append(new_item)
+                y = input(tc._ask_more_wallets()[0])
+            new_wallet[item] = addresses
+        new_wallet[item] = new_item
+
+    return new_wallet
 
 def _check_network():
     """Check if the existing network"""