Last active
December 17, 2019 03:19
-
-
Save ryanpedersen42/f48ad783e73482f07d37664b84f8ed19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| loadWeb3 = async () => { | |
| const { setEthAddress } = this.props; | |
| if (window.ethereum) { | |
| window.web3 = new Web3(window.ethereum) | |
| const ethAddresses = await window.ethereum.enable() | |
| const ethAddress = ethAddresses[0] | |
| await setEthAddress(ethAddress) | |
| } | |
| else if (window.web3) { | |
| window.web3 = new Web3(window.web3.currentProvider) | |
| } | |
| else { | |
| window.alert('Non-Ethereum browser detected!') | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment