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 - 0.1.0-unreleased
* Implement external signer * Implement external signer
* Standardize cli arg flags * Standardize cli arg flags

View File

@ -23,7 +23,6 @@ from chainlib.eth.contract import (
ABIContractType, ABIContractType,
abi_decode_single, abi_decode_single,
) )
from chainlib.jsonrpc import jsonrpc_template
from chainlib.eth.constant import ZERO_ADDRESS from chainlib.eth.constant import ZERO_ADDRESS
# local imports # local imports

View File

@ -17,7 +17,7 @@ from chainlib.eth.contract import (
ABIContractType, ABIContractType,
abi_decode_single, abi_decode_single,
) )
from chainlib.jsonrpc import jsonrpc_template from chainlib.jsonrpc import JSONRPCRequest
from chainlib.eth.constant import ZERO_ADDRESS from chainlib.eth.constant import ZERO_ADDRESS
logg = logging.getLogger(__name__) logg = logging.getLogger(__name__)
@ -39,8 +39,9 @@ class Declarator(TxFactory):
return tx return tx
def declarator_count(self, contract_address, subject_address, sender_address=ZERO_ADDRESS): def declarator_count(self, contract_address, subject_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('declaratorCount') enc.method('declaratorCount')
@ -50,11 +51,13 @@ class Declarator(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
return o return o
def declaration(self, contract_address, declarator_address, subject_address, sender_address=ZERO_ADDRESS): def declaration(self, contract_address, declarator_address, subject_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('declaration') enc.method('declaration')
@ -66,11 +69,13 @@ class Declarator(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
return o return o
def declaration_address_at(self, contract_address, declarator_address, idx, sender_address=ZERO_ADDRESS): def declaration_address_at(self, contract_address, declarator_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('declarationAddressAt') enc.method('declarationAddressAt')
@ -82,11 +87,13 @@ class Declarator(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
return o return o
def declarator_address_at(self, contract_address, subject_address, idx, sender_address=ZERO_ADDRESS): def declarator_address_at(self, contract_address, subject_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('declaratorAddressAt') enc.method('declaratorAddressAt')
@ -98,6 +105,7 @@ class Declarator(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
return o return o

View File

@ -19,7 +19,7 @@ from chainlib.eth.tx import (
TxFactory, TxFactory,
TxFormat, TxFormat,
) )
from chainlib.jsonrpc import jsonrpc_template from chainlib.jsonrpc import JSONRPCRequest
from chainlib.eth.constant import ZERO_ADDRESS from chainlib.eth.constant import ZERO_ADDRESS
from hexathon import ( from hexathon import (
add_0x, add_0x,
@ -85,8 +85,9 @@ class TokenUniqueSymbolIndex(TxFactory):
return tx return tx
def address_of(self, contract_address, token_symbol, sender_address=ZERO_ADDRESS): def address_of(self, contract_address, token_symbol, 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('addressOf') enc.method('addressOf')
@ -97,11 +98,13 @@ class TokenUniqueSymbolIndex(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
return o return o
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')
@ -111,11 +114,13 @@ class TokenUniqueSymbolIndex(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
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')
@ -123,6 +128,7 @@ class TokenUniqueSymbolIndex(TxFactory):
tx = self.template(sender_address, contract_address) tx = self.template(sender_address, contract_address)
tx = self.set_code(tx, data) tx = self.set_code(tx, data)
o['params'].append(self.normalize(tx)) o['params'].append(self.normalize(tx))
o = j.finalize(o)
return o return o

View File

@ -1,4 +1,4 @@
confini~=0.3.6rc3 confini~=0.3.6rc3
crypto-dev-signer~=0.4.14b3 crypto-dev-signer~=0.4.14b6
chainlib~=0.0.3a1 chainlib-eth~=0.0.5a1
eth_erc20~=0.0.9a1 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] [metadata]
name = eth-address-index name = eth-address-index
version = 0.1.1a12 version = 0.1.2a1
description = Signed metadata declarations for ethereum addresses description = Signed metadata declarations for ethereum addresses
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no 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 py-evm==0.3.0a20
giftable-erc20-token==0.0.8a9