diff --git a/src/widgets/Landing/ui/search-contract.tsx b/src/widgets/Landing/ui/search-contract.tsx index 41c35cb..c4ed44a 100644 --- a/src/widgets/Landing/ui/search-contract.tsx +++ b/src/widgets/Landing/ui/search-contract.tsx @@ -12,7 +12,7 @@ import { Input } from "@/src/shared/ui"; import { getBytecode, createConfig } from "@wagmi/core"; import { SearchIcon } from "lucide-react"; import { useRouter } from "next/navigation"; -import React, { ChangeEvent, useMemo, useRef } from "react"; +import React, { ChangeEvent, useEffect, useMemo, useRef } from "react"; import { http, WagmiProvider, createConfig as createConfigGeneral } from "wagmi"; import { arbitrum, arbitrumSepolia, mainnet, sepolia } from "viem/chains"; import _ from "lodash"; @@ -231,6 +231,21 @@ export function SearchContract({ contractAddress }: SearchContractProps) { }, 0); }; + useEffect(() => { + if (!contractAddress) return; + else { + if ( + (contractAddress.length !== 42 && contractAddress.length !== 66) || + (contractAddress.length === 66 && !isStarknetAddressOrHash(contractAddress)) || + (contractAddress.length === 42 && !isEthAddress(contractAddress)) + ) + return; + + setIsOpen(true); + debouncedSearch(contractAddress); + } + }, []); + return (