feat: Test running transfer lock

This commit is contained in:
Nathan Woodburn 2025-01-30 21:10:36 +11:00
parent 47939cac3d
commit c00603c020
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -28,6 +28,27 @@ functions = {
}
}
},
"startListingTransfer": {
"name": "Start Listing Transfer",
"description": "Start listing transfer. You will need to wait 2 days to send the finalize before listing",
"type":"default",
"params": {
"domain": {
"type": "text",
"name": "Domain to list"
}
},
"returns": {
"status": {
"type": "text",
"name": "Status"
},
"txid": {
"type": "tx",
"name": "Transaction ID"
}
}
},
"list": {
"name": "List",
"description": "List a new domain",
@ -106,6 +127,41 @@ def init(params, authentication):
return {"status": "Success"}
def startListingTransfer(params, authentication):
domain = params["domain"]
# Generate command
wallet = authentication.split(":")[0]
passphrase = authentication.split(":")[1]
api_key = os.getenv("hsd_api")
host = os.getenv("hsd_ip")
if host is None:
host = "127.0.0.1"
# node node_modules/shakedex/bin/shakedex transfer-lock domain -n main -w wallet -a key -p ./data --httphost host
process = subprocess.Popen(
["node", f"{path}/node_modules/shakedex/bin/shakedex", "transfer-lock", domain, "-n", "main", "-w", wallet, "-a", api_key, "-p", f"{path}/data", "--httphost", host],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
process.stdin.write('\n') # For yes prompt
process.stdin.flush()
process.stdin.write(passphrase + '\n') # For passphrase
process.stdin.flush()
stdout, stderr = process.communicate()
print(stdout)
print(stderr)
if process.returncode != 0:
return {"status": "Error: " + stderr}
txhash = stdout.split(" hash ")[1].split("\n")[0]
return {"status": "Success", "txid": txhash}
def list(params, authentication):
domain = params["domain"]
price = params["price"]