The event 'close' is deprecated and may be removed in the future

Viewed 631

I want the best method to implement these two lines. Goal: Obtain the object of a smart contract named dev-token.

async function ... {
    ...
    const web3 = new Web3(Web3.givenProvider);
    const devtoken = await new web3.Contract(abi,address);
    ...
}

Warning during execution:

MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead. For more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect

Cordially

1 Answers

I had the same problem due to an out-of-date version of the web3.js library. I was using version 1.2 imported from the jsdelivr CDN like this:

<script src="https://cdn.jsdelivr.net/npm/web3@1.2/dist/web3.min.js"></script>

The warnings went away when I updated to the current version of web3.js (1.7.3 at the time of this writting). However, the version distributed in the jsdelivr CDN has other problems, so I had to deliver from my own server the one downloaded by npm:

<script src="./web3.min.js"></script>
Related