christopherdro / get-ens

πŸ—οΈ Get text records of an ENS address with ease

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


get-ens

Version Downloads GitHub Workflow Status Codecov

Get text records of an ENS address with ease.

This library simplifies the process of retreiving ENS data with the help of TheGraph ENS explorer and ENS TextResolver contract.

Features

  • Good types
  • Custom ENS contract address support
  • Reverse ENS lookup

Install

pnpm i get-ens

Usage

Node.js

import { getDefaultProvider } from '@ethersproject/providers'
import { getENS } from 'get-ens'
import fetch from 'node-fetch'

const provider = getDefaultProvider()

// @ts-ignore
globalThis.fetch = fetch

const { address, records, owner } = await getENS(provider)('foda.eth')

/*
{
  address: '0xf75ed978170dfa5ee3d71d95979a34c91cd7042e',
  owner: '0xf75ed978170dfa5ee3d71d95979a34c91cd7042e',
  records: {
    avatar: 'https://slate.textile.io/ipfs/bafkreiddogjj5m6nhru72cqvj7napv3knwyqcvxlfxu4axkwhhlg55t5cu',
    color: '#f0da91',
    description: 'β“•β„’',
    email: 'foda@just.is',
    url: 'https://asf.is',
    web: {
      github: 'https://github.com/a-s-f',
      instagram: 'https://instagram.com/foda.farm',
      twitter: 'twitter.com/fodasynthesis'
    }
  }
}
*/

Deno

import { getENS } from 'https://esm.sh/get-ens'
import { getDefaultProvider } from 'https://esm.sh/@ethersproject/providers'

const provider = getDefaultProvider()

const { address, records, owner } = await getENS(provider)('foda.eth')

About

πŸ—οΈ Get text records of an ENS address with ease

License:MIT License


Languages

Language:TypeScript 89.4%Language:JavaScript 9.3%Language:Shell 1.4%