parse json from ge-publish
This commit is contained in:
parent
a5e84ba7df
commit
dc87181e0a
18
parse.py
18
parse.py
@ -381,21 +381,21 @@ def voucher_create_handler(cmd):
|
||||
if privatekey.startswith("0x"):
|
||||
private_key = privatekey[2:]
|
||||
|
||||
command = f'ge-publish --private-key {private_key} ' \
|
||||
command = f'ge-publish --private-key {private_key} --json ' \
|
||||
f'--rpc {rpc} --gas-fee-cap {gasCap} --chainid {chainId} ' \
|
||||
f'p erc20 --name "{name}" --symbol "{symbol}"'
|
||||
|
||||
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)
|
||||
output = result.stderr.strip().split("\n")
|
||||
contract_address = None
|
||||
|
||||
for word in output[1].split():
|
||||
if "contract_address=" in word:
|
||||
contract_address = word.split("=")[1]
|
||||
print("Voucher created with Address:",contract_address)
|
||||
store_voucher(privatekey,symbol,remove_ansi_escape_codes(contract_address))
|
||||
output_lines = result.stderr.strip().split("\n")
|
||||
deployment_result = output_lines[1]
|
||||
try:
|
||||
data = json.loads(deployment_result)
|
||||
contract_address = data.get('contract_address', None)
|
||||
except json.JSONDecodeError as e:
|
||||
print("Error parsing JSON:", e)
|
||||
print("Voucher created with contract address:",contract_address)
|
||||
return contract_address
|
||||
|
||||
def voucher_transfer_handler(cmd):
|
||||
|
Loading…
Reference in New Issue
Block a user