From e7c5f72091a9a7f81eadc3b935edaf3b97ece4de Mon Sep 17 00:00:00 2001 From: Daniel Somoza Paletta Date: Tue, 7 Dec 2021 02:15:15 +0100 Subject: [PATCH] updated metamask initialization --- .github/workflows/deployment.yml | 10 ++++++---- package.json | 1 - src/hooks/useMetamask.js | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 8d7c331..31ddefe 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -6,7 +6,8 @@ name: deployment to Github-pages # events but only for the master branch on: push: - branches: [master] + branches: + - main # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -18,7 +19,8 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2.3.1 # Send a notification in slack # - name: Send a start pipeline notification to Slack @@ -42,8 +44,8 @@ jobs: PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} REACT_APP_CONTRACT_ADDRESS: ${{ secrets.REACT_APP_CONTRACT_ADDRESS }} - - name: deploy-to-github-pages - uses: JamesIves/github-pages-deploy-action@3.6.1 + - name: Deploy to Github pages + uses: JamesIves/github-pages-deploy-action@4.1.7 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages diff --git a/package.json b/package.json index 938e9d3..71d58ac 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "react-router-dom": "6", "react-scripts": "4.0.3", "styled-components": "^5.3.3", - "web-vitals": "^1.0.1", "web3": "^1.6.1" }, "eslintConfig": { diff --git a/src/hooks/useMetamask.js b/src/hooks/useMetamask.js index 1bf3610..8917bae 100644 --- a/src/hooks/useMetamask.js +++ b/src/hooks/useMetamask.js @@ -7,11 +7,11 @@ function useMetamask() { // Initialize Metamask instance if its present in the browser useEffect(() => { - if (!window?.web3?.currentProvider) { + if (!window.ethereum) { return; } - const metamaskInstance = new Web3(window.web3.currentProvider); + const metamaskInstance = new Web3(window.ethereum); setMetamaskInstance(metamaskInstance); }, []);