Move to chainlib-eth

This commit is contained in:
nolash 2021-06-28 09:42:49 +02:00
parent 3756ae28d9
commit 7634e5566d
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
8 changed files with 50 additions and 23 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

12
python/run_tests.sh Normal file
View File

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

View File

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

View File

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