MetaMask announced that they will stop injecting web3.js here. I know previously MetaMask will add a global variable in browser window.web3
and this global lowercase web3
variable will be deprecated soon. But in my DApp, I use MetaMask as a provider to the original Web3.js
library (i.e. captical Web3
). Will my usage be affected by MetaMask stopping injecting web3.js?
I also posted another question here, where I find web3.js cannot listen to on("changed")
events in smart contract using MetaMask offered provider ethereum
. If I still want to use MetaMask and Web3.js in my DApp, how can I get notified when events emitted in smart contracts are removed due to chain reorganization?
Thanks in advance.
Best Answer
If MetaMask will stop injecting web3 this means
web3.currentProvider
is not gonna work anymore properly. My advice is to handle the change and not getting your app crashed by downloading your own web3 library and usingethereum
provider. This variable was introduced in the latest versions. Example: