Add index accessor

This commit is contained in:
nolash 2021-02-19 20:17:15 +01:00
parent 52f2e02cfc
commit 607b1a3371
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 14 additions and 6 deletions

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -1,2 +1,3 @@
confini==0.3.4
confini~=0.3.6rc1
web3==5.12.2
chainlib~=0.0.1a16

View File

@ -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