fix: Check for node not being connected
This commit is contained in:
parent
e5616c1f99
commit
50f3f07b63
@ -87,7 +87,11 @@ def createWallet(account: str, password: str):
|
|||||||
def listWallets():
|
def listWallets():
|
||||||
# List the wallets
|
# List the wallets
|
||||||
response = hsw.listWallets()
|
response = hsw.listWallets()
|
||||||
|
|
||||||
|
# Check if response is json or an array
|
||||||
|
if isinstance(response, list):
|
||||||
return response
|
return response
|
||||||
|
return ['Wallet not connected']
|
||||||
|
|
||||||
def getBalance(account: str):
|
def getBalance(account: str):
|
||||||
# Get the total balance
|
# Get the total balance
|
||||||
@ -316,6 +320,9 @@ def setDNS(account,domain,records):
|
|||||||
|
|
||||||
def getNodeSync():
|
def getNodeSync():
|
||||||
response = hsd.getInfo()
|
response = hsd.getInfo()
|
||||||
|
if 'error' in response:
|
||||||
|
return 0
|
||||||
|
|
||||||
sync = response['chain']['progress']*100
|
sync = response['chain']['progress']*100
|
||||||
sync = round(sync, 2)
|
sync = round(sync, 2)
|
||||||
return sync
|
return sync
|
||||||
|
Loading…
Reference in New Issue
Block a user