1.0.0 • Published 3 years ago

@ensdomains/reverse-records v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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