init: block filter

This commit is contained in:
2022-12-20 20:05:03 +03:00
commit 0f7937d9b1
9 changed files with 69 additions and 0 deletions

8
tests/conftest.py Normal file
View File

@@ -0,0 +1,8 @@
import pytest
from chainlib.eth.connection import (
EthHTTPConnection
)
from chainlib_eth_celo import CeloUtil
def pytest_configure():
pytest.conn = EthHTTPConnection(url='https://rpc.celo.grassecon.net', chain_spec=CeloUtil.CHAIN_SPEC)

34
tests/test_e2e.py Normal file
View File

@@ -0,0 +1,34 @@
import logging
import pytest
from chainlib.eth.tx import (
transaction,
receipt,
Tx
)
from chainlib.eth.block import (
block_by_number,
Block
)
from chainlib_eth_celo import CeloBlockDialectFilter
logg = logging.getLogger(__name__)
def test_fetch_tx():
block = 15_237_555
hash = '0xd50cff848bc7ee304bab4763d3dcc00e6c900e1bdb955bfa836ad1ba2d74dde2'
block_query = block_by_number(block, include_tx=True)
block_resp = pytest.conn.do(block_query)
parsed_block = Block(block_resp, dialect_filter=CeloBlockDialectFilter())
tx_query = transaction(hash)
tx_resp = pytest.conn.do(tx_query)
receipt_query = receipt(hash)
tx_receipt_resp = pytest.conn.do(receipt_query)
full_parsed_tx = Tx(tx_resp, rcpt=tx_receipt_resp, block=parsed_block)
logg.debug('full_parsed_tx: \n{}'.format(full_parsed_tx.to_human()))
assert full_parsed_tx != None