Skip to main content

ContractMetadataLogic

thirdweb.com

Contract Metadata

Thirdweb's ContractMetadata is a contract extension for any base contracts. It lets you set a metadata URI for your contract. Additionally, ContractMetadata is necessary for NFT contracts that want royalties to get distributed on OpenSea.

Methods

contractURI

function contractURI() external view returns (string)

Returns the metadata URI of the contract.

Returns

NameTypeDescription
_0stringundefined

setContractURI

function setContractURI(string _uri) external nonpayable

Lets a contract admin set the URI for contract-level metadata.

Caller should be authorized to setup contractURI, e.g. contract admin. See {_canSetContractURI}. Emits {ContractURIUpdated Event}.

Parameters

NameTypeDescription
_uristringkeccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")

Events

ContractURIUpdated

event ContractURIUpdated(string prevURI, string newURI)

Parameters

NameTypeDescription
prevURIstringundefined
newURIstringundefined