feat: Add support for test networks

This commit is contained in:
2025-01-31 11:01:10 +11:00
parent 26633c1c61
commit 8622400427
8 changed files with 127 additions and 46 deletions

View File

@@ -50,12 +50,11 @@ def main(params, authentication):
batches.append(names[i:i+100])
# Unlock wallet
api_key = os.getenv("hsd_api")
ip = os.getenv("hsd_ip")
if api_key is None:
print("API key not set")
return {"status": "API key not set", "transaction": "None"}
response = requests.post(f'http://x:{api_key}@{ip}:12039/wallet/{wallet}/unlock',
KEY = account.HSD_API
IP = account.HSD_IP
PORT = account.HSD_WALLET_PORT
response = requests.post(f'http://x:{KEY}@{IP}:{PORT}/wallet/{wallet}/unlock',
json={'passphrase': password, 'timeout': 600})
if response.status_code != 200:
print("Failed to unlock wallet")
@@ -74,7 +73,7 @@ def main(params, authentication):
batchTX = "[" + ", ".join(batch) + "]"
responseContent = f'{{"method": "sendbatch","params":[ {batchTX} ]}}'
response = requests.post(f'http://x:{api_key}@{ip}:12039', data=responseContent)
response = requests.post(f'http://x:{KEY}@{IP}:{PORT}', data=responseContent)
if response.status_code != 200:
print("Failed to create batch",flush=True)
print(f'Status code: {response.status_code}',flush=True)