-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handling for MM2.json config not found error #8
Comments
This looks like an unfinished refactoring or outdated code, because diff --git a/balances.py b/balances.py
index 0b4a180..34823be 100755
--- a/balances.py
+++ b/balances.py
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
from helpers import status_print
-from models import Dex, Tables
+from models import Dex, Table
dex = Dex()
-tables = Tables()
+table = Table()
coins_list = dex.enabled_coins_list
@@ -11,4 +11,4 @@ if len(coins_list) == 0:
status_print("No coins are activated!")
else:
# Documentation: https://developers.komodoplatform.com/basic-docs/atomicdex/atomicdex-api-legacy/my_balance.html
- tables.balances(coins_list)
+ table.balances(coins_list)
diff --git a/const.py b/const.py
index 7ca82e2..532a256 100644
--- a/const.py
+++ b/const.py
@@ -58,7 +58,7 @@ SEEDS_FILE = f"{SCRIPT_PATH}/scan/seed_phrases.json"
ACTIVATION_FILE = f"{SCRIPT_PATH}/activate_commands.json"
ACTIVATION_URL = "http://stats.kmd.io/api/atomicdex/activation_commands/"
try:
- ACTIVATE_COMMANDS = requests.get(ACTIVATION_URL).json()["commands"]
+ ACTIVATE_COMMANDS = requests.get(ACTIVATION_URL).json()
with open(f"{SCRIPT_PATH}/activate_commands.json", "w+") as f:
json.dump(ACTIVATE_COMMANDS, f, indent=4)
except:
diff --git a/models.py b/models.py
index 3705349..4ec0f36 100644
--- a/models.py
+++ b/models.py
@@ -1066,10 +1066,6 @@ class Config:
return value
-table = Table()
-dex = Dex()
-
-
class Tui:
def __init__(self):
self.config = Config()
@@ -1099,7 +1095,7 @@ class Tui:
" "
)
if isinstance(coins, list):
- dex.activate_coins(coins)
+ self.dex.activate_coins(coins)
break
except KeyboardInterrupt:
break
@@ -1128,7 +1124,7 @@ class Tui:
self.table.orders(self.dex.api.orders)
def view_swaps(self):
- self.table.swaps_summary(dex.api.rpc("my_recent_swaps").json())
+ self.table.swaps_summary(self.dex.api.rpc("my_recent_swaps").json())
def loop_views(self):
self.table.loop_views()
@@ -1149,7 +1145,7 @@ class Tui:
amount = color_input(
f"Enter the amount of {coin} you want to withdraw, or 'MAX' to withdraw full balance: "
)
- amount = dex.validate_withdraw_amount(amount)
+ amount = self.dex.validate_withdraw_amount(amount)
while not amount:
error_print(
f"{amount} is not 'MAX' or a valid numeric value, try again."
@@ -1157,19 +1153,19 @@ class Tui:
amount = color_input(
f"Enter the amount of {coin} you want to withdraw, or 'MAX' to withdraw full balance: "
)
- amount = dex.validate_withdraw_amount(amount)
+ amount = self.dex.validate_withdraw_amount(amount)
address = color_input(f"Enter the destination address: ")
- while not dex.is_address_valid(coin, address):
+ while not self.dex.is_address_valid(coin, address):
error_print(f"{address} is not a valid {coin} address, try again.")
address = color_input(f"Enter the destination address: ")
- resp = dex.withdraw(coin, amount, address)
+ resp = self.dex.withdraw(coin, amount, address)
if "error" in resp:
error_print(resp)
elif "result" in resp:
if "tx_hex" in resp["result"]:
- send_resp = dex.send_raw_tx(coin, resp["result"]["tx_hex"])
+ send_resp = self.dex.send_raw_tx(coin, resp["result"]["tx_hex"])
if "tx_hash" in send_resp:
success_print(
f"{amount} {coin} sent to {address}. TXID: {send_resp['tx_hash']}"
@@ -1188,7 +1184,7 @@ class Tui:
q = color_input("Stop Komodo DeFi Framework on exit? [Y/N]: ")
if q.lower() == "y":
- resp = dex.quit()
+ resp = self.dex.quit()
if "error" in resp:
error_print(resp)
elif "success" in resp: |
@jd-2205 Would you consider making it as a PR? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I launch the bot without having a config file
MM2.json
inpytomicDEX_makerbot/config/
I get the following error:Traceback
I think printing an error and suggestion to get the file would be better.
The text was updated successfully, but these errors were encountered: