From 8607ce5a935c040c31d28799a81715a59df76b56 Mon Sep 17 00:00:00 2001 From: SOMESH BANERJEE <54861461+somesh-banerjee@users.noreply.github.com> Date: Wed, 16 Jun 2021 23:15:51 +0530 Subject: [PATCH] Fix for #15 Metamask is no longer exposing accounts by default, so enabling it manually --- lottery-react/src/App.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lottery-react/src/App.js b/lottery-react/src/App.js index 6d1c79c3..dfec33ca 100644 --- a/lottery-react/src/App.js +++ b/lottery-react/src/App.js @@ -22,7 +22,7 @@ class App extends Component { onSubmit = async event => { event.preventDefault(); - + await window.ethereum.enable(); const accounts = await web3.eth.getAccounts(); this.setState({ message: 'Waiting on transaction success...' }); @@ -36,6 +36,7 @@ class App extends Component { }; onClick = async () => { + await window.ethereum.enable(); const accounts = await web3.eth.getAccounts(); this.setState({ message: 'Waiting on transaction success...' });