Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #66 from ca11ab1e/fix-conversion-ecosystem-pollution
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Jul 11, 2022
2 parents 23c3525 + a78070a commit 6a9b090
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ape_starknet/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ape.api import ConverterAPI
from ape.types import AddressType

from ape_starknet.utils import is_checksum_address, is_hex_address, to_checksum_address
from ape_starknet.utils import PLUGIN_NAME, is_checksum_address, is_hex_address, to_checksum_address


# NOTE: This utility converter ensures that all bytes args can accept hex too
Expand All @@ -13,7 +13,14 @@ class StarknetAddressConverter(ConverterAPI):
"""

def is_convertible(self, value: Any) -> bool:
return isinstance(value, str) and is_hex_address(value) and not is_checksum_address(value)
provider = self.network_manager.active_provider
return (
provider is not None
and provider.network.ecosystem.name == PLUGIN_NAME
and isinstance(value, str)
and is_hex_address(value)
and not is_checksum_address(value)
)

def convert(self, value: str) -> AddressType:
"""
Expand Down

0 comments on commit 6a9b090

Please sign in to comment.