@ensdomains/reverse-records

Returns multiple ENS reverse records with forward lookup check

Usage no npm install needed!

<script type="module">
  import ensdomainsReverseRecords from 'https://cdn.skypack.dev/@ensdomains/reverse-records';
</script>

README

Reverse records

How to setup

git clone https://github.com/ensdomains/reverse-records
cd reverse-records
cp env.example .env // Add your mnemonic, infura project id, and etherscan key
yarn

CLI

yarn query:ropsten 0x123...,0x234...

Smart contract API

getNames([address])

Returns an array of string. If the given address does not have a reverse record or forward record setup, it returns an empty string.

Usage note

Make sure to compare that the returned names match with the normalised names to prevent from homograph attack

Example

const namehash = require('eth-ens-namehash');
const allnames = await ReverseRecords.getNames(['0x123','0x124'])
const validNames = allnames.filter((n) => namehash.normalize(n) === n )

Deployed contract address