Comparing version 0.0.0-wip.11 to 0.0.0-wip.12
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; |
@@ -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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2899
18
0
1
+ Addedget-ens@2.1.1(transitive)
- Removedget-ens@1.0.2(transitive)
- Removedkeccak@3.0.4(transitive)
- Removednode-addon-api@2.0.2(transitive)
- Removednode-gyp-build@4.8.4(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedget-ens@^2.0.0