diff --git a/src/Ens.ts b/src/Ens.ts index 08586564..f5a52ed6 100644 --- a/src/Ens.ts +++ b/src/Ens.ts @@ -190,6 +190,7 @@ export default class Ens extends NamingService { // Current implementation uses reverseRegistrarContract to fetch the correct node hash. // @see: https://eips.ethereum.org/EIPS/eip-181 async reverseOf(address: string): Promise { + const originalAddress = address; if (address.startsWith('0x')) { address = address.substr(2); } @@ -225,7 +226,16 @@ export default class Ens extends NamingService { this.proxyServiceApiKey, ); - return await this.resolverCallToName(resolverContract, nodeHash); + const domainName = await this.resolverCallToName( + resolverContract, + nodeHash, + ); + const fetchedAddress = await this.addr(domainName, BlockchainType.ETH); + if (fetchedAddress?.toLowerCase() !== originalAddress.toLowerCase()) { + return null; + } + + return domainName; } async getTokenUri(domain: string): Promise {