ERC1155 uri function doesn't use the tokenID?

i tried what frangio said but never got it working. i'm totally new to solidity/javascript, but im pretty sure what he said is right.

starting to go off topic now, but when i tried i didnt know how to use "padStart" function. im compiling with remix solidity and that gave me an error. maybe missing some imports. i also tried importing the toString but that didnt fix it. hope you had better luck :slight_smile:

@NothingBurger26, It did not work for you because what you have shared @frangio is javascript code for your front.
It is not solidity code.

Think of your smart contract as the back of a web application. The data returned by the uri function must be manipulated so that they generate the recommended uri in the EIP

What you have to do is create the front of a dapp to receive the response from the uri function connecting to the blockchain through one of the most used javascript libraries: Ethers.js or Web3.js

You can also use either of the two most popular development environments:

Truffle - Web3 - React
Hardhat - Ethers - React

I personally recommend hardhat because it has a smoother learning curve and I find it much easier for the neophyte.

1 Like