EthereumCasts icon indicating copy to clipboard operation
EthereumCasts copied to clipboard

Please update the web3.js file according new changes ? Unable to get the accounts and other details of contract while using metamask.

Open elixirautomation opened this issue 6 years ago • 2 comments

Please suggest how to change this code according to new metamask security update.

Metamask Medium Post - New Changes

Now no accounts will be exposed by default and unable to show the account of testnet on UI.

import Web3 from "web3"; let web3; if (typeof window !== "undefined" && typeof window.web3 !== "undefined") { //We are in the browser and metamask is running. web3 = new Web3(window.web3.currentProvider); } else { //We are on ht browser OR the user is not running metamask const provider = new Web3.providers.HttpProvider( "https://rinkeby.infura.io/v3/<Infura_ID>" ); web3 = new Web3(provider); } export default web3;

elixirautomation avatar Jan 10 '19 17:01 elixirautomation

this should help you fix that problem : https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8

fullammo avatar Jul 08 '19 18:07 fullammo

add localhost to connections in metamask

lcsoundvision avatar Jun 26 '20 15:06 lcsoundvision