Provide web3 constructor to tracker rpc client
This commit is contained in:
parent
b37c7f3cc2
commit
2fe205b1e8
@ -68,6 +68,21 @@ cic_base.config.log(config)
|
|||||||
dsn = dsn_from_config(config)
|
dsn = dsn_from_config(config)
|
||||||
SessionBase.connect(dsn, pool_size=1, debug=config.true('DATABASE_DEBUG'))
|
SessionBase.connect(dsn, pool_size=1, debug=config.true('DATABASE_DEBUG'))
|
||||||
|
|
||||||
|
re_websocket = re.compile('^wss?://')
|
||||||
|
re_http = re.compile('^https?://')
|
||||||
|
blockchain_provider = config.get('ETH_PROVIDER')
|
||||||
|
if re.match(re_websocket, blockchain_provider) != None:
|
||||||
|
blockchain_provider = web3.Web3.WebsocketProvider(blockchain_provider)
|
||||||
|
elif re.match(re_http, blockchain_provider) != None:
|
||||||
|
blockchain_provider = web3.Web3.HTTPProvider(blockchain_provider)
|
||||||
|
else:
|
||||||
|
raise ValueError('unknown provider url {}'.format(blockchain_provider))
|
||||||
|
|
||||||
|
def web3_constructor():
|
||||||
|
w3 = web3.Web3(blockchain_provider)
|
||||||
|
return (blockchain_provider, w3)
|
||||||
|
RpcClient.set_constructor(web3_constructor)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# parse chain spec object
|
# parse chain spec object
|
||||||
|
@ -68,6 +68,7 @@ if args.v == True:
|
|||||||
logging.getLogger().setLevel(logging.INFO)
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
elif args.vv == True:
|
elif args.vv == True:
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
verbose = args.vv or args.v
|
||||||
|
|
||||||
config_dir = os.path.join(args.c)
|
config_dir = os.path.join(args.c)
|
||||||
os.makedirs(config_dir, 0o777, True)
|
os.makedirs(config_dir, 0o777, True)
|
||||||
@ -313,7 +314,8 @@ def main():
|
|||||||
r = l.split(',')
|
r = l.split(',')
|
||||||
try:
|
try:
|
||||||
address = to_checksum(r[0])
|
address = to_checksum(r[0])
|
||||||
#sys.stdout.write('loading balance {} {}'.format(i, address).ljust(200) + "\r")
|
if not verbose:
|
||||||
|
sys.stdout.write('loading balance {} {}'.format(i, address).ljust(200) + "\r")
|
||||||
logg.debug('loading balance {} {}'.format(i, address).ljust(200))
|
logg.debug('loading balance {} {}'.format(i, address).ljust(200))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
break
|
break
|
||||||
@ -328,6 +330,7 @@ def main():
|
|||||||
verifier = Verifier(conn, api, gas_oracle, chain_spec, account_index_address, sarafu_token_address, user_dir, exit_on_error)
|
verifier = Verifier(conn, api, gas_oracle, chain_spec, account_index_address, sarafu_token_address, user_dir, exit_on_error)
|
||||||
|
|
||||||
user_new_dir = os.path.join(user_dir, 'new')
|
user_new_dir = os.path.join(user_dir, 'new')
|
||||||
|
i = 0
|
||||||
for x in os.walk(user_new_dir):
|
for x in os.walk(user_new_dir):
|
||||||
for y in x[2]:
|
for y in x[2]:
|
||||||
if y[len(y)-5:] != '.json':
|
if y[len(y)-5:] != '.json':
|
||||||
@ -343,6 +346,8 @@ def main():
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
u = Person.deserialize(o)
|
u = Person.deserialize(o)
|
||||||
|
if not verbose:
|
||||||
|
sys.stdout.write('processing {} {}'.format(i, u.identities['evm']).ljust(200) + "\r")
|
||||||
logg.debug('data {}'.format(u.identities['evm']))
|
logg.debug('data {}'.format(u.identities['evm']))
|
||||||
|
|
||||||
subchain_str = '{}:{}'.format(chain_spec.common_name(), chain_spec.network_id())
|
subchain_str = '{}:{}'.format(chain_spec.common_name(), chain_spec.network_id())
|
||||||
@ -357,6 +362,7 @@ def main():
|
|||||||
logg.debug('checking {} -> {} = {}'.format(old_address, new_address, balance))
|
logg.debug('checking {} -> {} = {}'.format(old_address, new_address, balance))
|
||||||
|
|
||||||
verifier.verify(new_address, balance)
|
verifier.verify(new_address, balance)
|
||||||
|
i += 1
|
||||||
|
|
||||||
print(verifier)
|
print(verifier)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user