contract-registry

Ethereum Smart Contract key-value registry
Log | Files | Refs

commit 3fd2f1d6b78bbb3f3f3d80da8502382ba352b2b6
parent 72223d00117bfc67b49669c6a172f8c143aef611
Author: nolash <dev@holbrook.no>
Date:   Mon, 28 Jun 2021 09:29:37 +0200

Move to chainlib-eth

Diffstat:
Mpython/eth_contract_registry/interface.py | 10+++++-----
Mpython/eth_contract_registry/registry.py | 10+++++-----
Mpython/requirements.txt | 4++--
Apython/run_tests.sh | 13+++++++++++++
Mpython/setup.cfg | 2+-
5 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/python/eth_contract_registry/interface.py b/python/eth_contract_registry/interface.py @@ -1,7 +1,5 @@ # external imports -from chainlib.jsonrpc import ( - jsonrpc_template, - ) +from chainlib.jsonrpc import JSONRPCRequest from chainlib.eth.contract import ( ABIContractEncoder, ABIContractType, @@ -23,8 +21,9 @@ from .encoding import ( class Registry(TxFactory): - def address_of(self, contract_address, identifier_string, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def address_of(self, contract_address, identifier_string, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('addressOf') @@ -35,6 +34,7 @@ class Registry(TxFactory): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + o = j.finalize(o) return o diff --git a/python/eth_contract_registry/registry.py b/python/eth_contract_registry/registry.py @@ -14,9 +14,7 @@ from chainlib.chain import ChainSpec from chainlib.eth.constant import ( ZERO_ADDRESS, ) -from chainlib.jsonrpc import ( - jsonrpc_template, - ) +from chainlib.jsonrpc import JSONRPCRequest from hexathon import ( even, add_0x, @@ -117,8 +115,9 @@ class ContractRegistry(Registry): return self.build(tx) - def identifier(self, contract_address, idx, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def identifier(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('identifiers') @@ -128,6 +127,7 @@ class ContractRegistry(Registry): tx = self.template(sender_address, contract_address) tx = self.set_code(tx, data) o['params'].append(self.normalize(tx)) + o = j.finalize(o) return o diff --git a/python/requirements.txt b/python/requirements.txt @@ -1,3 +1,3 @@ confini~=0.3.6rc3 -crypto-dev-signer~=0.4.14b4 -chainlib~=0.0.3rc3 +crypto-dev-signer~=0.4.14b6 +chainlib-eth~=0.0.5a1 diff --git a/python/run_tests.sh b/python/run_tests.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e +set -x +#for f in `ls tests/*.py`; do + #python $f +# if [ $? -gt 0 ]; then +# exit 1 +# fi +#done +pytest -s -v -x ./tests +set +x +set +e diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-contract-registry -version = 0.5.5a3 +version = 0.5.6a1 description = Ethereum Smart Contract key-value registry author = Louis Holbrook author_email = dev@holbrook.no