Skip to content

Commit

Permalink
feat: add .history property to BaseAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Feb 16, 2023
1 parent 4836a7e commit e4a6f01
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/ape/api/address.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from typing import Any, List
from typing import TYPE_CHECKING, Any, List

from hexbytes import HexBytes

from ape.exceptions import ConversionError
from ape.types import AddressType, ContractCode
from ape.utils import BaseInterface, abstractmethod
from ape.utils import BaseInterface, abstractmethod, cached_property

if TYPE_CHECKING:
from ape.managers.chain import AccountHistory


class BaseAddress(BaseInterface):
Expand Down Expand Up @@ -133,6 +136,13 @@ def is_contract(self) -> bool:

return len(HexBytes(self.code)) > 0

@cached_property
def history(self) -> "AccountHistory":
"""
The list of transactions that this account has made on the current chain.
"""
return self.chain_manager.history[self.address]


class Address(BaseAddress):
"""
Expand Down

0 comments on commit e4a6f01

Please sign in to comment.