Skip to content

Commit

Permalink
refactor: make config at root lvl
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Feb 22, 2025
1 parent 0939964 commit bd53f91
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
5 changes: 2 additions & 3 deletions src/ape/api/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ def to_string(self, calldata_repr: Optional["CalldataRepr"] = None) -> str:
Args:
calldata_repr (:class:`~ape.types.abi.CalldataRepr` | None): Pass "full"
to see the full caldata. Defaults to the value from the config
(``accounts.calldata_repr``).
to see the full calldata. Defaults to the value from the config.
Returns:
str
Expand All @@ -202,7 +201,7 @@ def to_string(self, calldata_repr: Optional["CalldataRepr"] = None) -> str:

if calldata_repr is None:
# If was not specified, use the default value from the config.
calldata_repr = self.config_manager.accounts.calldata_repr
calldata_repr = self.local_project.config.calldata_repr

if calldata_repr == "full" or len(data["data"]) <= 9:
data["data"] = (
Expand Down
9 changes: 1 addition & 8 deletions src/ape_accounts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
from importlib import import_module

from ape.plugins import AccountPlugin, Config, register


@register(Config)
def config_class():
from ape_accounts.config import AccountsConfig

return AccountsConfig
from ape.plugins import AccountPlugin, register


@register(AccountPlugin)
Expand Down
15 changes: 0 additions & 15 deletions src/ape_accounts/config.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/functional/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,15 @@ def test_str_when_data_is_long_shows_first_4_bytes(vyper_contract_instance):
assert "data: 0x30783366..." in actual


def test_str_when_data_is_long_and_accounts_configure_full_calldata(
def test_str_when_data_is_long_and_configured_full_calldata(
project, vyper_contract_instance
):
"""
Tests against a condition that would cause transactions to
fail with string-encoding errors.
"""
txn = vyper_contract_instance.setNumber.as_transaction(123)
with project.temp_config(accounts={"calldata_repr": "full"}):
with project.temp_config(calldata_repr="full"):
actual = str(txn)

expected = (
Expand Down

0 comments on commit bd53f91

Please sign in to comment.