Open Dhruv1107 opened 5 years ago
same problem for me too
change this fromBlock: 0, toBlock: 'latest' to fromBlock: 'latest', toBlock: 'latest'
in app.js file
change this fromBlock: 0, toBlock: 'latest' to fromBlock: 'latest', toBlock: 'latest'
in app.js file
I did. something changed. but still I have some issue here. this time it shows not multiple but 2 times
loadWeb3: async function() { if(window.ethereum) { window.web3 = new Web3(window.ethereum); await ethereum.enable(); } else if(window.web3){ window.web3 = new Web3(web3.currentProvider); } else{ window.alert('Non-Ethereum brower detected. You should consider trying MetaMask!'); } return App.initContract();
},
is this because i changed this too?
in app.js line 40
initContract: function() { $.getJSON("Election.json", function(election) { App.contracts.Election = TruffleContract(election); App.contracts.Election.setProvider(web3.currentProvider); App.listenForEvents(); return App.render(); }); },
change this fromBlock: 0, toBlock: 'latest' to fromBlock: 'latest', toBlock: 'latest' in app.js file
I did. something changed. but still I have some issue here. this time it shows not multiple but 2 times
loadWeb3: async function() { if(window.ethereum) { window.web3 = new Web3(window.ethereum); await ethereum.enable(); } else if(window.web3){ window.web3 = new Web3(web3.currentProvider); } else{ window.alert('Non-Ethereum brower detected. You should consider trying MetaMask!'); } return App.initContract();
},` is this because i changed this too? in app.js line 40
initContract: function() { $.getJSON("Election.json", function(election) { App.contracts.Election = TruffleContract(election); App.contracts.Election.setProvider(web3.currentProvider); App.listenForEvents(); return App.render(); }); },`
Yes I faced too so I removed event section...so it solved everything
change this fromBlock: 0, toBlock: 'latest' to fromBlock: 'latest', toBlock: 'latest' in app.js file
I did. something changed. but still I have some issue here. this time it shows not multiple but 2 times
loadWeb3: async function() { if(window.ethereum) { window.web3 = new Web3(window.ethereum); await ethereum.enable(); } else if(window.web3){ window.web3 = new Web3(web3.currentProvider); } else{ window.alert('Non-Ethereum brower detected. You should consider trying MetaMask!'); } return App.initContract();
},` is this because i changed this too? in app.js line 40
initContract: function() { $.getJSON("Election.json", function(election) { App.contracts.Election = TruffleContract(election); App.contracts.Election.setProvider(web3.currentProvider); App.listenForEvents(); return App.render(); }); },`Yes I faced too so I removed event section...so it solved everything
Yeah, removing the votedEvent in Election.sol solved the issue, but while performing 'truffle test', it fails to pass the 3rd condition👇 1) allows a voter to cast a vote
So it actually works without any problems:
instance.votedEvent({}, { fromBlock: 'latest', toBlock: 'latest' + 1 }).watch(function(error, event) {...});
What is the solution for multiple rendering? When i add a new account and reload the page the list of candidates is showing multiple times. I have tried modifying listenForEvents in app.js, but nothing seems to work.