|
37 | 37 | ) |
38 | 38 | from .factory import SafeFactory |
39 | 39 | from .modules import SafeModuleManager |
40 | | -from .packages import PackageType |
| 40 | +from .packages import MANIFESTS_BY_VERSION, PackageType |
41 | 41 | from .types import SafeCacheData |
42 | 42 | from .utils import encode_signatures, get_safe_tx_hash |
43 | 43 |
|
@@ -199,6 +199,7 @@ def _safe_tx_exec_args(safe_tx: SafeTx) -> list: |
199 | 199 | class SafeAccount(AccountAPI): |
200 | 200 | account_file_path: Path # NOTE: Cache any relevant data here |
201 | 201 | _factory: ClassVar[SafeFactory] = SafeFactory() |
| 202 | + _warn_supported_version: ClassVar[bool] = True |
202 | 203 |
|
203 | 204 | def __dir__(self) -> list[str]: |
204 | 205 | return [ |
@@ -350,11 +351,19 @@ def version(self) -> Version: |
350 | 351 | outputs=[ABIType(type="string")], |
351 | 352 | ) |
352 | 353 |
|
353 | | - if isinstance(version := ContractCall(VERSION_ABI, address=self.address)(), str): |
354 | | - return Version(version) |
| 354 | + if not isinstance(version := ContractCall(VERSION_ABI, address=self.address)(), str): |
| 355 | + # NOTE: If `eth_call` returns nothing, the safe is likely not on the correct network |
| 356 | + raise NoVersionDetected(self.address) |
355 | 357 |
|
356 | | - # NOTE: If `eth_call` returns nothing, the safe is likely not on the correct network |
357 | | - raise NoVersionDetected(self.address) |
| 358 | + elif version not in MANIFESTS_BY_VERSION and self._warn_supported_version: |
| 359 | + supported_versions = "', 'v".join(map(str, MANIFESTS_BY_VERSION)) |
| 360 | + logger.warning( |
| 361 | + f"'v{version}' is not a version supported by this library, " |
| 362 | + f"consider migrating to one of {supported_versions}" |
| 363 | + ) |
| 364 | + self.__class__._warn_supported_version = False |
| 365 | + |
| 366 | + return Version(version) |
358 | 367 |
|
359 | 368 | @property |
360 | 369 | def signers(self) -> list[AddressType]: |
|
0 commit comments