diff --git a/setup.py b/setup.py index 621d619dbe..13dff2745f 100644 --- a/setup.py +++ b/setup.py @@ -126,7 +126,7 @@ "eth-abi>=5.1.0,<6", "eth-account>=0.13.0,<0.14", "eth-typing>=4.1.0,<5", - "eth-utils", + "eth-utils>=4.1.0,<5", "hexbytes", # Peer "py-geth>=5.0.0-beta.2,<6", "trie>=3.0.0,<4", # Peer: stricter pin needed for uv support. diff --git a/src/ape/api/transactions.py b/src/ape/api/transactions.py index 356ace5770..6a6d2c9dcb 100644 --- a/src/ape/api/transactions.py +++ b/src/ape/api/transactions.py @@ -177,13 +177,13 @@ def __str__(self) -> str: if isinstance(data["data"], str): data["data"] = ( "0x" - + to_hex(bytes(data["data"][:3], encoding="utf8")) + + bytes(data["data"][:3], encoding="utf8").hex() + "..." - + to_hex(bytes(data["data"][-3:], encoding="utf8")) + + bytes(data["data"][-3:], encoding="utf8").hex() ) else: data["data"] = ( - to_hex(tbytes(data["data"][:3])) + "..." + to_hex(bytes(data["data"][-3:])) + to_hex(bytes(data["data"][:3])) + "..." + to_hex(bytes(data["data"][-3:])) ) else: if isinstance(data["data"], str): diff --git a/src/ape/utils/testing.py b/src/ape/utils/testing.py index 0282c425f8..6d85efed26 100644 --- a/src/ape/utils/testing.py +++ b/src/ape/utils/testing.py @@ -3,7 +3,6 @@ from eth_account import Account from eth_account.hdaccount import HDPath from eth_account.hdaccount.mnemonic import Mnemonic -from eth_pydantic_types import HexBytes from eth_utils import to_hex DEFAULT_NUMBER_OF_TEST_ACCOUNTS = 10 diff --git a/src/ape_accounts/accounts.py b/src/ape_accounts/accounts.py index 299ff33d2a..7cbebc059b 100644 --- a/src/ape_accounts/accounts.py +++ b/src/ape_accounts/accounts.py @@ -187,7 +187,7 @@ def sign_message(self, msg: Any, **signer_options) -> Optional[MessageSignature] if msg._verifyingContract_: display_msg += f"\tContract: {msg._verifyingContract_}\n" if msg._salt_: - display_msg += f"\tSalt: 0x{to_hex(msg._salt_)}\n" + display_msg += f"\tSalt: {to_hex(msg._salt_)}\n" # Message Data display_msg += "Message\n" diff --git a/src/ape_cache/models.py b/src/ape_cache/models.py index 7803e6d16f..c0b743cb32 100644 --- a/src/ape_cache/models.py +++ b/src/ape_cache/models.py @@ -1,4 +1,3 @@ -from eth_utils import to_hex from sqlalchemy import JSON, BigInteger, Column, ForeignKey, Integer, LargeBinary, Numeric from sqlalchemy.types import String, TypeDecorator @@ -15,10 +14,10 @@ class HexByteString(TypeDecorator): def process_bind_param(self, value, dialect): if isinstance(value, bytes): - return to_hex(value) + return value.hex() elif isinstance(value, str): - return to_hex(bytes.fromhex(value.replace("0x", "").lower())) + return bytes.fromhex(value.replace("0x", "").lower()).hex() else: raise TypeError(f"HexByteString columns support only bytes values: {value}") diff --git a/src/ape_ethereum/_print.py b/src/ape_ethereum/_print.py index 0596b7b4c1..e2fc56bc7a 100644 --- a/src/ape_ethereum/_print.py +++ b/src/ape_ethereum/_print.py @@ -23,7 +23,7 @@ from typing import Any, cast from eth_abi import decode -from eth_typing import ChecksumAddress, HexStr +from eth_typing import ChecksumAddress from eth_utils import add_0x_prefix, decode_hex, to_hex from ethpm_types import ContractType, MethodABI from evm_trace import CallTreeNode diff --git a/src/ape_ethereum/transactions.py b/src/ape_ethereum/transactions.py index f5346856b1..3d8b054875 100644 --- a/src/ape_ethereum/transactions.py +++ b/src/ape_ethereum/transactions.py @@ -10,7 +10,7 @@ serializable_unsigned_transaction_from_dict, ) from eth_pydantic_types import HexBytes -from eth_utils import decode_hex, encode_hex, keccak, to_int, to_hex +from eth_utils import decode_hex, encode_hex, keccak, to_hex, to_int from ethpm_types import ContractType from ethpm_types.abi import EventABI, MethodABI from pydantic import BaseModel, Field, field_validator, model_validator diff --git a/src/ape_node/provider.py b/src/ape_node/provider.py index 4b917b8f9f..6d8c13701c 100644 --- a/src/ape_node/provider.py +++ b/src/ape_node/provider.py @@ -4,8 +4,6 @@ from subprocess import DEVNULL, PIPE, Popen from typing import Any, Optional, Union -from eth_pydantic_types import HexBytes -from eth_typing import HexStr from eth_utils import add_0x_prefix, to_hex from evmchains import get_random_rpc from geth.chain import initialize_chain @@ -152,9 +150,7 @@ def from_uri(cls, uri: str, data_folder: Path, **kwargs): mnemonic = kwargs.get("mnemonic", DEFAULT_TEST_MNEMONIC) number_of_accounts = kwargs.get("number_of_accounts", DEFAULT_NUMBER_OF_TEST_ACCOUNTS) balance = kwargs.get("initial_balance", DEFAULT_TEST_ACCOUNT_BALANCE) - extra_accounts = [ - to_hex(a).lower() for a in kwargs.get("extra_funded_accounts", []) - ] + extra_accounts = [to_hex(a).lower() for a in kwargs.get("extra_funded_accounts", [])] return cls( data_folder, diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 36f6d447bc..54d35a170e 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -7,6 +7,7 @@ import pytest from eth_pydantic_types import HexBytes +from eth_utils import to_hex from ethpm_types import ContractType, ErrorABI, MethodABI from ethpm_types.abi import ABIType diff --git a/tests/functional/conversion/test_hex.py b/tests/functional/conversion/test_hex.py index 86eb204e10..c464fde189 100644 --- a/tests/functional/conversion/test_hex.py +++ b/tests/functional/conversion/test_hex.py @@ -1,5 +1,4 @@ import pytest -from eth_pydantic_types import HexBytes from eth_utils import to_hex from ape.exceptions import ConversionError