Since we cannot pass string arrays as parameters in solidity I used a byte32 array in a function. The code gives no error at compile time. But when I give input to the drawCard function as below in Remix IDE
"this is token uri", ["maham",67,"Silver","First Token","image url"] I get the following error:
transact to CryptoGogos.drawCard errored: Error encoding arguments: Error: invalid arrayify value (argument="value", value="maham", code=INVALID_ARGUMENT, version=bytes/5.0.5) My code is as follows:
function drawCard(string memory _tokenURI, bytes32[] memory params) public { require(uint(params[1])<total_supply, "Input supply is not less than total supply of cards."); _tokenIds.increment(); uint256 newNftTokenId = _tokenIds.current(); Cards memory c; c.name = string(abi.encodePacked(params[0])); c.supply = uint(params[1]); c.cat = string(abi.encodePacked(params[2])); c.description = string(abi.encodePacked(params[3])); c.image_url= string(abi.encodePacked(params[4])); c.card_id = newNftTokenId; card.push(c); tokeninfo[newNftTokenId] = c; }