UNPKG

@lifi/widget

Version:

LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.

31 lines (28 loc) 611 B
import { ChainType } from '@lifi/sdk' import type { Address } from 'viem' import { useBytecode } from 'wagmi' export const useIsContractAddress = ( address?: string, chainId?: number, chainType?: ChainType ) => { const { data: contractCode, isLoading, isFetched, } = useBytecode({ address: address as Address, chainId: chainId, query: { refetchInterval: 300_000, staleTime: 300_000, enabled: Boolean(chainType === ChainType.EVM && chainId), }, }) return { isContractAddress: !!contractCode, contractCode, isLoading, isFetched, } }