truffle-box / react-box

Truffle, Webpack and React boilerplate.
https://truffle-box.github.io/
MIT License
736 stars 251 forks source link

Fix metamask transaction window bug #41

Closed cgewecke closed 5 years ago

cgewecke commented 6 years ago

This PR addresses an issue @alexvandesande raised in the Truffle gitter recently. He's doing browser development and his MetaMask wallet's network is set to the same port as his dev ethereum client (probably 9545).

The react box sets a contract value on the window load event so if MetaMask has been eavesdropping, a transaction window opens which is vaguely alarming although shouldn't be dangerous.

PR decouples the local and injected web3 logic and makes sure the example only connects to a local development client. Also adds a little warning in the instantiateContract method and modifies the README to advise the user to keep their develop console running as they launch the web server in separate tab.

cc: @DiscRiskandBisque Happy to modify or improve this in any way - I've tried to follow the box's intent but if there's a better way around this quirk, will ammend.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been closed, but can be re-opened if further comments indicate that the problem persists. Feel free to tag maintainers if no there is no reply to further comments.