mirror of
git://holbrook.no/eth-contract-registry
synced 2024-12-22 20:27:32 +01:00
Move to chainlib-eth
This commit is contained in:
parent
72223d0011
commit
3fd2f1d6b7
@ -1,7 +1,5 @@
|
|||||||
# external imports
|
# external imports
|
||||||
from chainlib.jsonrpc import (
|
from chainlib.jsonrpc import JSONRPCRequest
|
||||||
jsonrpc_template,
|
|
||||||
)
|
|
||||||
from chainlib.eth.contract import (
|
from chainlib.eth.contract import (
|
||||||
ABIContractEncoder,
|
ABIContractEncoder,
|
||||||
ABIContractType,
|
ABIContractType,
|
||||||
@ -23,8 +21,9 @@ from .encoding import (
|
|||||||
|
|
||||||
class Registry(TxFactory):
|
class Registry(TxFactory):
|
||||||
|
|
||||||
def address_of(self, contract_address, identifier_string, sender_address=ZERO_ADDRESS):
|
def address_of(self, contract_address, identifier_string, 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')
|
||||||
@ -35,6 +34,7 @@ class Registry(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
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,9 +14,7 @@ from chainlib.chain import ChainSpec
|
|||||||
from chainlib.eth.constant import (
|
from chainlib.eth.constant import (
|
||||||
ZERO_ADDRESS,
|
ZERO_ADDRESS,
|
||||||
)
|
)
|
||||||
from chainlib.jsonrpc import (
|
from chainlib.jsonrpc import JSONRPCRequest
|
||||||
jsonrpc_template,
|
|
||||||
)
|
|
||||||
from hexathon import (
|
from hexathon import (
|
||||||
even,
|
even,
|
||||||
add_0x,
|
add_0x,
|
||||||
@ -117,8 +115,9 @@ class ContractRegistry(Registry):
|
|||||||
return self.build(tx)
|
return self.build(tx)
|
||||||
|
|
||||||
|
|
||||||
def identifier(self, contract_address, idx, sender_address=ZERO_ADDRESS):
|
def identifier(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('identifiers')
|
enc.method('identifiers')
|
||||||
@ -128,6 +127,7 @@ class ContractRegistry(Registry):
|
|||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
confini~=0.3.6rc3
|
confini~=0.3.6rc3
|
||||||
crypto-dev-signer~=0.4.14b4
|
crypto-dev-signer~=0.4.14b6
|
||||||
chainlib~=0.0.3rc3
|
chainlib-eth~=0.0.5a1
|
||||||
|
13
python/run_tests.sh
Normal file
13
python/run_tests.sh
Normal file
@ -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
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-contract-registry
|
name = eth-contract-registry
|
||||||
version = 0.5.5a3
|
version = 0.5.6a1
|
||||||
description = Ethereum Smart Contract key-value registry
|
description = Ethereum Smart Contract key-value registry
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user