New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.5 to 0.0.6

5

dist/index.d.ts

@@ -5,2 +5,3 @@ import { ResolvedENS } from 'get-ens';

provider: Provider;
chainId: number;
domain: string;

@@ -12,6 +13,4 @@ fetchOptions?: RequestInit;

* A React hook to fetch ENS records from a domain.
* @param provider Ethers.js provider
* @param domain ENS domain to fetch data from
* @returns
*/
export declare const useENS: ({ provider, domain, fetchOptions, contractAddress }: UseENSOptions) => ResolvedENS;
export declare const useENS: ({ provider, domain, fetchOptions, contractAddress, chainId }: UseENSOptions) => ResolvedENS;

19

dist/index.js

@@ -6,11 +6,9 @@ import { useState, useEffect } from 'react';

* A React hook to fetch ENS records from a domain.
* @param provider Ethers.js provider
* @param domain ENS domain to fetch data from
* @returns
*/
const useENS = ({ provider, domain, fetchOptions, contractAddress }) => {
const useENS = ({ provider, domain, fetchOptions, contractAddress, chainId }) => {
const [data, set] = useState({ address: null, owner: null, records: {}, domain: '' });
useEffect(() => {
if (provider && domain) {
provider.getNetwork().then(({ chainId }) => {
if (provider && domain && data.address !== null) {
if (chainId) {
if (contractAddress || chainId === 1) {

@@ -21,3 +19,12 @@ getENS(provider, contractAddress)(domain, fetchOptions).then((data) => {

}
});
}
else {
provider.getNetwork().then(({ chainId }) => {
if (contractAddress || chainId === 1) {
getENS(provider, contractAddress)(domain, fetchOptions).then((data) => {
set(data);
});
}
});
}
}

@@ -24,0 +31,0 @@ }, [contractAddress, domain, fetchOptions]);

{
"name": "use-ens",
"version": "0.0.5",
"version": "0.0.6",
"description": "A React hook to fetch ENS records from a domain.",

@@ -5,0 +5,0 @@ "files": [

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