fix: Path for hns-address
This commit is contained in:
parent
a3b3687da2
commit
8abcf48ee3
@ -13,6 +13,9 @@ info = {
|
||||
"author": "Nathan.Woodburn/"
|
||||
}
|
||||
|
||||
hnsAddressPath = os.path.realpath("customPlugins/hns-address-plugin/hns-address")
|
||||
path = os.path.realpath("customPlugins/hns-address-plugin")
|
||||
|
||||
# Functions
|
||||
functions = {
|
||||
"generate": {
|
||||
@ -71,7 +74,7 @@ def initialize():
|
||||
# Try to install hns-address
|
||||
try:
|
||||
print("Cloning hns-address...")
|
||||
result = subprocess.run(["git", "clone", "https://git.woodburn.au/nathanwoodburn/hns-address.git"], capture_output=True, text=True)
|
||||
result = subprocess.run(["git", "clone", "https://git.woodburn.au/nathanwoodburn/hns-address.git"], capture_output=True, text=True, cwd=path)
|
||||
if result.returncode != 0:
|
||||
return -1
|
||||
except:
|
||||
@ -79,10 +82,9 @@ def initialize():
|
||||
|
||||
# Check if npm install was successful
|
||||
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=path, capture_output=True, text=True)
|
||||
result = subprocess.run(["npm", "install"], cwd=hnsAddressPath, capture_output=True, text=True)
|
||||
if result.returncode != 0:
|
||||
return -1
|
||||
except:
|
||||
@ -110,7 +112,7 @@ def generate(params, 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"))
|
||||
result = subprocess.run(["node", "generate-address.js", "--xpub", xpub, "--number", str(count), "--startIndex", str(startIndex)], capture_output=True, text=True, cwd=hnsAddressPath)
|
||||
with open(f"{xpub}-addresses.txt", "w") as f:
|
||||
f.write(result.stdout)
|
||||
|
||||
@ -133,7 +135,7 @@ def validate(params, authentication):
|
||||
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"))
|
||||
result = subprocess.run(["node", "find-address.js", "--xpub", xpub, "--address", address, "--end", "10000"], capture_output=True, text=True, cwd=hnsAddressPath)
|
||||
|
||||
return {"result": result.stdout.replace("\n", "<br>")}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user