def normalize_address(ens, address): if address: if is_ens_name(address): validate_name_has_address(ens, address) else: validate_address(address) return address
def normalize_address(ens, address): if address: if is_ens_name(address): validate_name_has_address(ens, address) else: validate_address(address) return address
def abi_ens_resolver(w3, abi_type, val): if abi_type == 'address' and is_ens_name(val): if w3 is None: raise InvalidAddress("Could not look up name, because no web3 connection available") elif w3.ens is None: raise InvalidAddress("Could not look up name, because ENS is set to None") else: return (abi_type, validate_name_has_address(w3.ens, val)) else: return (abi_type, val)
def normalize_property(cls, key, val): if key == 'abi': if isinstance(val, str): val = json.loads(val) validate_abi(val) return val elif key == 'address': if is_ens_name(val): validate_name_has_address(cls.web3.ens, val) return val else: validate_address(val) return to_checksum_address(val) elif key in { 'bytecode_runtime', 'bytecode', }: return HexBytes(val) else: return val
def normalize_property(cls, key, val): if key == 'abi': if isinstance(val, str): val = json.loads(val) validate_abi(val) return val elif key == 'address': if is_ens_name(val): validate_name_has_address(cls.web3.ens, val) return val else: validate_address(val) return to_checksum_address(val) elif key in { 'bytecode_runtime', 'bytecode', }: return HexBytes(val) else: return val
def abi_ens_resolver(w3, abi_type, val): if abi_type == 'address' and is_ens_name(val): if w3 is None: raise InvalidAddress("Could not look up name %r because no web3" " connection available" % (val)) elif w3.ens is None: raise InvalidAddress("Could not look up name %r because ENS is" " set to None" % (val)) elif int( w3.net.version) is not 1 and not isinstance(w3.ens, StaticENS): raise InvalidAddress("Could not look up name %r because web3 is" " not connected to mainnet" % (val)) else: return (abi_type, validate_name_has_address(w3.ens, val)) else: return (abi_type, val)