diff --git a/ape_alchemy/provider.py b/ape_alchemy/provider.py index 0b94ab4..570bf65 100644 --- a/ape_alchemy/provider.py +++ b/ape_alchemy/provider.py @@ -12,7 +12,6 @@ from ape.logging import logger from ape.types import BlockID from ape_ethereum.provider import Web3Provider -from ape_ethereum.trace import TransactionTrace from ape_ethereum.transactions import AccessList from eth_pydantic_types import HexBytes from eth_typing import HexStr diff --git a/ape_alchemy/trace.py b/ape_alchemy/trace.py index c0d4426..5b5fe1a 100644 --- a/ape_alchemy/trace.py +++ b/ape_alchemy/trace.py @@ -1,9 +1,8 @@ from functools import cached_property from typing import Any, Optional -from hexbytes import HexBytes -from ape_ethereum.trace import TransactionTrace, TraceApproach -from evm_trace import CallTreeNode +from ape_ethereum.trace import TraceApproach, TransactionTrace +from hexbytes import HexBytes class AlchemyTransactionTrace(TransactionTrace): diff --git a/tests/test_trace.py b/tests/test_trace.py new file mode 100644 index 0000000..2fdac80 --- /dev/null +++ b/tests/test_trace.py @@ -0,0 +1,24 @@ +import pytest +from ape import chain, networks + + +@pytest.fixture(autouse=True) +def ethereum_mainnet_alchemy(): + with networks.ethereum.mainnet.use_provider("alchemy"): + yield + + +def test_revert_message(): + txn_hash = "0x36144f609e0fc7afd3cc570d6a54582091642a44c5223a5ad59aa20008dd9577" + receipt = chain.history[txn_hash] + actual = receipt.trace.revert_message + expected = "UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT" + assert actual == expected + + +def test_return_value(): + txn_hash = "0xe0897d735b67893648b20085ecef16232733425329df844292d5b2774cca436b" + receipt = chain.history[txn_hash] + actual = receipt.return_value + expected = 1244617160572980465 + assert actual == expected