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(
|
2021-06-25 02:33:40 -07:00
|
|
|
os.path.join(os.path.dirname(__file__), "..")))
|
2021-06-07 07:10:18 -07:00
|
|
|
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-07-23 02:20:44 -07:00
|
|
|
mango.ContextBuilder.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")
|
2021-09-13 06:05:19 -07:00
|
|
|
args: argparse.Namespace = mango.parse_args(parser)
|
2021-05-14 04:32:39 -07:00
|
|
|
|
|
|
|
try:
|
|
|
|
signature = args.signature
|
|
|
|
|
2021-07-23 02:20:44 -07:00
|
|
|
context = mango.ContextBuilder.from_command_line_parameters(args)
|
2021-05-14 04:32:39 -07:00
|
|
|
|
|
|
|
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()}")
|