Skip to main content

useContractType

Hook for determining the type of contract given a contract address.

import { useContractType } from "@thirdweb-dev/react";

Usage

Provide your contract address as the argument.

import { useContractType } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { data, isLoading, error } = useContractType(contractAddress);

if (error) {
console.error("failed to get contract type", error);
}

return (
<div>
{isLoading ? (
<div>Loading...</div>
) : (
<div>Contract type is {data}</div>
)}
</div>
);
}

Return Values

This hook will return one of the following values:

  • split
  • custom
  • edition-drop
  • edition
  • marketplace
  • marketplace-v3
  • multiwrap
  • nft-collection
  • nft-drop
  • pack
  • signature-drop
  • token-drop
  • token
  • vote
  • null