From 7a9dd3c519d472be033a6ab5b6f68faeabd6100b Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 4 Dec 2021 16:33:07 -0300 Subject: [PATCH] Move hook --- src/hooks.ts | 16 +++++++++++----- src/sourcify/useSourcify.ts | 9 --------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/hooks.ts b/src/hooks.ts index a81f10b..e924314 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -1,13 +1,19 @@ +import { useMemo } from "react"; import { JsonRpcProvider } from "@ethersproject/providers"; import { ChecksummedAddress } from "./types"; -import { - Metadata, - useDedupedAddresses, - useMultipleMetadata, -} from "./sourcify/useSourcify"; +import { Metadata, useMultipleMetadata } from "./sourcify/useSourcify"; import { useAppConfigContext } from "./useAppConfig"; import { useAddressesWithCode } from "./useErigonHooks"; +export const useDedupedAddresses = ( + addresses: ChecksummedAddress[] +): ChecksummedAddress[] => { + return useMemo(() => { + const deduped = new Set(addresses); + return [...deduped]; + }, [addresses]); +}; + export const useContractsMetadata = ( addresses: ChecksummedAddress[], provider: JsonRpcProvider | undefined, diff --git a/src/sourcify/useSourcify.ts b/src/sourcify/useSourcify.ts index e210ea0..f5fae67 100644 --- a/src/sourcify/useSourcify.ts +++ b/src/sourcify/useSourcify.ts @@ -121,15 +121,6 @@ export const useSourcify = ( return rawMetadata; }; -export const useDedupedAddresses = ( - addresses: ChecksummedAddress[] -): ChecksummedAddress[] => { - return useMemo(() => { - const deduped = new Set(addresses); - return [...deduped]; - }, [addresses]); -}; - export const useMultipleMetadata = ( baseMetadatas: Record | undefined, addresses: ChecksummedAddress[] | undefined,