Simple logic event with firing in function, work perfectly as expected in truffle develop console, but never firing on my Dapp created with create-react-app, it's just seems to not listen/monitor the network, I've people saying it should continuously load POST request to monitor network, but not in my case. I use Metamask, and all smart-contract function calls works fine on react, except events.
event RoundStarted(uint256 closingBlock);
function roundStart() public ownerOnly {
RoundStarted(block.number + ROUND_LENGTH);
}
And the line of code I used in truffle develop console, which is not working when I paste it in componentWillMount()
Loto.deployed().then(function(instance){
return instance.RoundStarted({},{fromBlock: 0, toBlock: 'latest'});
}).then((result) => {
return result.watch((error,result) => {
console.log('Found him!')
})
})
UPD: I found out that events works fine in truffle react box, so this kinda solves the problem, but I still don't know how did they manage it, it's not my code problem, something about dependencies, I'd like to know what do I miss in my create-react-app.
const Loto = Contract(LotoContract); Loto.setProvider(web3.currentProvider)
? Where web3 is from the injected provider eg MetaMask.