forked from KappaSigmaMu/kappasigmamu.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallets.ts
29 lines (23 loc) · 1.1 KB
/
wallets.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { BaseDotsamaWallet, getWallets } from '@talismn/connect-wallets'
import NovaWalletLogo from '../static/nova-wallet-logo.svg'
class NovaWallet extends BaseDotsamaWallet {
public extensionName = 'polkadot-js'
public title = 'Nova Wallet'
public installUrl = 'https://novawallet.io'
public logo = {
src: NovaWalletLogo,
alt: 'Nova Wallet Logo'
}
public get installed() {
const injectedExtension = (window as any)?.injectedWeb3?.[this.extensionName]
const isNovaWallet = (window as any)?.walletExtension?.isNovaWallet
return !!(injectedExtension && isNovaWallet)
}
}
// Define supported wallet extensions to ensure compatibility.
// We introduced the SUPPORTED_WALLETS constant to filter out unsupported wallets returned by getWallets(),
// reducing the risk of errors from untested or incompatible wallets.
const SUPPORTED_WALLETS = ['talisman', 'subwallet-js', 'polkadot-js', 'enkrypt', 'polkagate']
const filteredWallets = getWallets().filter(({ extensionName }) => SUPPORTED_WALLETS.includes(extensionName))
const wallets = [...filteredWallets, new NovaWallet()]
export { wallets }