From 6fc6c6e6814673d246a206e3cc381f71c32a8af9 Mon Sep 17 00:00:00 2001 From: MananTank Date: Wed, 12 Mar 2025 19:26:29 +0000 Subject: [PATCH] Portal: Fix knip lint error - Delete AAChainList (#6468) --- .../src/components/Document/AAChainList.tsx | 59 ------------------- apps/portal/src/components/Document/index.ts | 1 - 2 files changed, 60 deletions(-) delete mode 100644 apps/portal/src/components/Document/AAChainList.tsx diff --git a/apps/portal/src/components/Document/AAChainList.tsx b/apps/portal/src/components/Document/AAChainList.tsx deleted file mode 100644 index 357928def46..00000000000 --- a/apps/portal/src/components/Document/AAChainList.tsx +++ /dev/null @@ -1,59 +0,0 @@ -/* eslint-disable @next/next/no-img-element */ -import { cn } from "@/lib/utils"; -import type { ChainMetadata } from "thirdweb/chains"; - -type ApiResponseType = { - data: Record; -}; - -async function getChains(): Promise { - try { - const [chainsWithServices, allChains] = await Promise.all([ - fetch("https://api.thirdweb.com/v1/chains/services", { - headers: { - "Content-Type": "application/json", - }, - }).then((res) => res.json() as Promise), - fetch("https://api.thirdweb.com/v1/chains", { - headers: { - "Content-Type": "application/json", - }, - }).then((res) => res.json() as Promise<{ data: ChainMetadata[] }>), - ]); - - const aaChains = Object.entries(chainsWithServices.data) - .filter(([, services]) => - services.some( - (service) => - service.service === "account-abstraction" && service.enabled, - ), - ) - .map(([chainId]) => Number(chainId)); - - const intersectedChains = allChains.data - .filter((chain) => - aaChains.some((aaChainId) => aaChainId === chain.chainId), - ) - .filter((c) => c.name) - .sort((a, b) => a.name.localeCompare(b.name)); - return intersectedChains; - } catch (error) { - console.error("Failed to fetch chains", error); - throw error; - } -} - -export async function AAChainList() { - const chains = await getChains(); - return ( -
-
    - {chains?.map((chain) => ( -
  • - {chain.name} ({chain.chainId}) -
  • - ))} -
-
- ); -} diff --git a/apps/portal/src/components/Document/index.ts b/apps/portal/src/components/Document/index.ts index 29e1d6eaead..2ac190059a0 100644 --- a/apps/portal/src/components/Document/index.ts +++ b/apps/portal/src/components/Document/index.ts @@ -24,7 +24,6 @@ export { ExpandableGrid } from "./ExpandableGrid"; export { Stack } from "./Stack"; export { createMetadata } from "./metadata"; export { ConnectCard } from "./Cards/ConnectCard"; -export { AAChainList } from "./AAChainList"; export { AuthList } from "./AuthList"; export { FeatureCard } from "./FeatureCard"; export { ApiEndpoint } from "./APIEndpointMeta/ApiEndpoint";