ERC1155 : my metadata is not showing on opensea, although the link has json and jpg files and it works 100% Also the token_uri is invalid as in the picture, I don't know why Please can you help me?

// contracts/CD.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract CD is ERC1155, Ownable {

uint256 public constant ZARA = 0;
uint256 public constant TORO = 1;
uint256 public constant NANI = 2;
uint256 public constant JIKA = 3;


constructor()  ERC1155("https://www.mydomainename/CD/{id}.json") {
    _mint(msg.sender, ZARA, 1000, "");
    _mint(msg.sender, TORO, 300, "");
    _mint(msg.sender, NANI, 2000, "");
    _mint(msg.sender, JIKA, 50, "");
}

function uri(uint256 _tokenId) override public pure returns (string memory) {
    return string(
        abi.encodePacked(
        "https://www.mydomainename/CD/",
        Strings.toString(_tokenId),
        ".json"
    )
  );

}

}

1 Like

Keerthana Thank you for your reply
Honestly, I've been to their site before
But they only put an example for ERC721 and it is not compatible with ERC1155
I have tried changing "tokenURI" to "uri"
But it didn't work for me.
Please do you have an example for ERC1155?