commit 3a145d60c6f46004a42f17dbf41d594b0d9e4b52
parent 8039da7a9f7d59a8df4d2fcb254db061cbdce1f2
Author: lash <dev@holbrook.no>
Date: Sat, 5 Nov 2022 11:47:37 +0000
Toggle raw output mode for raw cli tool
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/chainlib/eth/runnable/raw.py b/chainlib/eth/runnable/raw.py
@@ -158,14 +158,20 @@ def main():
else:
o = raw(config.get('_DATA'), id_generator=settings.get('RPC_ID_GENERATOR'))
if settings.get('RPC_SEND'):
- r = settings.get('CONN').do(o)
+ tx_hash_hex = settings.get('CONN').do(o)
+ out = tx_hash_hex
if config.true('_WAIT'):
#r = settings.get('CONN').wait(tx_hash_hex)
- r = settings.get('CONN').wait(r)
+ r = settings.get('CONN').wait(tx_hash_hex)
if r['status'] == 0:
logg.critical('VM revert for {}. Wish I could tell you more'.format(tx_hash_hex))
sys.exit(1)
- print(r)
+ if config.true('_RAW'):
+ out = json.dumps(r)
+ sys.stdout.write(out)
+ if not config.true('_NULL'):
+ sys.stdout.write('\n')
+
else:
print(o)