Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
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 - npm Package Compare versions

Comparing version 0.0.0-wip.11 to 0.0.0-wip.12

9

dist/index.d.ts
import { ResolvedENS } from 'get-ens';
import type { BaseProvider as Provider } from '@ethersproject/providers';
/**

@@ -8,2 +9,8 @@ * A React hook to fetch ENS records from a domain.

*/
export declare const useENS: (provider: any, domain: string) => ResolvedENS;
export declare const useENS: ({ provider, domain, fetchOptions, contractAddress, cache }: {
provider: Provider;
domain: string;
fetchOptions?: RequestInit;
contractAddress?: string;
cache?: boolean;
}) => ResolvedENS;

2

dist/index.js

@@ -1,1 +0,1 @@

import{useState as r,useEffect as e}from"react";import{getENS as o}from"get-ens";const t=(t,n)=>{const[s,c]=r({address:null,owner:null,records:{web:{}}});return e((()=>{t&&n&&o(t)(n).then(c)}),[n,t]),s};export{t as useENS};
import{useState,useEffect}from"react";import{getENS}from"get-ens";const useENS=({provider:provider,domain:domain,fetchOptions:fetchOptions,contractAddress:contractAddress,cache:cache})=>{const[data,set]=useState({address:null,owner:null,records:{}});return useEffect((()=>{if(cache)try{const cachedData=JSON.parse(localStorage.getItem(`use-ens-${domain}`));set(cachedData)}catch{}else provider&&domain&&provider.getNetwork().then((({chainId:chainId})=>{(contractAddress||1===chainId)&&getENS(provider,contractAddress)(domain,fetchOptions).then((data=>{cache&&localStorage.setItem(`use-ens-${domain}`,JSON.stringify(data)),set(data)}))}))}),[cache,contractAddress,domain,fetchOptions,provider]),data};export{useENS};
{
"name": "use-ens",
"version": "0.0.0-wip.11",
"description": "A React hook to fetch ENS data",
"version": "0.0.0-wip.12",
"description": "A React hook to fetch ENS records from a domain.",
"files": [

@@ -25,3 +25,3 @@ "dist"

"dependencies": {
"get-ens": "^1.0.0"
"get-ens": "^2.0.0"
},

@@ -34,4 +34,5 @@ "peerDependencies": {

"build": "rollup -c ../../rollup.config.js",
"build:watch": "rollup -c ../../rollup.config.js -w"
"build:watch": "rollup -c ../../rollup.config.js -w",
"postinstall": "pnpm build"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc