diff --git a/README.md b/README.md index 4c5f6bd..607b1f9 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ These plugins aren't included by default as there are already a lot of plugins i Go to Plugins > Custom Plugin Manager Import this URL: ``` -https://git.woodburn.au/nathanwoodburn/FireWalletPlugins.git +https://git.woodburn.au/nathanwoodburn/hns-address-plugin.git ``` diff --git a/hns-address.py b/hns-address.py index 5455f5c..9ca9c08 100644 --- a/hns-address.py +++ b/hns-address.py @@ -1,5 +1,5 @@ import json -# import account +import account import requests import os import subprocess @@ -48,7 +48,7 @@ functions = { def initialize(): # Check if hns-address is installed - if not os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "hns-address")): + if not os.path.exists("hns-address"): # Try to install hns-address try: print("Cloning hns-address...") @@ -59,10 +59,11 @@ def initialize(): return -1 # Check if npm install was successful - if not os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "hns-address", "node_modules")): + if not os.path.exists("hns-address/node_modules"): + path = os.path.realpath("hns-address") try: print("Installing hns-address dependencies...") - result = subprocess.run(["npm", "install"], cwd=os.path.join(os.path.dirname(os.path.realpath(__file__)), "hns-address"), capture_output=True, text=True) + result = subprocess.run(["npm", "install"], cwd=path, capture_output=True, text=True) if result.returncode != 0: return -1 except: @@ -86,9 +87,9 @@ def generate(params, authentication): startIndex = 0 if (xpub == None): - xpub = "xpub6BvF6DnLZRV6my62FuQ8nw5TRebL8qr9Wa7u2tE1aEedHWBt4XAfSaNTmP1SM2nXErGWSzxRAHVwqstPzRrsXtA2vn1a4KzLwAVEgLNmfca" + xpub = account.getxPub(authentication) - result = subprocess.run(["node", "generate-address.js", "--xpub", xpub, "--number", str(count), "--startIndex", str(startIndex)], capture_output=True, text=True, cwd=os.path.join(os.path.dirname(os.path.realpath(__file__)), "hns-address")) + 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: f.write(result.stdout)