2021-02-21 16:41:37 +01:00
|
|
|
# standard imports
|
|
|
|
import logging
|
|
|
|
|
|
|
|
# external imports
|
|
|
|
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
|
2021-05-20 23:25:14 +02:00
|
|
|
from crypto_dev_signer.keystore.dict import DictKeystore
|
2021-02-21 16:41:37 +01:00
|
|
|
|
|
|
|
logg = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
keystore = DictKeystore()
|
|
|
|
|
|
|
|
def from_keystore(keyfile):
|
|
|
|
global keystore
|
|
|
|
|
|
|
|
# signer
|
|
|
|
if keyfile == None:
|
|
|
|
raise ValueError('please specify signer keystore file')
|
|
|
|
|
|
|
|
logg.debug('loading keystore file {}'.format(keyfile))
|
|
|
|
address = keystore.import_keystore_file(keyfile)
|
|
|
|
|
|
|
|
signer = EIP155Signer(keystore)
|
|
|
|
return (address, signer,)
|