Metamask-extension: After update to 8.0.0 the transaction success promise is not called anymore

Created on 2 Jul 2020  路  5Comments  路  Source: MetaMask/metamask-extension

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:

  1. Create a smart contract with a send interaction, use web3.js to interact with it
  2. Implement the success handling in its .then callback
  3. Wait for it to get called
  4. Never happens

Expected behavior
The promise return is called when transaction was successfully executed

Browser details (please complete the following information):

  • Firefox

    • Metamask 8.0.0

    • web3.js

N02-needsReproduction T00-bug

Most helpful comment

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>

https://codesandbox.io/s/stoic-paper-oilc1?file=/index.html

All 5 comments

@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>

https://codesandbox.io/s/stoic-paper-oilc1?file=/index.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.

Was this page helpful?
5 / 5 - 1 ratings

Related issues

aecc picture aecc  路  3Comments

MarkOSullivan94 picture MarkOSullivan94  路  3Comments

glitch003 picture glitch003  路  3Comments

johnerfx picture johnerfx  路  4Comments

estebanmino picture estebanmino  路  3Comments