-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connect-kit/wallets): add
Browser Wallet
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/connect-kit/src/wallets/wallets/browser-wallet/index.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { InjectedConnector } from "wagmi/connectors/injected"; | ||
import React from "react"; | ||
|
||
import { WalletIcon } from "../../../components"; | ||
import { Wallet } from "../../types"; | ||
import styles from "../coinbase-wallet/index.module.css"; | ||
|
||
export const browserWallet = (connector?: InjectedConnector): Wallet | null => { | ||
if (!connector) return null; | ||
|
||
const installed = | ||
typeof window !== "undefined" && typeof window.ethereum !== "undefined"; | ||
|
||
return installed | ||
? { | ||
id: "injected", | ||
name: "Browser Wallet", | ||
installed: installed, | ||
createConnector: () => { | ||
return { connector }; | ||
}, | ||
icon: <WalletIcon className={styles.icon} />, | ||
} | ||
: null; | ||
}; |
This file contains 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