def resolve(self, name, get='addr'): normal_name = normalize_name(name) resolver = self.resolver(normal_name) if resolver: lookup_function = getattr(resolver, get) namehash = name_to_hash(normal_name) return lookup_function(namehash) else: return None
def main(args): keydata = json.loads(args.keyfile.read()) acct = Account.privateKeyToAccount(keydata['key']) nonce = get_nonce(args.url, args.domain) sig = sign_associate_request(acct, name_to_hash(args.domain), args.address, nonce) response = requests.post(args.url + "v2/associate", headers={"Content-Type": "application/json"}, data=json.dumps({ 'domain': args.domain, 'owner': args.address, 'nonce': nonce, 'signature': sig, })) if response.status_code != 200: logging.error("Server returned %d: %s", response.status_code, response.json()['error']['message']) return print(response.json()['result'])
def _reverse_registrar(self): addr = self.ens.owner(name_to_hash(REVERSE_REGISTRAR_DOMAIN)) return self.web3.eth.contract(address=addr, abi=abis.REVERSE_REGISTRAR)
def resolver(self, normal_name): resolver_addr = self.ens.resolver(name_to_hash(normal_name)) if not resolver_addr: return None return self._resolverContract(address=resolver_addr)