Skip to content

Commit

Permalink
refactor!: TraceAPI (ApeWorX#1864)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Apr 22, 2024
1 parent 8b42350 commit a92f2ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/ape_ethereum/ecosystem.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a92f2ba

Please sign in to comment.