public async ValueTask <(string Registrant, ulong TimeToLive, string Resolver, string Contract)> ResolveAsync(string Domain) { if (!Domain.EndsWith(".eth", StringComparison.InvariantCultureIgnoreCase)) { throw new NotImplementedException($"Only .ETH Top-Level Domain is Supported."); } var NameHashString = EnsUtil.GetNameHash(Domain); var NameHashBytes = NameHashString.HexToByteArray(); var TimeToLive = await GetTimeToLiveAsync(NameHashBytes); var ResolverFunction = new ResolverFunction() { Node = NameHashBytes }; //get the resolver address from ENS var Resolver = await ENSRegistryService.ResolverQueryAsync(ResolverFunction); var OwnerFunction = new OwnerFunction() { Node = NameHashBytes }; var Registrant = await ENSRegistryService.OwnerQueryAsync(OwnerFunction); var ResolverService = new PublicResolverService(Web3, Resolver); //and get the address from the resolver var Contract = await ResolverService.AddrQueryAsync(NameHashBytes); return(Registrant, TimeToLive, Resolver, Contract); }
private async ValueTask <string> GetRegistrantAddress(string Domain) { var NameHashString = EnsUtil.GetNameHash(Domain); var NameHashBytes = NameHashString.HexToByteArray(); var OwnerFunction = new OwnerFunction() { Node = NameHashBytes }; return(await ENSRegistryService.OwnerQueryAsync(OwnerFunction)); }