Add tx wait method to test rpc

This commit is contained in:
nolash 2021-10-11 21:12:59 +02:00
parent 14ccb8d375
commit ee6c97f581
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 7 additions and 0 deletions

View File

@ -41,6 +41,7 @@ class Wallet(BaseWallet):
super(Wallet, self).__init__(EIP155Signer, checksummer=checksummer) super(Wallet, self).__init__(EIP155Signer, checksummer=checksummer)
# TODO: how is the keystore implemented in rpc here?
class Rpc(BaseRpc): class Rpc(BaseRpc):
"""Convenience constructor to set Ethereum defaults for chainlib cli Rpc object """Convenience constructor to set Ethereum defaults for chainlib cli Rpc object

View File

@ -23,6 +23,7 @@ from hexathon import (
add_0x, add_0x,
strip_0x, strip_0x,
) )
from chainlib.eth.tx import receipt
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
from crypto_dev_signer.encoding import private_key_to_address from crypto_dev_signer.encoding import private_key_to_address
@ -81,6 +82,11 @@ class TestRPCConnection(RPCConnection):
return jsonrpc_result(r, error_parser) 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): def eth_blockNumber(self, p):
block = self.backend.get_block_by_number('latest') block = self.backend.get_block_by_number('latest')
return block['number'] return block['number']