Apply new arg and config handling from chainlib
This commit is contained in:
parent
2f90eb632f
commit
a1896b40c1
@ -1,3 +1,5 @@
|
|||||||
|
- 0.3.0
|
||||||
|
* Implement chainlib with new arg and config handling
|
||||||
- 0.2.0
|
- 0.2.0
|
||||||
* Implement chainlib generic tx, block and tx result objects
|
* Implement chainlib generic tx, block and tx result objects
|
||||||
- 0.1.3
|
- 0.1.3
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
# external imports
|
## external imports
|
||||||
from chainlib.cli import (
|
#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,
|
ArgumentParser,
|
||||||
argflag_std_read,
|
Arg,
|
||||||
argflag_std_write,
|
ArgFlag,
|
||||||
argflag_std_base,
|
|
||||||
argflag_std_base_read,
|
|
||||||
flag_reset as argflag_reset,
|
|
||||||
Flag,
|
|
||||||
)
|
)
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# external imports
|
# 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__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
data_dir = os.path.join(script_dir, '..')
|
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_base_config_dir = os.path.join(data_dir, 'data', 'config')
|
||||||
default_fee_limit = 21000
|
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)
|
config.add('default', 'RPC_DIALECT', exists_ok=True)
|
||||||
elif config.get('RPC_DIALECT') not in [
|
elif config.get('RPC_DIALECT') not in [
|
||||||
'openethereum',
|
'openethereum',
|
||||||
@ -30,4 +32,3 @@ class Config(BaseConfig):
|
|||||||
raise ValueError('unknown rpc dialect {}'.format(config.get('RPC_DIALECT')))
|
raise ValueError('unknown rpc dialect {}'.format(config.get('RPC_DIALECT')))
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainlib-eth
|
name = chainlib-eth
|
||||||
version = 0.2.1
|
version = 0.3.0
|
||||||
description = Ethereum implementation of the chainlib interface
|
description = Ethereum implementation of the chainlib interface
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user