From a92f2ba00fe75ed3396bd4eeba35ab752f9360d5 Mon Sep 17 00:00:00 2001 From: antazoey Date: Thu, 18 Apr 2024 12:22:54 -0600 Subject: [PATCH] refactor!: TraceAPI (#1864) --- src/ape_ethereum/ecosystem.py | 3 +-- src/ape_ethereum/provider.py | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ape_ethereum/ecosystem.py b/src/ape_ethereum/ecosystem.py index 3270897bfa..6a2cda48d5 100644 --- a/src/ape_ethereum/ecosystem.py +++ b/src/ape_ethereum/ecosystem.py @@ -1,8 +1,7 @@ import re -from collections.abc import Iterator, Sequence from decimal import Decimal from functools import cached_property -from typing import Any, ClassVar, Optional, Union, cast +from typing import Any, ClassVar, Iterator, Optional, Sequence, Union, cast from eth_abi import decode, encode from eth_abi.exceptions import InsufficientDataBytes, NonEmptyPaddingBytes diff --git a/src/ape_ethereum/provider.py b/src/ape_ethereum/provider.py index 48241ee9f4..f23931741c 100644 --- a/src/ape_ethereum/provider.py +++ b/src/ape_ethereum/provider.py @@ -3,12 +3,11 @@ import sys import time from abc import ABC -from collections.abc import Iterator from concurrent.futures import ThreadPoolExecutor from copy import copy from functools import cached_property, wraps from pathlib import Path -from typing import Any, Iterable, Optional, Union, cast +from typing import Any, Iterable, Iterator, Optional, Union, cast import ijson # type: ignore import requests @@ -480,8 +479,10 @@ def _eth_call(self, arguments: list) -> HexBytes: return HexBytes(result) - def _prepare_call(self, txn: TransactionAPI, **kwargs) -> list: - txn_dict = txn.model_dump(by_alias=True, mode="json") + def _prepare_call(self, txn: Union[TransactionAPI, dict], **kwargs) -> list: + txn_dict = ( + txn.model_dump(by_alias=True, mode="json") if isinstance(txn, TransactionAPI) else txn + ) fields_to_convert = ("data", "chainId", "value") for field in fields_to_convert: value = txn_dict.get(field)