tokfetch/ethereum/utils.py
def validate_ethereum_address(address: str):
    """Clever Ethereum address validator.

    Assume all lowercase addresses are not checksummed.
    """

    if len(address) < 42:
        raise ValueError("Not an Ethereum address: {}".format(address))

    try:
        if not is_hex_address(address):
            raise ValueError("Not an Ethereum address: {}".format(address))
    except UnicodeEncodeError:
        raise ValueError("Could not decode: {}".format(address))

    # Check if checksummed address if any of the letters is upper case
    if any([c.isupper() for c in address]):
        if not is_checksum_address(address):
            raise ValueError("Not a checksummed Ethereum address: {}".format(address))
Clever Ethereum address validator.

    Assume all lowercase addresses are not checksummed.
    
Clever Ethereum address validator.
Assume all lowercase addresses are not checksummed.
Clever Ethereum address validator . Assume all lowercase addresses are not checksummed .
def validate_ethereum_address(address: str):
    if len(address) < 42:
        raise ValueError("Not an Ethereum address: {}".format(address))
    try:
        if not is_hex_address(address):
            raise ValueError("Not an Ethereum address: {}".format(address))
    except UnicodeEncodeError:
        raise ValueError("Could not decode: {}".format(address))
    if any([c.isupper() for c in address]):
        if not is_checksum_address(address):
            raise ValueError("Not a checksummed Ethereum address: {}".format(address))
def validate_ethereum_address ( address : str ) : if len ( address ) < 42 : raise ValueError ( "Not an Ethereum address: {}" . format ( address ) ) try : if not is_hex_address ( address ) : raise ValueError ( "Not an Ethereum address: {}" . format ( address ) ) except UnicodeEncodeError : raise ValueError ( "Could not decode: {}" . format ( address ) ) if any ( [ c . isupper ( ) for c in address ] ) : if not is_checksum_address ( address ) : raise ValueError ( "Not a checksummed Ethereum address: {}" . format ( address ) )
Clever Ethereum address validator.
Clever Ethereum address validator .
"""Clever Ethereum address validator.

    Assume all lowercase addresses are not checksummed.
    """ # Check if checksummed address if any of the letters is upper case
address
str