burner-wallet / burner-wallet-2

A modular, extendable Burner Wallet
MIT License
88 stars 39 forks source link

Bug with defaultAccount and accounts when using MetaMask #12

Closed PaulRBerg closed 4 years ago

PaulRBerg commented 4 years ago

Current Behavior

The defaultAccount and accounts props look like this in the console:

accounts ["0x496B1e7F4A0abbb93443A35e70E1c3F9613791dC"]
defaultAccount 0x496B1e7F4A0abbb93443A35e70E1c3F9613791dC

Whereas my MetaMask account is 0x4bcb303609F19e71Ab82A3A3393c46BfEa1e44Fc.

Expected Behavior

The accounts and defaultAccount should be the accounts of MetaMask.

PaulRBerg commented 4 years ago

Update

It happens only when I first open a plugin page. If I land on a plugin after seeing the home page, it works fine.

PaulRBerg commented 4 years ago

Update 2

I suspect that it has to do with updating props downstream. The account in the top-right corner shows up correctly as the account from MetaMask, but the plugin's props (web3, accounts and defaultAccount) all return the local burner account.

PaulRBerg commented 4 years ago

Update 3

Thanks to @dmihal and his awesome tech support, I solved this issue by moving the code in componentDidUpdate instead of componentDidMount. I don't think this is a bug per se, but it is something worth mentioning in the README/ dev guide imo.