fix: Check for node not being connected

This commit is contained in:
Nathan Woodburn 2024-02-01 23:26:57 +11:00
parent e5616c1f99
commit 50f3f07b63
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -87,7 +87,11 @@ def createWallet(account: str, password: str):
def listWallets():
# List the wallets
response = hsw.listWallets()
return response
# Check if response is json or an array
if isinstance(response, list):
return response
return ['Wallet not connected']
def getBalance(account: str):
# Get the total balance
@ -316,6 +320,9 @@ def setDNS(account,domain,records):
def getNodeSync():
response = hsd.getInfo()
if 'error' in response:
return 0
sync = response['chain']['progress']*100
sync = round(sync, 2)
return sync