fix: Balance should return hide domain value and fix send max
All checks were successful
Build Docker / BuildImage (push) Successful in 33s

This commit is contained in:
Nathan Woodburn 2024-06-04 15:17:17 +10:00
parent 7b2a25592e
commit 1a7b62efa2
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

15
hsd.py
View File

@ -230,10 +230,10 @@ def get_balance(userID:str, name:str) -> dict:
# Convert to human readable
return_json = {
'available': balance['confirmed']/10**6,
'available_small': balance['confirmed'],
'locked': (balance['lockedConfirmed']-domains_value)/10**6,
'locked_small': balance['lockedConfirmed']-domains_value,
'available': (balance['confirmed']-domains_value)/10**6,
'available_small': balance['confirmed']-domains_value,
'locked': balance['lockedConfirmed']/10**6,
'locked_small': balance['lockedConfirmed'],
}
return return_json
@ -328,6 +328,10 @@ def send_to_address(userID:str, name:str, address:str, amount:str) -> dict:
'error': 'Insufficient funds'
}
subtractFee = False
if balance['available'] - amount < 0.03:
subtractFee = True
amount = balance['available']
data = {
'outputs': [
@ -336,7 +340,8 @@ def send_to_address(userID:str, name:str, address:str, amount:str) -> dict:
'value': hns.to_small(amount)
}
],
'sign': False
'sign': False,
'subtractFee': subtractFee
}
response = requests.post(url(True)+'wallet/'+walletID+'/create', json=data)