2021-06-08 16:47:15 -07:00
|
|
|
#!/usr/bin/env pyston3
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from solana.publickey import PublicKey
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.abspath(
|
2021-06-25 02:33:40 -07:00
|
|
|
os.path.join(os.path.dirname(__file__), "..")))
|
2021-06-08 16:47:15 -07:00
|
|
|
import mango # nopep8
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description="Shows the on-chain data of a particular account.")
|
2021-07-23 02:20:44 -07:00
|
|
|
mango.ContextBuilder.add_command_line_parameters(parser)
|
2021-06-08 16:47:15 -07:00
|
|
|
parser.add_argument("--address", type=PublicKey, required=True,
|
|
|
|
help="address of the account")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
logging.getLogger().setLevel(args.log_level)
|
|
|
|
logging.warning(mango.WARNING_DISCLAIMER_TEXT)
|
|
|
|
|
2021-07-23 02:20:44 -07:00
|
|
|
context = mango.ContextBuilder.from_command_line_parameters(args)
|
2021-06-08 16:47:15 -07:00
|
|
|
|
|
|
|
account_info = mango.AccountInfo.load(context, args.address)
|
|
|
|
if account_info is None:
|
|
|
|
print(f"No account at '{args.address}'")
|
|
|
|
else:
|
|
|
|
print(account_info)
|
|
|
|
print("Account Data:", account_info.encoded_data())
|