mango-explorer/bin/transaction-scout

32 lines
976 B
Python
Executable File

#!/usr/bin/env python3
import argparse
import logging
import os
import os.path
import sys
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: argparse.Namespace = mango.parse_args(parser)
with mango.ContextBuilder.from_command_line_parameters(args) as context:
signature = args.signature
logging.info(f"Signature: {signature}")
report = mango.TransactionScout.load(context, signature)
mango.output(report)