I have a contract that inherits ERC721Mintable, Ownable. The mint function in my contract calls the inherited _mint(msg.sender, _tokenId). My understanding is that to get the token Id of the created token I have to listen to the Transfer event emited when the token is minted.
Q1. Is this the correct way? Is there any other way?
I tried listening to the transfer event like this:
let instance = await MyToken.deployed();
const event = instance.allEvents();
event
.on("data", data => {
console.log(data);
})
.on("error", console.error);
await instance.mint(args);
However no events are being fired and nothing is being logged in the console
Can you help me and point me in the right direction?