commit a1896b40c10a841dd7fd2314f250d41d361b7181
parent 2f90eb632f6774cb6010e9cf060ab751d81650ac
Author: lash <dev@holbrook.no>
Date: Thu, 12 May 2022 05:30:33 +0000
Apply new arg and config handling from chainlib
Diffstat:
4 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,5 @@
+- 0.3.0
+ * Implement chainlib with new arg and config handling
- 0.2.0
* Implement chainlib generic tx, block and tx result objects
- 0.1.3
diff --git a/chainlib/eth/cli/arg.py b/chainlib/eth/cli/arg.py
@@ -1,10 +1,15 @@
-# 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,
+## 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,
)
diff --git a/chainlib/eth/cli/config.py b/chainlib/eth/cli/config.py
@@ -2,7 +2,11 @@
import os
# external imports
-from chainlib.cli import Config as BaseConfig
+from chainlib.cli.config import (
+ Config as BaseConfig,
+ process_config as base_process_config,
+ )
+
script_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.join(script_dir, '..')
@@ -14,14 +18,12 @@ class Config(BaseConfig):
default_base_config_dir = os.path.join(data_dir, 'data', 'config')
default_fee_limit = 21000
- @classmethod
- def from_args(cls, args, arg_flags=0x0f, env=os.environ, extra_args={}, base_config_dir=None, default_config_dir=None, user_config_dir=None, default_fee_limit=None, logger=None, load_callback=None):
- super(Config, cls).override_defaults(base_dir=cls.default_base_config_dir)
- if default_fee_limit == None:
- default_fee_limit = cls.default_fee_limit
- config = BaseConfig.from_args(args, arg_flags=arg_flags, env=env, extra_args=extra_args, base_config_dir=base_config_dir, default_config_dir=default_config_dir, user_config_dir=user_config_dir, default_fee_limit=default_fee_limit, logger=logger, load_callback=load_callback)
- if not config.get('RPC_DIALECT'):
+def process_config(config, arg, args, flags):
+ config = base_process_config(config, arg, args, flags)
+ if arg.match('provider', flags):
+
+ if not bool(config.get('RPC_DIALECT')):
config.add('default', 'RPC_DIALECT', exists_ok=True)
elif config.get('RPC_DIALECT') not in [
'openethereum',
@@ -29,5 +31,4 @@ class Config(BaseConfig):
]:
raise ValueError('unknown rpc dialect {}'.format(config.get('RPC_DIALECT')))
- return config
-
+ return config
diff --git a/setup.cfg b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = chainlib-eth
-version = 0.2.1
+version = 0.3.0
description = Ethereum implementation of the chainlib interface
author = Louis Holbrook
author_email = dev@holbrook.no