Rehabilitate decode tool
This commit is contained in:
parent
c060222638
commit
d70dfc3f03
@ -14,7 +14,19 @@ from chainlib.eth.tx import unpack
|
|||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
|
import chainlib.eth.cli
|
||||||
from chainlib.eth.runnable.util import decode_for_puny_humans
|
from chainlib.eth.runnable.util import decode_for_puny_humans
|
||||||
|
from chainlib.eth.cli.arg import (
|
||||||
|
Arg,
|
||||||
|
ArgFlag,
|
||||||
|
process_args,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.config import (
|
||||||
|
Config,
|
||||||
|
process_config,
|
||||||
|
)
|
||||||
|
from chainlib.eth.cli.log import process_log
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
@ -22,11 +34,22 @@ logg = logging.getLogger()
|
|||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
||||||
|
|
||||||
arg_flags = chainlib.eth.cli.Flag.VERBOSE | chainlib.eth.cli.Flag.CHAIN_SPEC | chainlib.eth.cli.Flag.ENV_PREFIX | chainlib.eth.cli.Flag.RAW
|
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
arg_flags = ArgFlag()
|
||||||
argparser.add_positional('tx_data', type=str, help='Transaction data to decode')
|
arg = Arg(arg_flags)
|
||||||
|
flags = arg_flags.VERBOSE | arg_flags.CHAIN_SPEC | arg_flags.RAW | arg_flags.ENV
|
||||||
|
|
||||||
|
argparser = chainlib.eth.cli.ArgumentParser()
|
||||||
|
argparser = process_args(argparser, arg, flags)
|
||||||
|
argparser.add_argument('tx_data', type=str, help='Transaction data to decode')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
config = chainlib.eth.cli.Config.from_args(args, arg_flags, default_config_dir=config_dir)
|
|
||||||
|
logg = process_log(args, logg)
|
||||||
|
|
||||||
|
config = Config()
|
||||||
|
config = process_config(config, arg, args, flags)
|
||||||
|
logg.debug('config loaded:\n{}'.format(config))
|
||||||
|
|
||||||
|
|
||||||
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
chain_spec = ChainSpec.from_chain_str(config.get('CHAIN_SPEC'))
|
||||||
|
|
||||||
|
@ -58,11 +58,12 @@ logg = logging.getLogger()
|
|||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
config_dir = os.path.join(script_dir, '..', 'data', 'config')
|
||||||
|
|
||||||
argparser = chainlib.eth.cli.ArgumentParser()
|
|
||||||
arg_flags = ArgFlag()
|
arg_flags = ArgFlag()
|
||||||
arg = Arg(arg_flags)
|
arg = Arg(arg_flags)
|
||||||
flags = arg_flags.STD_BASE_READ
|
flags = arg_flags.STD_BASE_READ
|
||||||
flags = arg_flags.less(flags, arg_flags.CHAIN_SPEC)
|
flags = arg_flags.less(flags, arg_flags.CHAIN_SPEC)
|
||||||
|
|
||||||
|
argparser = chainlib.eth.cli.ArgumentParser()
|
||||||
argparser = process_args(argparser, arg, flags)
|
argparser = process_args(argparser, arg, flags)
|
||||||
argparser.add_argument('item', type=str, help='Address or transaction to retrieve data for')
|
argparser.add_argument('item', type=str, help='Address or transaction to retrieve data for')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
Loading…
Reference in New Issue
Block a user