add json flag to cast commands
This commit is contained in:
parent
dece337480
commit
a5e84ba7df
8
parse.py
8
parse.py
@ -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"]
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user