MyERC721:
pragma solidity ^0.5.0;
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol";
contract MyERC721 is ERC721Full, ERC721Mintable, Ownable {
constructor() ERC721Full("ThuleenCert721", "TC721") public {}
/**
* Custom function to create a unique token
* @param _to The address that will receive the minted tokens.
* @param _tokenId The token id to mint.
* @param _tokenURI The token URI of the minted token.
*/
function mintUniqueTokenTo (
address _to,
uint256 _tokenId,
string memory _tokenURI // Store, receipient's name, grade and program details
) public
{
super.mint(_to, _tokenId);
super._setTokenURI(_tokenId, _tokenURI);
}
}
MyDeployment script using web3 (version0.2)
var tx = await nft.mintUniqueTokenTo(
receipientAddress,
122164239941406260, // <- tokenId
tokenURI, { from: coinbase }
);
The script above works is tokenId is smaller, say "12216" but with the value of "122164239941406260" (18 digits) the script gave me the following error:
UnhandledPromiseRejectionWarning: Error: invalid number value (arg="_tokenId", coderType="uint256", value=122164239941406260)
In fact, I tested with different (tokenId) values and it works up to 16 digits.
So I "assumed" the error "invalid number value" means the value is too large? Really? How do I solve this?