diff --git a/src/_algopy_testing/models/application.py b/src/_algopy_testing/models/application.py index f910435..bfa5ff4 100644 --- a/src/_algopy_testing/models/application.py +++ b/src/_algopy_testing/models/application.py @@ -2,6 +2,8 @@ import typing +import algosdk.logic + from _algopy_testing.primitives import UInt64 from _algopy_testing.protocols import UInt64Backed from _algopy_testing.utils import as_int64 @@ -23,7 +25,6 @@ class ApplicationFields(typing.TypedDict, total=False): local_num_bytes: algopy.UInt64 extra_program_pages: algopy.UInt64 creator: algopy.Account - address: algopy.Account AccountKey = str @@ -57,6 +58,13 @@ def __init__(self, application_id: algopy.UInt64 | int = 0, /): def id(self) -> algopy.UInt64: return UInt64(self._id) + @property + def address(self) -> algopy.Account: + from _algopy_testing.models import Account + + address = algosdk.logic.get_application_address(self._id) + return Account(address) + @property def int_(self) -> int: return self._id diff --git a/src/_algopy_testing/value_generators/avm.py b/src/_algopy_testing/value_generators/avm.py index a876c67..96d59c1 100644 --- a/src/_algopy_testing/value_generators/avm.py +++ b/src/_algopy_testing/value_generators/avm.py @@ -143,10 +143,9 @@ def asset( lazy_context.ledger._asset_data[int(new_asset.id)] = AssetFields(**merged_fields) # type: ignore[typeddict-item] return new_asset - def application( # type: ignore[misc] + def application( self, id: int | None = None, - address: algopy.Account | None = None, logs: list[bytes] | None = None, # type: ignore[valid-type] **application_fields: typing.Unpack[ApplicationFields], ) -> algopy.Application: @@ -175,8 +174,6 @@ def application( # type: ignore[misc] "local_num_bytes": _algopy_testing.UInt64(0), "extra_program_pages": _algopy_testing.UInt64(0), "creator": lazy_context.value.default_sender, - "address": address - or _algopy_testing.Account(algosdk.logic.get_application_address(new_app_id)), } # Merge provided fields with defaults, prioritizing provided fields diff --git a/tests/test_op.py b/tests/test_op.py index dab9795..fc2a9ad 100644 --- a/tests/test_op.py +++ b/tests/test_op.py @@ -542,7 +542,6 @@ def test_app_params_get( local_num_bytes=algopy.UInt64(0), extra_program_pages=algopy.UInt64(0), creator=algopy.Account(get_localnet_default_account(algod_client).address), - address=algopy.Account(client.app_address), ) contract = StateAppParamsContract()