add json flag to cast commands

This commit is contained in:
2024-11-29 14:31:47 +03:00
parent dece337480
commit a5e84ba7df

View File

@@ -427,13 +427,15 @@ def voucher_transfer_handler(cmd):
f'--rpc-url {rpc} '
f'{s} '
f'"transfer(address,uint256)" {to} {value}'
f' --json '
)
result = subprocess.run(command, shell=True, capture_output=True, text=True)
if result.returncode != 0:
raise subprocess.CalledProcessError(result.returncode, command, output=result.stdout, stderr=result.stderr)
if result.stderr:
raise ValueError(f"Command failed with error: {result.stderr}")
return result.stdout
data = json.loads(result.stdout)
return data["transactionHash"]
@@ -468,13 +470,15 @@ def voucher_mint_handler(cmd):
f'--rpc-url {rpc} '
f' {s} '
f'"mintTo(address,uint256)" {to} {value}'
f' --json '
)
result = subprocess.run(command, shell=True, capture_output=True, text=True)
if result.returncode != 0:
raise subprocess.CalledProcessError(result.returncode, command, output=result.stdout, stderr=result.stderr)
if result.stderr:
raise ValueError(f"Command failed with error: {result.stderr}")
return result.stdout
data = json.loads(result.stdout)
return data["transactionHash"]