eth-address-index

signed metadata declarations for ethereum addresses
Log | Files | Refs

commit bcd56d06a0b3a463330234ad435d039e3f3d3f0e
parent c71c9d6c0b5b239ebb07825891c45b53f1bf1403
Author: lash <dev@holbrook.no>
Date:   Sat, 25 Feb 2023 20:27:46 +0000

Rehabilitate view command

Diffstat:
Mpython/CHANGELOG | 6++++++
Mpython/eth_address_declarator/interface.py | 18++++++++++++++----
Mpython/eth_address_declarator/runnable/view.py | 8+++++---
Mpython/requirements.txt | 3++-
Mpython/setup.cfg | 2+-
5 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -1,3 +1,9 @@ +- 0.6.1 + * Fix broken calls for some chains; force block height parameter +- 0.6.0 + * Upgrade deps +- 0.5.0 + * Upgrade deps - 0.4.0 * Upgrade chainlib - 0.3.0 diff --git a/python/eth_address_declarator/interface.py b/python/eth_address_declarator/interface.py @@ -19,6 +19,8 @@ from chainlib.eth.contract import ( ) from chainlib.jsonrpc import JSONRPCRequest from chainlib.eth.constant import ZERO_ADDRESS +from chainlib.block import BlockSpec +from chainlib.eth.jsonrpc import to_blockheight_param logg = logging.getLogger(__name__) @@ -39,7 +41,7 @@ class Declarator(TxFactory): return tx - def declarator_count(self, contract_address, subject_address, sender_address=ZERO_ADDRESS, id_generator=None): + def declarator_count(self, contract_address, subject_address, sender_address=ZERO_ADDRESS, id_generator=None, height=BlockSpec.LATEST): j = JSONRPCRequest(id_generator) o = j.template() o['method'] = 'eth_call' @@ -51,11 +53,13 @@ class Declarator(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + height = to_blockheight_param(height) + o['params'].append(height) o = j.finalize(o) return o - def declaration(self, contract_address, declarator_address, subject_address, sender_address=ZERO_ADDRESS, id_generator=None): + def declaration(self, contract_address, declarator_address, subject_address, sender_address=ZERO_ADDRESS, id_generator=None, height=BlockSpec.LATEST): j = JSONRPCRequest(id_generator) o = j.template() o['method'] = 'eth_call' @@ -69,11 +73,13 @@ class Declarator(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + height = to_blockheight_param(height) + o['params'].append(height) o = j.finalize(o) return o - def declaration_address_at(self, contract_address, declarator_address, idx, sender_address=ZERO_ADDRESS, id_generator=None): + def declaration_address_at(self, contract_address, declarator_address, idx, sender_address=ZERO_ADDRESS, id_generator=None, height=BlockSpec.LATEST): j = JSONRPCRequest(id_generator) o = j.template() o['method'] = 'eth_call' @@ -87,11 +93,13 @@ class Declarator(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + height = to_blockheight_param(height) + o['params'].append(height) o = j.finalize(o) return o - def declarator_address_at(self, contract_address, subject_address, idx, sender_address=ZERO_ADDRESS, id_generator=None): + def declarator_address_at(self, contract_address, subject_address, idx, sender_address=ZERO_ADDRESS, id_generator=None, height=BlockSpec.LATEST): j = JSONRPCRequest(id_generator) o = j.template() o['method'] = 'eth_call' @@ -105,6 +113,8 @@ class Declarator(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + height = to_blockheight_param(height) + o['params'].append(height) o = j.finalize(o) return o diff --git a/python/eth_address_declarator/runnable/view.py b/python/eth_address_declarator/runnable/view.py @@ -15,6 +15,7 @@ import chainlib.eth.cli from chainlib.chain import ChainSpec from chainlib.error import JSONRPCException from chainlib.eth.address import to_checksum_address +from chainlib.eth.constant import ZERO_ADDRESS from hexathon import ( add_0x, strip_0x, @@ -55,7 +56,7 @@ def process_config_local(config, arg, args, flags): arg_flags = ArgFlag() arg = Arg(arg_flags) -flags = arg_flags.STD_WRITE | arg_flags.WALLET | arg_flags.EXEC +flags = arg_flags.STD_WRITE | arg_flags.WALLET | arg_flags.EXEC | arg_flags.SENDER argparser = chainlib.eth.cli.ArgumentParser() argparser = process_args(argparser, arg, flags) @@ -78,8 +79,8 @@ def out_element(e, w=sys.stdout): w.write(e[1] + '\n') -def ls(ifc, conn, contract_address, declarator_address, subject_address, w=sys.stdout): - o = ifc.declaration(contract_address, declarator_address, subject_address) +def ls(ifc, conn, contract_address, declarator_address, subject_address, w=sys.stdout, sender_address=ZERO_ADDRESS): + o = ifc.declaration(contract_address, declarator_address, subject_address, sender_address=sender_address) r = conn.do(o) declarations = ifc.parse_declaration(r) @@ -99,6 +100,7 @@ def main(): settings.get('EXEC'), config.get('_DECLARATOR'), settings.get('RECIPIENT'), + sender_address=settings.get('SENDER_ADDRESS'), ) declarations = [] diff --git a/python/requirements.txt b/python/requirements.txt @@ -1,2 +1,3 @@ confini~=0.6.0 -chainlib-eth~=0.4.7 +chainlib-eth~=0.4.16 +chainlib==0.4.12 diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-address-index -version = 0.6.0 +version = 0.6.1 description = Signed metadata declarations for ethereum addresses author = Louis Holbrook author_email = dev@holbrook.no