Docs

Updating and freezing NFT metadata

Krishang Nadgauda

We've added two new capabilities to our NFT prebuilt contracts:

Update NFT metadata

As an admin of your NFT collection, you can now update the metadata of NFTs that have already been minted.

These metadata updates can only be performed by holding the METADATA_ROLE, which you are granted upon deploying your NFT contract.

Smart Contract API

For NFT Collection, Edition and Loyalty Card (ref):

/// @notice Sets the metadata URI for a given NFT.
function setTokenURI(uint256 _tokenId, string memory _uri) public;

For NFT Drop and Edition Drop (ref):

/**
* @notice Updates the base URI for a batch of tokens. Can only be called if the batch has been revealed/is not encrypted.
*
* @param _index Index of the desired batch in batchIds array
* @param _uri the new base URI for the batch.
*/
function updateBatchBaseURI(uint256 _index, string calldata _uri) external

Freeze NFT metadata

As an admin of your NFT collection, you can also freeze the NFT metadata of the NFTs in your collection.

Once you freeze metadata – the metadata of NFTs can no longer be updated once they are minted. However, minters can continue to mint new NFTs. Freezing metadata is irreversible i.e. you cannot 'un-freeze' NFT metadata in order to update it.

Freezing metadata can only be performed by holding the METADATA_ROLE, which you are granted upon deploying your NFT contract.

Smart Contract API

For NFT Collection, Edition and Loyalty Card (ref):

/// @notice Freeze NFT metadata
function freezeMetadata() public

For NFT Drop and Edition Drop (ref):

/**
* @notice Freezes the base URI for a batch of tokens.
*
* @param _index Index of the desired batch in batchIds array.
*/
function freezeBatchBaseURI(uint256 _index) external

Changes available at:

We'll be rolling out SDK and Dashboard support for these features shortly. In the meantime, these features are available to use via the SDK's custom contract API and on the Explorer tab of your contracts' dashboard.