From 9bece8494c7a1832538d624d30ca4664e28fdb7b Mon Sep 17 00:00:00 2001 From: nolash Date: Fri, 19 Feb 2021 13:55:55 +0100 Subject: [PATCH] Correct missing chain spec changes --- python/giftable_erc20_token/runnable/add.py | 5 +++-- python/giftable_erc20_token/runnable/deploy.py | 9 +++++---- python/giftable_erc20_token/runnable/gift.py | 5 +++-- python/requirements.txt | 1 + python/setup.cfg | 3 ++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/python/giftable_erc20_token/runnable/add.py b/python/giftable_erc20_token/runnable/add.py index 093b8f4..9a9b50e 100644 --- a/python/giftable_erc20_token/runnable/add.py +++ b/python/giftable_erc20_token/runnable/add.py @@ -21,6 +21,7 @@ from eth_keys import keys from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.eth.helper import EthTxExecutor +from chainlib.chain import ChainSpec logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -60,8 +61,8 @@ if args.y != None: logg.debug('now have key for signer address {}'.format(signer_address)) signer = EIP155Signer(keystore) -chain_pair = args.i.split(':') -chain_id = int(chain_pair[1]) +chain_spec = ChainSpec.from_chain_str(args.i) +chain_id = chain_spec.network_id() helper = EthTxExecutor( w3, diff --git a/python/giftable_erc20_token/runnable/deploy.py b/python/giftable_erc20_token/runnable/deploy.py index 35fe7d6..abaf759 100644 --- a/python/giftable_erc20_token/runnable/deploy.py +++ b/python/giftable_erc20_token/runnable/deploy.py @@ -16,11 +16,12 @@ import logging import time from enum import Enum -# third-party imports +# external imports import web3 from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.eth.helper import EthTxExecutor +from chainlib.chain import ChainSpec logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -37,7 +38,7 @@ argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8 argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed') argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed') argparser.add_argument('-e', action='store_true', help='Treat all transactions as essential') -argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string') +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='evm:ethereum:1', help='Chain specification string') argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') argparser.add_argument('--name', dest='n', default='Giftable Token', type=str, help='Token name') argparser.add_argument('--symbol', dest='s', default='GFT', type=str, help='Token symbol') @@ -65,8 +66,8 @@ if args.y != None: logg.debug('now have key for signer address {}'.format(signer_address)) signer = EIP155Signer(keystore) -chain_pair = args.i.split(':') -chain_id = int(chain_pair[1]) +chain_spec = ChainSpec.from_chain_str(args.i) +chain_id = chain_spec.network_id() helper = EthTxExecutor( w3, diff --git a/python/giftable_erc20_token/runnable/gift.py b/python/giftable_erc20_token/runnable/gift.py index a873396..8dc7523 100644 --- a/python/giftable_erc20_token/runnable/gift.py +++ b/python/giftable_erc20_token/runnable/gift.py @@ -21,6 +21,7 @@ from eth_keys import keys from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore import DictKeystore from crypto_dev_signer.eth.helper import EthTxExecutor +from chainlib.chain from ChainSpec logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -61,8 +62,8 @@ if args.y != None: logg.debug('now have key for signer address {}'.format(signer_address)) signer = EIP155Signer(keystore) -chain_pair = args.i.split(':') -chain_id = int(chain_pair[1]) +chain_spec = ChainSpec.from_chain_str(args.i) +chain_id = chain_spec.network_id() helper = EthTxExecutor( w3, diff --git a/python/requirements.txt b/python/requirements.txt index 2a056ba..5122abb 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1 +1,2 @@ web3==5.12.2 +chainlib~=0.0.1a15 diff --git a/python/setup.cfg b/python/setup.cfg index 7adecf2..6734c30 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = giftable-erc20-token -version = 0.0.7b10 +version = 0.0.7b11 description = Simple ERC20 contract with deployment script that lets any address mint and gift itself tokens. author = Louis Holbrook author_email = dev@holbrook.no @@ -29,6 +29,7 @@ packages = install_requires = web3==5.12.2 crypto-dev-signer~=0.4.13rc2 + chainlib~=0.0.1a15 [options.package_data] * =