I have a smart contract with an event.
event NewContractCreated(address _callerAddress, address _newContractAddress);
I know how to actively listen for new events:
var newContractEvent = myContract.NewContractCreated();
newContractEvent.watch(function(error, result){
if (!error){
console.log("Success");
console.log("New Contract Address: " + result.args._newContractAddress);
console.log("Creator: " + result.args._callerAddress);
}
});
That works just fine for me. But my question is: how do I listen for and pull the exact same data for events that happened before I started watching?
I tried the exact same thing but using get
instead of watch
... it half worked. It printed the top line "Success" but did not print the rest of the log lines.