From 1d5bb65206ed0b935c814b616de7c908a7b31296 Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:39:02 +0000 Subject: [PATCH] fix: request account --- static/scripts/rewards/web3/connect-wallet.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/scripts/rewards/web3/connect-wallet.ts b/static/scripts/rewards/web3/connect-wallet.ts index b1353134..4c949c33 100644 --- a/static/scripts/rewards/web3/connect-wallet.ts +++ b/static/scripts/rewards/web3/connect-wallet.ts @@ -5,8 +5,13 @@ import { claimButton, toaster } from "../toaster"; export async function connectWallet(): Promise { try { const wallet = new ethers.providers.Web3Provider(window.ethereum); + + await wallet.send("eth_requestAccounts", []); + const signer = wallet.getSigner(); + const address = await signer.getAddress(); + if (!address) { console.error("Wallet not connected"); return null;