truffle-box / react-box

Truffle, Webpack and React boilerplate.

Home Page:https://truffle-box.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

  1. 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()

  2. 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!