43
ENS Javascript/Typescript library
source link: https://www.tuicool.com/articles/uiMjeqR
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Whois ENS API library
Lightweight library with minimum dependencies to work with ENS. Get owner/controller info, date expiration, resolve name/addresses.
Works both on browser and Node.js.
Library used by Whois ENS
Install
npm i whoisens-lib
Use
// In case running on Node.js, install and export globally `fetch` import fetch from 'node-fetch'; global.fetch = fetch; const networkName = 'mainnet'; const networkURL = 'https://eth.gateway.whoisens.org'; // or infura https://${networkName}.infura.io/v3/<YOUR_KEY_HERE> // get name owner (registrar) const ens = new ENS(networkName, networkURL); await ens.init('whoisens.eth'); const result = await ens.getOwner(); // get name expiration date const result = await ens.getExpirationDate(); // get controller const result = await ens.getController(); // resolve name or address const result = await ens.resolve(); // get content hash const result = await ens.getContentHash();
Build (for development)
npm ci npm build:watch
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK