Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'confirmations' of null when calling provider.waitForTransaction #346

Closed
Dvisacker opened this issue Nov 13, 2018 · 9 comments
Assignees
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@Dvisacker
Copy link

I just updated to 4.0.11 and when making the following call:

let receipt = await signer.provider.waitForTransaction(tx.hash)

I get the following error:

Cannot read property 'confirmations' of null

Which seems to be related to the code below:

    BaseProvider.prototype.waitForTransaction = function (transactionHash, confirmations) {
        var _this = this;
        if (confirmations == null) {
            confirmations = 1;
        }
        return web_1.poll(function () {
            return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
                if (receipt == null && confirmations !== 0) {
                    if (receipt.confirmations < confirmations) {
                        return undefined;
                    }
                }
                return receipt;
            });
        }, { onceBlock: this });
    };

It should be receipt != null or something i suppose ?

@ricmoo ricmoo self-assigned this Nov 13, 2018
@ricmoo ricmoo added bug Verified to be an issue. on-deck This Enhancement or Bug is currently being worked on. labels Nov 13, 2018
@ricmoo
Copy link
Member

ricmoo commented Nov 13, 2018

Ack! You are right! That's almost the solution, I was trying to simplify the if condition too much and got De Morgan's Law a little messed up in my head.

I'm fixing it right now. :)

ricmoo added a commit that referenced this issue Nov 13, 2018
@ricmoo
Copy link
Member

ricmoo commented Nov 13, 2018

I've posted it to version 4.0.12, if you could try it out and make sure it solved the problem?

@ricmoo
Copy link
Member

ricmoo commented Nov 15, 2018

I'm going to close this now, but if it is still a problem, please re-open it.

Thanks! :)

@ricmoo ricmoo closed this as completed Nov 15, 2018
@ricmoo ricmoo removed the on-deck This Enhancement or Bug is currently being worked on. label Nov 15, 2018
@lastmjs
Copy link

lastmjs commented Mar 9, 2019

I still am getting this error. I'm not calling waitForTransaction on a signer, but on my provider directly. I'm using 4.0.27 of the library.

@PaulRBerg
Copy link

PaulRBerg commented Dec 2, 2019

Also just happened to me using the beta version 5.0.0-beta.162. All I did was to follow the docs:

// The operation is NOT complete yet; we must wait until it is mined
await tx.wait();

@PaulRBerg
Copy link

Update: also happens with 4.0.40.

@PaulRBerg
Copy link

PaulRBerg commented Dec 8, 2019

Okay so the issue is on this line in v4:

if (receipt.confirmations < confirmations) { return; }

And in v5:

if (receipt.confirmations < confirmations) { return; }

You need to check that receipt is defined and only then access "confirmations". I patched this on my fork, for both v4 and v5, but I get this error now:

no matching event (argument="topichash", value="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", version=abi/5.0.0-beta.142)

@hilmarx
Copy link

hilmarx commented Feb 10, 2020

@PaulRBerg did you manage to find a solution for the no matching event bug? Stumbled across the same one when trying to wait for transactions to be mined using Wallet Connect in v5.

@hilmarx
Copy link

hilmarx commented Feb 10, 2020

@ricmoo the error code I get when trying to wait for a transaction that was sent via Argents Wallet Connect integration:

Error: no matching event (argument="topichash", value="0x7d2476ab50663f025cff0be85655bcf355f62768615c0c478f3cd5293f807365", code=INVALID_ARGUMENT, version=abi/5.0.0-beta.144)
    at Logger.makeError (ethers.umd.js:3579)
    at Logger.throwError (ethers.umd.js:3588)
    at Logger.throwArgumentError (ethers.umd.js:3591)
    at Interface.getEvent (ethers.umd.js:8114)
    at Interface.parseLog (ethers.umd.js:8340)
    at ethers.umd.js:9004
    at Array.map (<anonymous>)
    at ethers.umd.js:9002
    at async Object.btnFunc (TransactionCard.tsx:796)

It seems to work fine with Gnosis Safe Wallet Connect integrations though, weird.

@ricmoo ricmoo added the fixed/complete This Bug is fixed or Enhancement is complete and published. label Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

5 participants