mirror of
git://holbrook.no/eth-accounts-index
synced 2024-11-25 10:16:46 +01:00
Add id generator to interface methods
This commit is contained in:
parent
713d8338fa
commit
c630627e98
@ -15,9 +15,7 @@ from chainlib.eth.contract import (
|
|||||||
abi_decode_single,
|
abi_decode_single,
|
||||||
)
|
)
|
||||||
from chainlib.eth.constant import ZERO_ADDRESS
|
from chainlib.eth.constant import ZERO_ADDRESS
|
||||||
from chainlib.jsonrpc import (
|
from chainlib.jsonrpc import JSONRPCRequest
|
||||||
jsonrpc_template,
|
|
||||||
)
|
|
||||||
from chainlib.eth.error import RequestMismatchException
|
from chainlib.eth.error import RequestMismatchException
|
||||||
from hexathon import (
|
from hexathon import (
|
||||||
add_0x,
|
add_0x,
|
||||||
@ -45,8 +43,9 @@ class AccountsIndex(TxFactory):
|
|||||||
return self.__single_address_method('add', contract_address, sender_address, address, tx_format)
|
return self.__single_address_method('add', contract_address, sender_address, address, tx_format)
|
||||||
|
|
||||||
|
|
||||||
def have(self, contract_address, address, sender_address=ZERO_ADDRESS):
|
def have(self, contract_address, address, sender_address=ZERO_ADDRESS, id_generator=None):
|
||||||
o = jsonrpc_template()
|
j = JSONRPCRequest(id_generator)
|
||||||
|
o = j.template()
|
||||||
o['method'] = 'eth_call'
|
o['method'] = 'eth_call'
|
||||||
enc = ABIContractEncoder()
|
enc = ABIContractEncoder()
|
||||||
enc.method('have')
|
enc.method('have')
|
||||||
@ -59,8 +58,9 @@ class AccountsIndex(TxFactory):
|
|||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
def entry_count(self, contract_address, sender_address=ZERO_ADDRESS):
|
def entry_count(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None):
|
||||||
o = jsonrpc_template()
|
j = JSONRPCRequest(id_generator)
|
||||||
|
o = j.template()
|
||||||
o['method'] = 'eth_call'
|
o['method'] = 'eth_call'
|
||||||
enc = ABIContractEncoder()
|
enc = ABIContractEncoder()
|
||||||
enc.method('entryCount')
|
enc.method('entryCount')
|
||||||
@ -71,12 +71,13 @@ class AccountsIndex(TxFactory):
|
|||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
def count(self, contract_address, sender_address=ZERO_ADDRESS):
|
def count(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None):
|
||||||
return self.entry_count(contract_address, sender_address=sender_address)
|
return self.entry_count(contract_address, sender_address=sender_address, id_generator=id_generator)
|
||||||
|
|
||||||
|
|
||||||
def entry(self, contract_address, idx, sender_address=ZERO_ADDRESS):
|
def entry(self, contract_address, idx, sender_address=ZERO_ADDRESS, id_generator=None):
|
||||||
o = jsonrpc_template()
|
j = JSONRPCRequest(id_generator)
|
||||||
|
o = j.template()
|
||||||
o['method'] = 'eth_call'
|
o['method'] = 'eth_call'
|
||||||
enc = ABIContractEncoder()
|
enc = ABIContractEncoder()
|
||||||
enc.method('entry')
|
enc.method('entry')
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-accounts-index
|
name = eth-accounts-index
|
||||||
version = 0.1.2a2
|
version = 0.1.2a3
|
||||||
description = Accounts index evm contract tooling with permissioned writes
|
description = Accounts index evm contract tooling with permissioned writes
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user