Skip to content

Commit

Permalink
fix: request account
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Feb 28, 2024
1 parent 40b8c3e commit 1d5bb65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions static/scripts/rewards/web3/connect-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import { claimButton, toaster } from "../toaster";
export async function connectWallet(): Promise<JsonRpcSigner | null> {
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;
Expand Down

0 comments on commit 1d5bb65

Please sign in to comment.