NFT Marketplaces
How to integrate Beranames NFTs secondary market metadata?
You can integrate NFTs secondary market metadata following the steps below:
Fetch the URI endpoint to call from the
tokenURI(uint256 tokenId)
function of theBaseRegistrar
contract.Where
tokenId
is the token ID of the NFT -uint256(keccak256(bytes("label")))
.The function returns the metadata endpoint to call for the NFT.
Fetch the metadata from the endpoint.
you can expect the metadata to be in the format of a JSON file:
The process for fetching the collection metadata is the same as the one for the NFT metadata, but instead of calling the
tokenURI
function of theBaseRegistrar
contract, you call thecollectionURI
function of theBaseRegistrar
contract.The
collectionURI
function returns the metadata endpoint to call for the collection.You can expect the metadata to be in the format of a JSON file:
You can always decide to save the base URI and the collection URI in your own storage and fetch it from there, thus avoiding the need to call the
tokenURI
function of theBaseRegistrar
contract.Keep in mind that you need to calculate the
tokenId
from thelabel
to fetch the correct metadata, so depending on the library you use, you might need to implement the logic to calculate thetokenId
from thelabel
.
Last updated