I can't seem to find an answer for my problem, or it's either impossible and I'm missing something, or it's trivial and I'm missing something.
I have this function on client side:
const bet = web3.utils.toWei(bet.toString(), 'ether')
let gasEstimated = 135335 //default
Contract.methods.joinGame(id).estimateGas({ from: account, value: bet }).then(function (gasAmount) {
gasEstimated = gasAmount
})
Contract.methods.joinGame(id).send({ from: account, gas: gasEstimated, value: bet }).then((result, error) => {
if (error) return console.log('ERROR_PAYING', error)
})
It gives me an eth_sendTrasaction
does not exist error.
My final objective would be for the client to pay with metamask once the joingame
function is called.
Disclaimer: I also tried with web3.eth.sendTransaction
It works with ganache-cli