From 53cea0817e854372b789899707776da8a60ef497 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 30 Oct 2021 16:49:36 +0200 Subject: [PATCH] Fix remaining 0x problems --- chainlib/eth/gas.py | 2 +- chainlib/eth/nonce.py | 2 +- chainlib/eth/runnable/gas.py | 5 ++++- chainlib/eth/runnable/get.py | 2 ++ requirements.txt | 2 +- setup.cfg | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/chainlib/eth/gas.py b/chainlib/eth/gas.py index 6b76a13..a793e58 100644 --- a/chainlib/eth/gas.py +++ b/chainlib/eth/gas.py @@ -55,7 +55,7 @@ def balance(address, id_generator=None, height=BlockSpec.LATEST): j = JSONRPCRequest(id_generator) o = j.template() o['method'] = 'eth_getBalance' - o['params'].append(address) + o['params'].append(add_0x(address)) height = to_blockheight_param(height) o['params'].append(height) return j.finalize(o) diff --git a/chainlib/eth/nonce.py b/chainlib/eth/nonce.py index f425318..de00c95 100644 --- a/chainlib/eth/nonce.py +++ b/chainlib/eth/nonce.py @@ -44,7 +44,7 @@ class NonceOracle(BaseNonceOracle): """ def __init__(self, address, id_generator=None): self.id_generator = id_generator - super(NonceOracle, self).__init__(address) + super(NonceOracle, self).__init__(add_0x(address)) def get_nonce(self): diff --git a/chainlib/eth/runnable/gas.py b/chainlib/eth/runnable/gas.py index b3f4a6e..5a48929 100644 --- a/chainlib/eth/runnable/gas.py +++ b/chainlib/eth/runnable/gas.py @@ -26,7 +26,10 @@ from chainlib.eth.gas import Gas from chainlib.eth.gas import balance as gas_balance from chainlib.chain import ChainSpec from chainlib.eth.runnable.util import decode_for_puny_humans -from chainlib.eth.address import is_same_address +from chainlib.eth.address import ( + is_same_address, + is_checksum_address, + ) import chainlib.eth.cli logging.basicConfig(level=logging.WARNING) diff --git a/chainlib/eth/runnable/get.py b/chainlib/eth/runnable/get.py index 754e01e..dea7d1b 100644 --- a/chainlib/eth/runnable/get.py +++ b/chainlib/eth/runnable/get.py @@ -63,6 +63,7 @@ item = add_0x(args.item) def get_transaction(conn, tx_hash, id_generator): + tx_hash = add_0x(tx_hash) j = JSONRPCRequest(id_generator=id_generator) o = j.template() o['method'] = 'eth_getTransactionByHash' @@ -104,6 +105,7 @@ def get_transaction(conn, tx_hash, id_generator): def get_address(conn, address, id_generator, height): + address = add_0x(address) j = JSONRPCRequest(id_generator=id_generator) o = j.template() o['method'] = 'eth_getCode' diff --git a/requirements.txt b/requirements.txt index 94431e6..d152033 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ pysha3==1.0.2 hexathon~=0.0.1a8 websocket-client==0.57.0 potaahto~=0.0.1a1 -chainlib==0.0.10a9 +chainlib==0.0.10a10 confini>=0.4.2rc3,<0.5.0 diff --git a/setup.cfg b/setup.cfg index 6540182..08a04d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = chainlib-eth -version = 0.0.10a18 +version = 0.0.10a20 description = Ethereum implementation of the chainlib interface author = Louis Holbrook author_email = dev@holbrook.no