Hello,
I have been having some issues with minting NFT, when I choose the option on the site and upload a file, it calls my Metamask wallet and puts the transaction through. However I get errors on the console and the item does not appear under “My Items”. I don’t think the item is minted. Here are the errors in the console:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'returnValues')
at mintNft (main.js:182)
at async HTMLButtonElement.createItem (main.js:161)
1. {transactionHash: '0x5212ee968a6c12bb8d39bc3cb3a6a18dd39d93d58231518cdc72faaddc309dac', transactionIndex: 0, blockHash: '0xd99a6115b239ce1ea1237bff94998fd9623c031676aa96a572326750bc3841a4', blockNumber: 83, from: '0xbdcf88b50129eb06cab1c218a95f1a7b3d4ecdf3', …}
1. blockHash: "0xd99a6115b239ce1ea1237bff94998fd9623c031676aa96a572326750bc3841a4"
2. blockNumber: 83
3. contractAddress: null
4. cumulativeGasUsed: 22688
5. events:
1. [[Prototype]]: Object
6. from: "0xbdcf88b50129eb06cab1c218a95f1a7b3d4ecdf3"
7. gasUsed: 22688
8. logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
9. status: true
10. to: "0x1192b542d1a32ea9c7a1b774314849cce2684144"
11. transactionHash: "0x5212ee968a6c12bb8d39bc3cb3a6a18dd39d93d58231518cdc72faaddc309dac"
12. transactionIndex: 0
13. [[Prototype]]: Object
1. constructor: ƒ Object()
2. hasOwnProperty: ƒ hasOwnProperty()
3. isPrototypeOf: ƒ isPrototypeOf()
4. propertyIsEnumerable: ƒ propertyIsEnumerable()
5. toLocaleString: ƒ toLocaleString()
6. toString: ƒ toString()
7. valueOf: ƒ valueOf()
8. __defineGetter__: ƒ __defineGetter__()
9. __defineSetter__: ƒ __defineSetter__()
10. __lookupGetter__: ƒ __lookupGetter__()
11. __lookupSetter__: ƒ __lookupSetter__()
12. __proto__: (...)
13. get __proto__: ƒ __proto__()
14. set __proto__: ƒ __proto__()
The line of code in the first error is this:
mintNft = async (metadataUrl) => {
const receipt = await tokenContract.methods.createItem(metadataUrl).send({from: ethereum.selectedAddress});
console.log(receipt);
return receipt.events.Transfer.returnValues.tokenId;
}
Specifically this:
return receipt.events.Transfer.returnValues.tokenId;
I have not really done much to change the main.js file, it is the one from Github. The abi.js file is also identical to the one on Github. I have had the same problem with this line before, but I still can’t specifically see what is wrong with it. Any help would be appreciated!