eth-accounts-index

Accounts index evm contract tooling with permissioned writes
Log | Files | Refs

commit c630627e9823867165286441caa8f41e7f743e91
parent 713d8338fafba0480f6421cc6664b5ff5cf4f1b6
Author: nolash <dev@holbrook.no>
Date:   Wed, 25 Aug 2021 12:06:22 +0200

Add id generator to interface methods

Diffstat:
Mpython/eth_accounts_index/interface.py | 23++++++++++++-----------
Mpython/setup.cfg | 2+-
2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/python/eth_accounts_index/interface.py b/python/eth_accounts_index/interface.py @@ -15,9 +15,7 @@ from chainlib.eth.contract import ( abi_decode_single, ) from chainlib.eth.constant import ZERO_ADDRESS -from chainlib.jsonrpc import ( - jsonrpc_template, - ) +from chainlib.jsonrpc import JSONRPCRequest from chainlib.eth.error import RequestMismatchException from hexathon import ( add_0x, @@ -45,8 +43,9 @@ class AccountsIndex(TxFactory): return self.__single_address_method('add', contract_address, sender_address, address, tx_format) - def have(self, contract_address, address, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def have(self, contract_address, address, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('have') @@ -59,8 +58,9 @@ class AccountsIndex(TxFactory): return o - def entry_count(self, contract_address, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def entry_count(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('entryCount') @@ -71,12 +71,13 @@ class AccountsIndex(TxFactory): return o - def count(self, contract_address, sender_address=ZERO_ADDRESS): - return self.entry_count(contract_address, sender_address=sender_address) + def count(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None): + return self.entry_count(contract_address, sender_address=sender_address, id_generator=id_generator) - def entry(self, contract_address, idx, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def entry(self, contract_address, idx, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('entry') diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-accounts-index -version = 0.1.2a2 +version = 0.1.2a3 description = Accounts index evm contract tooling with permissioned writes author = Louis Holbrook author_email = dev@holbrook.no