Bugfixes in latest Truffle-React Box
cryptoAnalyst99 opened this issue · comments
Hey Developer Team,
there are two minor bugs in the latest version of the truffle-react box.
-
the requestAccounts() method in the ETH Provider throws an error (at least for my setup : latest versions of react etc.) --> Fix: replace by web3.js method getAccounts()
-
When someone does not have the Chrome Metamask extension installed the webpage remains blank, because the useEffect Hook int the init Callback function inside the EthProvider file throws an error. --> Fix: wrap the second useEffect hook (line 43 ff) into an if statement like this: if(window.ethereum) { ... }. That way also people that just playaround with Ganache and a simple Chrome browser (no dApp browser, no injected web3, etc.) can also use the box.
Hey @cryptoAnalyst99. So web3.eth.requestAccounts
is the correct method to activate an injected wallet like MetaMask, see docs.
And to your second point I'll make a note to gracefully error when there's no wallet. Thanks!