From ee6c97f581c4ac7d92fcf38cf47de9060239c824 Mon Sep 17 00:00:00 2001 From: nolash Date: Mon, 11 Oct 2021 21:12:59 +0200 Subject: [PATCH] Add tx wait method to test rpc --- chainlib/eth/cli.py | 1 + chainlib/eth/unittest/base.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/chainlib/eth/cli.py b/chainlib/eth/cli.py index 985f1ef..3a3c670 100644 --- a/chainlib/eth/cli.py +++ b/chainlib/eth/cli.py @@ -41,6 +41,7 @@ class Wallet(BaseWallet): super(Wallet, self).__init__(EIP155Signer, checksummer=checksummer) +# TODO: how is the keystore implemented in rpc here? class Rpc(BaseRpc): """Convenience constructor to set Ethereum defaults for chainlib cli Rpc object diff --git a/chainlib/eth/unittest/base.py b/chainlib/eth/unittest/base.py index 533c168..0ae8be0 100644 --- a/chainlib/eth/unittest/base.py +++ b/chainlib/eth/unittest/base.py @@ -23,6 +23,7 @@ from hexathon import ( add_0x, strip_0x, ) +from chainlib.eth.tx import receipt from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.encoding import private_key_to_address @@ -81,6 +82,11 @@ class TestRPCConnection(RPCConnection): return jsonrpc_result(r, error_parser) + def wait(self, tx_hash_hex): + o = receipt(tx_hash_hex) + return self.do(o) + + def eth_blockNumber(self, p): block = self.backend.get_block_by_number('latest') return block['number']