Skip to main content

useContractMetadata

Hook for retrieving the metadata of a given contract.

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

Usage

Provide a contract instance as the argument.

import { useContract, useContractMetadata } from "@thirdweb-dev/react";

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

function App() {
const { contract } = useContract(contractAddress);
const { data: metadata } = useContractMetadata(contract);

return (
<div>
<h2>{metadata.name}</h2>
<p>{metadata.description}</p>
</div>
);
}