I think it stands to reason that Web3.givenProvider
is no longer available in web3.js v4.x versions and window.ethereum
should be used instead (see https://docs.web3js.org/guides/web3_providers_guide/#injected-providers). Since I followed web3.js v3.x documentation but am using web3.js v4, it might explain why Web3.givenProvider
is null
for me. But I'm wondering why the Web3.givenProvider
variable isn't retained for backwards compatibility reasons?!
Anyway, new Web3(window.ethereum);
solves my current problem.