commit 607b1a33712d7e7b75f6256a74c728961ef59f11
parent 52f2e02cfc13dbf1bbcf7f358e727b18db6f8d90
Author: nolash <dev@holbrook.no>
Date: Fri, 19 Feb 2021 20:17:15 +0100
Add index accessor
Diffstat:
5 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/python/eth_accounts_index/registry.py b/python/eth_accounts_index/registry.py
@@ -72,6 +72,10 @@ class AccountRegistry:
return r != 0
+ def get_index(self, i):
+ return self.contract.functions.accounts(i).call()
+
+
def last(self, n):
c = self.count()
lo = c - n - 1
diff --git a/python/eth_accounts_index/runnable/add.py b/python/eth_accounts_index/runnable/add.py
@@ -16,6 +16,7 @@ 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()
@@ -59,8 +60,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/eth_accounts_index/runnable/deploy.py b/python/eth_accounts_index/runnable/deploy.py
@@ -16,6 +16,7 @@ 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()
@@ -59,8 +60,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
@@ -1,2 +1,3 @@
-confini==0.3.4
+confini~=0.3.6rc1
web3==5.12.2
+chainlib~=0.0.1a16
diff --git a/python/setup.cfg b/python/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = eth-accounts-index
-version = 0.0.10a7
+version = 0.0.10a10
description = Accounts index evm contract tooling with permissioned writes
author = Louis Holbrook
author_email = dev@holbrook.no
@@ -30,6 +30,7 @@ install_requires =
confini~=0.3.6a1
web3==5.12.2
crypto-dev-signer~=0.4.13rc2
+ chainlib~=0.0.1a16
tests_require =
pytest==6.0.1
eth-tester==0.5.0b2