Listing Beranames on 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 theBaseRegistrarcontract.Where
tokenIdis 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:
{
"name": "Name",
"address": "0x1234567890abcdef",
"image": "https://example.com/image.png",
"registration_date": "DATE_IN_UTC_FORMAT",
"expiration_date": "DATE_IN_UTC_FORMAT"
}The process for fetching the collection metadata is the same as the one for the NFT metadata, but instead of calling the
tokenURIfunction of theBaseRegistrarcontract, you call thecollectionURIfunction of theBaseRegistrarcontract.The
collectionURIfunction returns the metadata endpoint to call for the collection.You can expect the metadata to be in the format of a JSON file:
{
"name": "Beranames",
"owner": "Berakin Inc.",
"description": "Official Name Service of Berachain",
"total_supply": "to the moon",
}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
tokenURIfunction of theBaseRegistrarcontract.Keep in mind that you need to calculate the
tokenIdfrom thelabelto fetch the correct metadata, so depending on the library you use, you might need to implement the logic to calculate thetokenIdfrom thelabel.
Last updated