I have set up a JavaScript file that takes in my contract and executes the various functions and then returns the correct events. The file runs through 'truffle exec'.
I am using the following line to get my events to return:
let myEvent = contract.ThisEvent({}, {fromBlock: 0, toBlock: 'latest'});
myEvent.get((error, logs) => {
logs.forEach(log => console.log(
'Message: ' + log.args.message
))
});
The problem I am facing is that I have a variety of events with the same name but that return different messages. The idea is for each event to be returned in a specific order (as set up in the function). But when I try to execute them in the JS file they end up being returned in the terminal in the wrong order.
I'm not sure how to get it to return the events in the correct order. Can I maybe change the fromBlock/toBlock to make this happen? And if yes is there a way to figure out in advance in which block which event is going to be in?
Thanks!