📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

use-ens

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-ens

A React hook to fetch ENS records from a domain.

0.0.0-wip.12
Source
npm
Version published
Weekly downloads
8
-61.9%
Maintainers
1
Weekly downloads
 
Created
Source

use-ens

A React hook to fetch ENS records from a domain.

Install

pnpm i use-ens

Example

CodeSandbox

import React, { useEffect } from 'react'
import { useWeb3React } from '@web3-react/core'
import { useENS } from 'use-ens'

const App = () => {
  const { provider, activate } = useWeb3React()

  useEffect(() => {
      injected.isAuthorized().then((isAuth) => {
        if (isAuth) activate(injected)
      })
    }, [])

  const { address, records } = useENS(provider, 'dame.eth')

  return (
    <>
      <p>Address: {address ? address : ''}</p>
      <p>ENS Records</p>
      <ul>
        {records.web && Object.entries(records.web).map(([k, v]) => (
          <li>
            {k}: {v}
          </li>
        ))}
      </ul>
      {!active && <button onClick={() => activate(injected)}>Connect<button>}
    </>
  )
}

Keywords

ens

FAQs

Package last updated on 21 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts