import { useGetContractInfo } from '@0xsequence/hooks'
import { ZERO_ADDRESS } from '@0xsequence/utils'
// Example 1: Fetch NFT Collection Info
function NFTCollectionDetails() {
const {
data: contractInfo,
isLoading,
isError
} = useGetContractInfo({
chainID: "1", // Ethereum mainnet
contractAddress: "0x..."
})
if (isLoading) return <div>Loading collection details...</div>
if (isError) return <div>Error loading collection</div>
return (
<div className="collection-details">
<img
src={contractInfo?.logoURI}
alt={contractInfo?.name}
width={64}
height={64}
/>
<h1>{contractInfo?.name}</h1>
<div className="metadata">
<span>Type: {contractInfo?.type}</span>
<span>Symbol: {contractInfo?.symbol}</span>
</div>
</div>
)
}
// Example 2: Display Native Token Info
function NativeTokenInfo() {
const { data: ethInfo } = useGetContractInfo({
chainID: "1",
contractAddress: ZERO_ADDRESS // For native ETH
})
return (
<div className="token-info">
<img
src={ethInfo?.logoURI}
alt={ethInfo?.symbol}
width={32}
height={32}
/>
<div>
<h3>{ethInfo?.name}</h3>
<p>Decimals: {ethInfo?.decimals}</p>
</div>
</div>
)
}