Hi @Dominik_Clemente
I just checked your project it could be nice to implement the other functions of your smart contract in your web application. Because as you are not sending fund when the contract is deployed i had to send eth via truffle console. Even for getBalance it could be useful for the player to check if they have something to win by playing
For your event you can catch it this way
async function bet(){
var betAmount = $("#name_input").val();
var config = {
value: web3.utils.toWei(betAmount.toString(), "ether"),
gas: 100000
}
try {
let res = await contractInstance.methods.flip().send(config);
try{
await contractInstance.getPastEvents(['bet'], {fromBlock: 'latest', toBlock: 'latest'},
async (err, events) => {
console.log(events[0].returnValues);
});
}catch(err){
console.log(err)
}
}catch(err){
console.log(err)
}
}
It seems their is an issue with the last version of ganache Gui it doesn’t work for me too i can’t get the event. But i got them using ganache-cli so if you have any issues with this code try to run ganache-cli.