Describe the bug
When using web3.js and calling a contract method with .send . The .then() in the end is never called on the promise even when the transaction is shown as done in metamask.
To Reproduce (REQUIRED)
Steps to reproduce the behavior, libraries used with version number, and/or any setup information to easily reproduce:
Expected behavior
The promise return is called when transaction was successfully executed
Browser details (please complete the following information):
@The-Crocop, thank you for reporting this issue.
Which version of web3.js are you using? Are you bringing your own are you using the window.web3 object injected by MetaMask?
Any additional information you can share to help us reproduce this bug would be greatly appreciated (e.g. example code, contract, etc.).
Ref: #8926
Can confirm, not getting any receipt, just tx hash.
Web3 1.2.9, Metamask 8.0.2.
Code (using rinkeby faucet):
<html>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.2.9/web3.min.js"></script>
<script>
const abi=[{
"constant": false,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "allocateTo",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function",
"signature": "0x08bca566"
}]
window.onload = async function () {
const accounts = await window.ethereum.enable()
console.log(accounts)
const web3 = new Web3(window.ethereum);
const from = accounts[0]
const contract = new web3.eth.Contract(abi, '0xbF7A7169562078c96f0eC1A8aFD6aE50f12e5A99')
contract.methods.allocateTo(from, 1e18.toString(10)).send({from})
.on('transactionHash', console.log)
.then(console.log)
}
</script>
</body>
</html>
Thanks @vlddm ! I was able to reproduce this problem in v8.0.2 using that example.
However, I can't reproduce it anymore on develop. It looks like it was fixed by #8921 - I can reproduce it before that commit, but not after.
Most helpful comment
Can confirm, not getting any receipt, just tx hash.
Web3 1.2.9, Metamask 8.0.2.
Code (using rinkeby faucet):
https://codesandbox.io/s/stoic-paper-oilc1?file=/index.html