From 9012b9884a6ca3166235f64cd965bb44d21524d0 Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 12 May 2022 06:27:11 +0000 Subject: [PATCH] Apply balance tool on new chainlib setup --- chainlib/eth/cli/arg.py | 11 +---------- chainlib/eth/data/config/config.ini | 2 ++ chainlib/eth/runnable/balance.py | 30 +++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/chainlib/eth/cli/arg.py b/chainlib/eth/cli/arg.py index 9b49996..f8821e6 100644 --- a/chainlib/eth/cli/arg.py +++ b/chainlib/eth/cli/arg.py @@ -1,15 +1,6 @@ -## external imports -#from chainlib.cli import ( -# ArgumentParser, -# argflag_std_read, -# argflag_std_write, -# argflag_std_base, -# argflag_std_base_read, -# flag_reset as argflag_reset, -# Flag, -# ) from chainlib.cli.arg import ( ArgumentParser, Arg, ArgFlag, + process_args, ) diff --git a/chainlib/eth/data/config/config.ini b/chainlib/eth/data/config/config.ini index aaf46b5..7d3e20e 100644 --- a/chainlib/eth/data/config/config.ini +++ b/chainlib/eth/data/config/config.ini @@ -5,6 +5,8 @@ credentials = dialect = default scheme = http verify = 1 +timeout = 10.0 +proxy = [chain] spec = evm:berlin:1:ethereum diff --git a/chainlib/eth/runnable/balance.py b/chainlib/eth/runnable/balance.py index f605b22..4a65775 100644 --- a/chainlib/eth/runnable/balance.py +++ b/chainlib/eth/runnable/balance.py @@ -13,6 +13,16 @@ from hexathon import ( # local imports import chainlib.eth.cli +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 from chainlib.eth.address import AddressChecksum from chainlib.jsonrpc import ( jsonrpc_result, @@ -26,17 +36,25 @@ from chainlib.eth.gas import ( from chainlib.chain import ChainSpec from funga.eth.signer import EIP155Signer -logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() script_dir = os.path.dirname(os.path.realpath(__file__)) -#config_dir = os.path.join(script_dir, '..', 'data', 'config') -arg_flags = chainlib.eth.cli.argflag_std_read -argparser = chainlib.eth.cli.ArgumentParser(arg_flags) -argparser.add_positional('address', type=str, help='Ethereum address of recipient') +argparser = chainlib.eth.cli.ArgumentParser() #arg_flags) +arg_flags = ArgFlag() +arg = Arg(arg_flags) +flags = arg_flags.STD_READ +argparser = process_args(argparser, arg, flags) + +argparser.add_argument('address', type=str, help='Ethereum address of recipient') args = argparser.parse_args() -config = chainlib.eth.cli.Config.from_args(args, arg_flags) + +logg = process_log(args, logg) +logg.debug('flags {} {} {}'.format(flags, arg_flags.SEQ, flags & arg_flags.SEQ)) + +config = Config() +config = process_config(config, arg, args, flags) +logg.debug('config loaded:\n{}'.format(config)) wallet = chainlib.eth.cli.Wallet() wallet.from_config(config)