Looking at the open-zeppelin
ERC721
Contract's code, I see that the very last thing that its mint
function is doing is call emit
on the contract's pre-defined Transfer
event.
My question is: how do I capture and respond to this event
in my web3
Dapp?
Here's my code:
// Set up Event:
MyApp.NFTtokenTransferEvent = MyApp.NFTContractInstance.Transfer();
// Now tell my app to LISTEN/WATCH for that Event:
MyApp.NFTtokenTransferEvent.watch(function (error, result) {
if (!error) {
// If a Token was Minted or TRANSFERRED, let us know who, what, where:
console.log("TRANSFER EVENT RESULTS: " + result);
}
else {
console.log("Error with EVENT and its EMISSION!!! Error is: " + error);
}
});
},
The result I'm getting for is - well, nothing.
When I mint new tokens - which I know is happening successfully cause I am verifying it - I don't get any feedback from the Transfer
event.
I don't get anything in the result
argument - nor do I get any errors. I basically don't get anything.
Any suggestions?
(NOTE: my NFTContract
obviously inherits from the ERC721Full
Contract, so I'm assuming it/I can access the Transfer
event without having to do anything special there, correct? )