eth-address-index

signed metadata declarations for ethereum addresses
Log | Files | Refs

commit 7634e5566d7efa3037cad639f42bbb13790e5161
parent 3756ae28d9a1ebc178a27ba04db746fb93e1177b
Author: nolash <dev@holbrook.no>
Date:   Mon, 28 Jun 2021 09:42:49 +0200

Move to chainlib-eth

Diffstat:
Mpython/CHANGELOG | 3+++
Mpython/eth_address_declarator/declarator.py | 1-
Mpython/eth_address_declarator/interface.py | 26+++++++++++++++++---------
Mpython/eth_token_index/index.py | 20+++++++++++++-------
Mpython/requirements.txt | 6+++---
Apython/run_tests.sh | 12++++++++++++
Mpython/setup.cfg | 2+-
Mpython/test_requirements.txt | 3+--
8 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/python/CHANGELOG b/python/CHANGELOG @@ -1,3 +1,6 @@ +- 0.1.2-pending + * Move to chainlib-eth +- 0.1.1-unreleased - 0.1.0-unreleased * Implement external signer * Standardize cli arg flags diff --git a/python/eth_address_declarator/declarator.py b/python/eth_address_declarator/declarator.py @@ -23,7 +23,6 @@ from chainlib.eth.contract import ( ABIContractType, abi_decode_single, ) -from chainlib.jsonrpc import jsonrpc_template from chainlib.eth.constant import ZERO_ADDRESS # local imports diff --git a/python/eth_address_declarator/interface.py b/python/eth_address_declarator/interface.py @@ -17,7 +17,7 @@ from chainlib.eth.contract import ( ABIContractType, abi_decode_single, ) -from chainlib.jsonrpc import jsonrpc_template +from chainlib.jsonrpc import JSONRPCRequest from chainlib.eth.constant import ZERO_ADDRESS logg = logging.getLogger(__name__) @@ -39,8 +39,9 @@ class Declarator(TxFactory): return tx - def declarator_count(self, contract_address, subject_address, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def declarator_count(self, contract_address, subject_address, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('declaratorCount') @@ -50,11 +51,13 @@ class Declarator(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 - def declaration(self, contract_address, declarator_address, subject_address, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def declaration(self, contract_address, declarator_address, subject_address, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('declaration') @@ -66,11 +69,13 @@ class Declarator(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 - def declaration_address_at(self, contract_address, declarator_address, idx, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def declaration_address_at(self, contract_address, declarator_address, idx, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('declarationAddressAt') @@ -82,11 +87,13 @@ class Declarator(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 - def declarator_address_at(self, contract_address, subject_address, idx, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def declarator_address_at(self, contract_address, subject_address, idx, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('declaratorAddressAt') @@ -98,6 +105,7 @@ class Declarator(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_token_index/index.py b/python/eth_token_index/index.py @@ -19,7 +19,7 @@ from chainlib.eth.tx import ( TxFactory, TxFormat, ) -from chainlib.jsonrpc import jsonrpc_template +from chainlib.jsonrpc import JSONRPCRequest from chainlib.eth.constant import ZERO_ADDRESS from hexathon import ( add_0x, @@ -85,8 +85,9 @@ class TokenUniqueSymbolIndex(TxFactory): return tx - def address_of(self, contract_address, token_symbol, sender_address=ZERO_ADDRESS): - o = jsonrpc_template() + def address_of(self, contract_address, token_symbol, sender_address=ZERO_ADDRESS, id_generator=None): + j = JSONRPCRequest(id_generator) + o = j.template() o['method'] = 'eth_call' enc = ABIContractEncoder() enc.method('addressOf') @@ -97,11 +98,13 @@ class TokenUniqueSymbolIndex(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 - 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') @@ -111,11 +114,13 @@ class TokenUniqueSymbolIndex(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 - 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') @@ -123,6 +128,7 @@ class TokenUniqueSymbolIndex(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/requirements.txt b/python/requirements.txt @@ -1,4 +1,4 @@ confini~=0.3.6rc3 -crypto-dev-signer~=0.4.14b3 -chainlib~=0.0.3a1 -eth_erc20~=0.0.9a1 +crypto-dev-signer~=0.4.14b6 +chainlib-eth~=0.0.5a1 +eth_erc20~=0.0.10a1 diff --git a/python/run_tests.sh b/python/run_tests.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e +set -x +for f in `ls tests/*.py`; do + python $f + if [ $? -gt 0 ]; then + exit 1 + fi +done +set +x +set +e diff --git a/python/setup.cfg b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = eth-address-index -version = 0.1.1a12 +version = 0.1.2a1 description = Signed metadata declarations for ethereum addresses author = Louis Holbrook author_email = dev@holbrook.no diff --git a/python/test_requirements.txt b/python/test_requirements.txt @@ -1,3 +1,2 @@ -eth-tester==0.5.0b2 +eth-tester==0.5.0b3 py-evm==0.3.0a20 -giftable-erc20-token==0.0.8a9