2021-05-14 04:32:39 -07:00
|
|
|
#!/usr/bin/env pyston3
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import logging
|
2021-06-07 07:10:18 -07:00
|
|
|
import os
|
2021-05-14 04:32:39 -07:00
|
|
|
import os.path
|
2021-06-07 07:10:18 -07:00
|
|
|
import sys
|
2021-05-14 04:32:39 -07:00
|
|
|
import traceback
|
|
|
|
|
2021-06-07 07:10:18 -07:00
|
|
|
sys.path.insert(0, os.path.abspath(
|
|
|
|
os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
import mango # nopep8
|
2021-05-14 04:32:39 -07:00
|
|
|
|
|
|
|
# We explicitly want argument parsing to be outside the main try-except block because some arguments
|
|
|
|
# (like --help) will cause an exit, which our except: block traps.
|
2021-06-07 07:10:18 -07:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description="Run the Transaction Scout to display information about a specific transaction.")
|
2021-06-17 04:06:39 -07:00
|
|
|
mango.Context.add_command_line_parameters(parser)
|
2021-05-14 04:32:39 -07:00
|
|
|
parser.add_argument("--signature", type=str, required=True,
|
|
|
|
help="The signature of the transaction to look up")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
logging.getLogger().setLevel(args.log_level)
|
2021-06-07 07:10:18 -07:00
|
|
|
logging.warning(mango.WARNING_DISCLAIMER_TEXT)
|
2021-05-14 04:32:39 -07:00
|
|
|
|
|
|
|
try:
|
|
|
|
signature = args.signature
|
|
|
|
|
2021-06-17 04:06:39 -07:00
|
|
|
context = mango.Context.from_command_line_parameters(args)
|
2021-05-14 04:32:39 -07:00
|
|
|
|
|
|
|
logging.info(f"Context: {context}")
|
|
|
|
logging.info(f"Signature: {signature}")
|
|
|
|
|
2021-06-07 07:10:18 -07:00
|
|
|
report = mango.TransactionScout.load(context, signature)
|
2021-05-14 04:32:39 -07:00
|
|
|
print(report)
|
|
|
|
except Exception as exception:
|
|
|
|
logging.critical(f"transaction-scout stopped because of exception: {exception} - {traceback.format_exc()}")
|
|
|
|
except:
|
|
|
|
logging.critical(f"transaction-scout stopped because of uncatchable error: {traceback.format_exc()}")
|