Is there a way with web3 js to make the wallet popup window close if after certain length of time the user has not confirmed for the transaction.

basically I need to lock the sale item to be purchased since it's a unique item and the smart contract has no knowledge of this item has already been sold or not, but if the metamask wallet popup for a long time but the user does not click on confirm button or the browser or computer crashed, we don't want to lock the item for too long.

but if we release the lock in our system to allow other people to purchase it, the first buyer can still click on confirm button in wallet after waiting for a long time, then this unique item will be sold twice.

Is there any method to implement lock on the item and avoid the hung wallet ?

1 Answer 1


Unfortunately you can't control Metamask popup.

Some time sensitive dapps show a countdown timer on the screen when submitting a transaction. So the user is aware that taking too long might result in a failed transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.