diff --git a/hns-address.py b/hns-address.py index 355c7b2..026d34b 100644 --- a/hns-address.py +++ b/hns-address.py @@ -51,7 +51,7 @@ functions = { "type": "text" }, "xpub": { - "name": "xPub of the account to generate addresses for (defaults to current account)", + "name": "xPub of the account to check addresses for (defaults to current account)", "type": "text" } }, @@ -107,6 +107,8 @@ def generate(params, authentication): if (xpub == None): xpub = account.getxPub(authentication) + if (xpub == None): + return {"result": "No xpub found"} result = subprocess.run(["node", "generate-address.js", "--xpub", xpub, "--number", str(count), "--startIndex", str(startIndex)], capture_output=True, text=True, cwd=os.path.realpath("hns-address")) with open(f"{xpub}-addresses.txt", "w") as f: @@ -124,13 +126,16 @@ def validate(params, authentication): if (xpub == None): xpub = account.getxPub(authentication) + print(f"xpub: {xpub}") + if (xpub == None): + return {"result": "No xpub found"} if (address == None): return {"result": "Address is required"} result = subprocess.run(["node", "find-address.js", "--xpub", xpub, "--address", address, "--end", "10000"], capture_output=True, text=True, cwd=os.path.realpath("hns-address")) - return {"result": result.stdout} + return {"result": result.stdout.replace("\n", "
")} if __name__ == "__main__": print(generate({