Import chainlib, parse chainspec

This commit is contained in:
nolash 2021-02-19 13:50:13 +01:00
parent 67b21c369f
commit c282dfe9ed
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
6 changed files with 18 additions and 13 deletions

View File

@ -38,8 +38,8 @@ class AddressDeclarator:
@staticmethod @staticmethod
def abi(): def abi():
if AddressDeclarator.__abi == None: if AddressDeclarator.__abi == None:
f = open(os.path.join(datadir, 'AccountDeclarator.json'), 'r') f = open(os.path.join(datadir, 'AddressDeclarator.json'), 'r')
AccountDeclarator.__abi = json.load(f) AddressDeclarator.__abi = json.load(f)
f.close() f.close()
return AddressDeclarator.__abi return AddressDeclarator.__abi
@ -47,8 +47,8 @@ class AddressDeclarator:
@staticmethod @staticmethod
def bytecode(): def bytecode():
if AddressDeclarator.__bytecode == None: if AddressDeclarator.__bytecode == None:
f = open(os.path.join(datadir, 'AccountDeclarator.bin')) f = open(os.path.join(datadir, 'AddressDeclarator.bin'))
AccountDeclarator.__bytecode = f.read() AddressDeclarator.__bytecode = f.read()
f.close() f.close()
return AddressDeclarator.__bytecode return AddressDeclarator.__bytecode

View File

@ -16,6 +16,7 @@ import web3
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.keystore import DictKeystore
from crypto_dev_signer.eth.helper import EthTxExecutor from crypto_dev_signer.eth.helper import EthTxExecutor
from chainlib.chain import ChainSpec
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger() logg = logging.getLogger()
@ -60,8 +61,8 @@ if args.y != None:
logg.debug('now have key for signer address {}'.format(signer_address)) logg.debug('now have key for signer address {}'.format(signer_address))
signer = EIP155Signer(keystore) signer = EIP155Signer(keystore)
chain_pair = args.i.split(':') chain_spec = ChainSpec.from_chain_str(args.i)
chain_id = int(chain_pair[1]) chain_id = chain_spec.network_id()
helper = EthTxExecutor( helper = EthTxExecutor(
w3, w3,

View File

@ -16,6 +16,7 @@ import web3
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.keystore import DictKeystore
from crypto_dev_signer.eth.helper import EthTxExecutor from crypto_dev_signer.eth.helper import EthTxExecutor
from chainlib.chain import ChainSpec
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger() logg = logging.getLogger()
@ -57,8 +58,8 @@ if args.y != None:
logg.debug('now have key for signer address {}'.format(signer_address)) logg.debug('now have key for signer address {}'.format(signer_address))
signer = EIP155Signer(keystore) signer = EIP155Signer(keystore)
chain_pair = args.i.split(':') chain_spec = ChainSpec.from_chain_str(args.i)
chain_id = int(chain_pair[1]) chain_id = chain_spec.network_id()
helper = EthTxExecutor( helper = EthTxExecutor(
w3, w3,

View File

@ -17,6 +17,7 @@ import web3
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.keystore import DictKeystore
from crypto_dev_signer.eth.helper import EthTxExecutor from crypto_dev_signer.eth.helper import EthTxExecutor
from chainlib.chain import ChainSpec
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger() logg = logging.getLogger()
@ -59,8 +60,8 @@ if args.y != None:
logg.debug('now have key for signer address {}'.format(signer_address)) logg.debug('now have key for signer address {}'.format(signer_address))
signer = EIP155Signer(keystore) signer = EIP155Signer(keystore)
chain_pair = args.i.split(':') chain_spec = ChainSpec.from_chain_str(args.i)
chain_id = int(chain_pair[1]) chain_id = chain_spec.network_id()
helper = EthTxExecutor( helper = EthTxExecutor(
w3, w3,

View File

@ -16,6 +16,7 @@ import web3
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.keystore import DictKeystore
from crypto_dev_signer.eth.helper import EthTxExecutor from crypto_dev_signer.eth.helper import EthTxExecutor
from chainspec.chain import ChainSpec
logging.basicConfig(level=logging.WARNING) logging.basicConfig(level=logging.WARNING)
logg = logging.getLogger() logg = logging.getLogger()
@ -56,8 +57,8 @@ if args.y != None:
logg.debug('now have key for signer address {}'.format(signer_address)) logg.debug('now have key for signer address {}'.format(signer_address))
signer = EIP155Signer(keystore) signer = EIP155Signer(keystore)
chain_pair = args.i.split(':') chain_spec = ChainSpec.from_chain_str(args.i)
chain_id = int(chain_pair[1]) chain_id = chain_spec.network_id()
helper = EthTxExecutor( helper = EthTxExecutor(
w3, w3,

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = eth-address-index name = eth-address-index
version = 0.1.0a8 version = 0.1.0a9
description = Signed metadata declarations for ethereum addresses description = Signed metadata declarations for ethereum addresses
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no
@ -31,6 +31,7 @@ packages =
install_requires = install_requires =
web3==5.12.2 web3==5.12.2
crypto-dev-signer~=0.4.13rc2 crypto-dev-signer~=0.4.13rc2
chainlib~=0.0.1a15
tests_require = tests_require =
eth-tester==0.5.0b2 eth-tester==0.5.0b2
py-evm==0.3.0a20 py-evm==0.3.0a20