diff --git a/packages/nextjs/scaffold.config.ts b/packages/nextjs/scaffold.config.ts index 35964008..e0102e6a 100644 --- a/packages/nextjs/scaffold.config.ts +++ b/packages/nextjs/scaffold.config.ts @@ -23,10 +23,16 @@ const scaffoldConfig = { chains.goerli, chains.optimism, chains.optimismGoerli, + chains.base, + chains.baseSepolia, chains.polygon, chains.polygonMumbai, chains.arbitrum, chains.gnosis, + chains.zkSync, + chains.zkSyncTestnet, + chains.scroll, + chains.scrollSepolia, ], // The interval at which your front-end polls the RPC servers for new data diff --git a/packages/nextjs/utils/abi.ts b/packages/nextjs/utils/abi.ts index 830b582c..1d223e7c 100644 --- a/packages/nextjs/utils/abi.ts +++ b/packages/nextjs/utils/abi.ts @@ -1,7 +1,7 @@ -import { NETWORKS_EXTRA_DATA } from "./scaffold-eth"; +import { NETWORKS_EXTRA_DATA, getTargetNetworks } from "./scaffold-eth"; export const fetchContractABIFromAnyABI = async (verifiedContractAddress: string, chainId: number) => { - const chain = NETWORKS_EXTRA_DATA[chainId]; + const chain = getTargetNetworks().find(network => network.id === chainId); if (!chain) throw new Error(`ChainId ${chainId} not found in supported networks`); @@ -21,7 +21,7 @@ export const fetchContractABIFromEtherscan = async (verifiedContractAddress: str const chain = NETWORKS_EXTRA_DATA[chainId]; if (!chain || (chain && !chain.etherscanApiKey) || !chain.etherscanEndpoint) - throw new Error(`ChainId ${chainId} not found in supported networks`); + throw new Error(`ChainId ${chainId} not found in supported etherscan networks`); const apiKey = chain.etherscanApiKey; const url = `${chain.etherscanEndpoint}/api?module=contract&action=getabi&address=${verifiedContractAddress}&apikey=${apiKey}`; diff --git a/packages/nextjs/utils/scaffold-eth/networks.ts b/packages/nextjs/utils/scaffold-eth/networks.ts index 44042814..d7f5d1c7 100644 --- a/packages/nextjs/utils/scaffold-eth/networks.ts +++ b/packages/nextjs/utils/scaffold-eth/networks.ts @@ -17,6 +17,9 @@ const MAINNET_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_ETHERSCAN_API_KEY || " const OPTIMISM_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_OPTIMISM_ETHERSCAN_API_KEY || ""; const POLYGON_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_POLYGON_ETHERSCAN_API_KEY || ""; const ARBITRUM_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_ARBITRUM_ETHERSCAN_API_KEY || ""; +const ZKSYNC_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_ZKSYNC_ETHERSCAN_API_KEY || ""; +const BASE_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_BASE_ETHERSCAN_API_KEY || ""; +const SCROLL_ETHERSCAN_API_KEY = process.env.NEXT_PUBLIC_SCROLL_ETHERSCAN_API_KEY || ""; export const NETWORKS_EXTRA_DATA: Record = { [chains.hardhat.id]: { @@ -72,14 +75,34 @@ export const NETWORKS_EXTRA_DATA: Record = { etherscanEndpoint: "https://api.arbiscan.io", etherscanApiKey: ARBITRUM_ETHERSCAN_API_KEY, }, - [chains.fantom.id]: { - color: "#1969ff", + [chains.zkSync.id]: { + color: "#5f4bb6", + etherscanEndpoint: "https://block-explorer-api.mainnet.zksync.io", + etherscanApiKey: ZKSYNC_ETHERSCAN_API_KEY, }, - [chains.fantomTestnet.id]: { - color: "#1969ff", + [chains.zkSyncTestnet.id]: { + color: "#5f4bb6", + etherscanEndpoint: "https://block-explorer-api.testnets.zksync.dev", + etherscanApiKey: ZKSYNC_ETHERSCAN_API_KEY, + }, + [chains.base.id]: { + color: "#1450EE", + etherscanEndpoint: "https://api-sepolia.basescan.org", + etherscanApiKey: BASE_ETHERSCAN_API_KEY, + }, + [chains.baseSepolia.id]: { + color: "#1450EE", + etherscanApiKey: BASE_ETHERSCAN_API_KEY, + }, + [chains.scroll.id]: { + color: "#fbebd4", + etherscanEndpoint: "https://api.scrollscan.com", + etherscanApiKey: SCROLL_ETHERSCAN_API_KEY, }, [chains.scrollSepolia.id]: { color: "#fbebd4", + etherscanEndpoint: "https://api-sepolia.scrollscan.com", + etherscanApiKey: SCROLL_ETHERSCAN_API_KEY, }, };