Ok so when I use my onclick (to submit the kitty NFT to blockchain), this is the error that pops up in my console… Any idea on where to go from here?
web3.min.js:1 Uncaught Error: invalid number value (arg="_genes", coderType="uint256", value=58246053153543350000)
at Object.n [as throwError] (web3.min.js:1)
at t.encode (web3.min.js:1)
at web3.min.js:1
at Array.forEach (<anonymous>)
at N (web3.min.js:1)
at t.encode (web3.min.js:1)
at e.encode (web3.min.js:1)
at i.encodeParameters (web3.min.js:1)
at web3.min.js:1
at Array.map (<anonymous>)
Here’s my button…
<button onclick='customKittyClicked()' style="background-color: teal" type="button" class="btn btn-primary light-b-shadow m-2 ">
Submit Custom Kitty
</button>
& Here’s the function the onclick calls:
function customKittyClicked(){
var dnaStr = getDna();
instance.methods.createKittyGen0(dnaStr).send({}, function(error, txHash){
if(err){
console.log('error');
alert('Oops. There was an error sending your NFT to the blockchain.');
}
else{
console.log(txHash);
alert('Congratulations! Your NFT successfully created!');
}
});
Here are is the createGen0()
function createKittyGen0(uint256 _genes) public onlyOwner returns(uint256) {
//takes the genes that you send in from front send
//creates a new kitty for us with those specific genes
require(gen0Counter < gen0Limit);
gen0Counter++;
//use _createKitty()
return _createKitty(0, 0, 0, _genes, address(this));
}
function _createKitty(uint256 _momID, uint256 _dadID, uint256 _generation, uint256 _genes,address _owner) internal returns(uint256){
Kittys memory _kitty = Kittys({
momID: uint32(_momID),
dadID: uint32(_dadID),
generation: uint16(_generation),
genes: _genes,
birthTime: uint64(block.timestamp)
});
kittys.push(_kitty);
uint256 newKittenID = kittys.length - 1;
_transfer(address(0), _owner, newKittenID);
emit Birth(_owner, newKittenID, _momID, _dadID, _genes);
return newKittenID;
}