#!/usr/bin/env pyston3 import argparse import logging import os import os.path import sys import traceback sys.path.insert(0, os.path.abspath( os.path.join(os.path.dirname(__file__), ".."))) import mango # nopep8 # 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. parser = argparse.ArgumentParser( description="Run the Transaction Scout to display information about a specific transaction.") mango.ContextBuilder.add_command_line_parameters(parser) 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) logging.warning(mango.WARNING_DISCLAIMER_TEXT) try: signature = args.signature context = mango.ContextBuilder.from_command_line_parameters(args) logging.info(f"Context: {context}") logging.info(f"Signature: {signature}") report = mango.TransactionScout.load(context, signature) 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()}")