Hi im trying to set a new tokenURI per mint. Users are submitting the meta on the front end and im trying to get it back from moralis to use in my contract… Is this even possible? I tried doing this by passing tokenURI in the function call from the front end and passing that into the constructor with no luck.
I tried using _setURI() with the passed in uri and no luck. Im now looking to see if I can set the value in the constructor using the {id} but the hashes are alway different as well. Is there a way to do this?
below is my constructor with a template of the hypothetical string argument. and the mint factory function
) public ERC1155("https://ipfs.moralis.io:2053/ipfs/{moralis ipfs hash}/metadata/{id}.json")VRFConsumerBase(_vrfCoordinator, _linkToken) {
x_lastTimeStamp = block.timestamp;
x_keyHash = _keyHash;
x_chainlinkFee = _chainlinkFee;
x_ticketFee = _ticketFee;
x_interval = _interval;
x_theWinner = 0x0000000000000000000000000000000000000000;
x_lotteryState = lotteryState.OPEN;
}
// Mint factory
function mintImage(string memory tokenURI)
public
payable
returns (uint256)
{
//x_tokenURI = tokenURI;
x_tokenIds.increment();
uint256 newItemId = x_tokenIds.current();
_mint(msg.sender, newItemId, 1, "");
_setURI(tokenURI);
x_userMintCount[msg.sender] = x_userMintCount[msg.sender] + 1;
if(x_userMintCount[msg.sender] % 3 == 0){
x_usersEntered.push(payable(msg.sender));
emit enteredDraw(msg.sender);
}
return newItemId;
}