Skip to content

Commit

Permalink
feat: lading address
Browse files Browse the repository at this point in the history
  • Loading branch information
markjung96 committed Dec 5, 2024
1 parent 376f2e5 commit 081daa0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/widgets/Landing/ui/search-contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 (
<Popover open={isOpen} onOpenChange={setIsOpen}>
<PopoverTrigger asChild>
Expand Down

0 comments on commit 081daa0

Please sign in to comment.