2022-04-26 19:24:57 +02:00
|
|
|
# external imports
|
|
|
|
from chainlib.eth.connection import EthHTTPConnection
|
2022-05-13 15:47:58 +02:00
|
|
|
from chainlib.eth.settings import process_settings as base_process_settings
|
2022-04-26 19:24:57 +02:00
|
|
|
from chaind.eth.chain import EthChainInterface
|
2022-05-13 12:32:28 +02:00
|
|
|
from chaind.settings import *
|
2022-05-13 15:47:58 +02:00
|
|
|
from chainsyncer.settings import process_sync_range
|
2022-04-26 19:24:57 +02:00
|
|
|
|
|
|
|
|
2022-05-13 12:32:28 +02:00
|
|
|
def process_common(settings, config):
|
|
|
|
rpc_provider = config.get('RPC_PROVIDER')
|
|
|
|
if rpc_provider == None:
|
|
|
|
rpc_provider = 'http://localhost:8545'
|
|
|
|
conn = EthHTTPConnection(url=rpc_provider, chain_spec=settings.get('CHAIN_SPEC'))
|
|
|
|
settings.set('RPC', conn)
|
|
|
|
return settings
|
2022-04-26 19:24:57 +02:00
|
|
|
|
2022-05-13 12:32:28 +02:00
|
|
|
|
2022-05-13 15:47:58 +02:00
|
|
|
def process_sync(settings, config):
|
|
|
|
settings.set('SYNCER_INTERFACE', EthChainInterface())
|
|
|
|
settings = process_sync_range(settings, config)
|
|
|
|
return settings
|
|
|
|
|
|
|
|
|
2022-05-13 12:32:28 +02:00
|
|
|
def process_settings(settings, config):
|
|
|
|
settings = base_process_settings(settings, config)
|
|
|
|
settings = process_common(settings, config)
|
|
|
|
settings = process_backend(settings, config)
|
|
|
|
settings = process_session(settings, config)
|
|
|
|
settings = process_socket(settings, config)
|
|
|
|
|
|
|
|
return settings
|