fix: Path for hns-address
This commit is contained in:
parent
a3b3687da2
commit
8abcf48ee3
@ -13,6 +13,9 @@ info = {
|
|||||||
"author": "Nathan.Woodburn/"
|
"author": "Nathan.Woodburn/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hnsAddressPath = os.path.realpath("customPlugins/hns-address-plugin/hns-address")
|
||||||
|
path = os.path.realpath("customPlugins/hns-address-plugin")
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
functions = {
|
functions = {
|
||||||
"generate": {
|
"generate": {
|
||||||
@ -71,7 +74,7 @@ def initialize():
|
|||||||
# Try to install hns-address
|
# Try to install hns-address
|
||||||
try:
|
try:
|
||||||
print("Cloning hns-address...")
|
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:
|
if result.returncode != 0:
|
||||||
return -1
|
return -1
|
||||||
except:
|
except:
|
||||||
@ -79,10 +82,9 @@ def initialize():
|
|||||||
|
|
||||||
# Check if npm install was successful
|
# Check if npm install was successful
|
||||||
if not os.path.exists("hns-address/node_modules"):
|
if not os.path.exists("hns-address/node_modules"):
|
||||||
path = os.path.realpath("hns-address")
|
|
||||||
try:
|
try:
|
||||||
print("Installing hns-address dependencies...")
|
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:
|
if result.returncode != 0:
|
||||||
return -1
|
return -1
|
||||||
except:
|
except:
|
||||||
@ -110,7 +112,7 @@ def generate(params, authentication):
|
|||||||
if (xpub == None):
|
if (xpub == None):
|
||||||
return {"result": "No xpub found"}
|
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:
|
with open(f"{xpub}-addresses.txt", "w") as f:
|
||||||
f.write(result.stdout)
|
f.write(result.stdout)
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ def validate(params, authentication):
|
|||||||
if (address == None):
|
if (address == None):
|
||||||
return {"result": "Address is required"}
|
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>")}
|
return {"result": result.stdout.replace("\n", "<br>")}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user