chainlib

Generic blockchain access library and tooling
Log | Files | Refs | README | LICENSE

commit 766027a49c6f3f5967a324434056d40a8a3e0139
parent 5726181f211ab291ed7069d87476263b77d39b94
Author: lash <dev@holbrook.no>
Date:   Thu, 28 Apr 2022 12:31:11 +0000

Add settings module

Diffstat:
Achainlib/settings.py | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/chainlib/settings.py b/chainlib/settings.py @@ -0,0 +1,26 @@ +# local imports +from .chain import ChainSpec + + +class ChainSettings: + + def __init__(self, include_sync=False, include_queue=False): + self.o = {} + self.get = self.o.get + + + def process_common(self, config): + self.o['CHAIN_SPEC'] = ChainSpec.from_chain_str(config.get('CHAIN_SPEC')) + + + def process(self, config): + self.process_common(config) + + + def __str__(self): + ks = list(self.o.keys()) + ks.sort() + s = '' + for k in ks: + s += '{}: {}\n'.format(k, self.o.get(k)) + return s