diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx index 11dabc68..e5a01f9d 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/NetworkOptions.tsx @@ -15,33 +15,35 @@ export const NetworkOptions = ({ hidden = false }: NetworkOptionsProps) => { const mainChainId = useAbiNinjaState(state => state.mainChainId); const chains = useGlobalState(state => state.chains); + const filteredChains = chains.filter(allowedNetwork => allowedNetwork.id === mainChainId); + // if chainId is 31337 we render one element, since viem chains have 3 chains with same chainId. + const networksToRender = mainChainId === 31337 ? [filteredChains[0]] : filteredChains; + return ( <> - {chains - .filter(allowedNetwork => allowedNetwork.id === mainChainId) - .map(allowedNetwork => ( -
  • - -
  • - ))} + + + + ))} ); }; diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 269c2c48..48bd960d 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -81,7 +81,7 @@ const Home: NextPage = () => { setContractAbi(contractData.abi); } - if (network === "31337") { + if (network === "31337" && isAddress(verifiedContractAddress)) { setActiveTab(TabName.addressAbi); setLocalAbiContractAddress(verifiedContractAddress); return; @@ -243,6 +243,7 @@ const Home: NextPage = () => {