Skip to content

Commit

Permalink
Cast injected wallet to WalletProps
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-grover committed Nov 8, 2023
1 parent eb46cf2 commit 97e3440
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useInjectedConnector } from '../useConnectors';
import useDefaultWallets from '../../wallets/useDefaultWallets';
import { WalletProps } from '../../wallets/wallet';
import Logos from '../../assets/logos';

export const useInjectedWallet = () => {
Expand Down Expand Up @@ -38,18 +39,19 @@ export const useInjectedWallet = () => {
};

const getWallet = () => {
const installedWallets = wallets.filter((wallet: any) => wallet.installed);
const installedWallets = wallets.filter((wallet) => wallet.installed);
if (installedWallets.length > 0) {
return installedWallets[0];
} else {
return {
const wallet: WalletProps = {
id: 'injected',
name: getInjectedNames()?.[0] ?? 'Browser Wallet',
shortName: getInjectedNames()?.[0]?.replace(' Wallet', '') ?? 'Browser',
logos: {
default: <Logos.Injected />,
},
};
}
return wallet;
}
};

Expand Down

0 comments on commit 97e3440

Please sign in to comment.