Add id generator to interface methods

This commit is contained in:
nolash 2021-08-25 12:06:22 +02:00
parent 713d8338fa
commit c630627e98
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 13 additions and 12 deletions

View File

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

View File

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