Skip to content

Commit 0d95a3e

Browse files
authored
Merge pull request #85 from movementlabsxyz/clean-wallet-list
Clean-wallet-list
2 parents b8c307d + 6313321 commit 0d95a3e

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/components/WalletModal.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function WalletsModal({
5555
const [expanded, setExpanded] = useState(false);
5656

5757
const { wallets = [] } = useWallet();
58-
58+
5959
const {
6060
/** Wallets that use social login to create an account on the blockchain */
6161
aptosConnectWallets,
@@ -73,8 +73,24 @@ export default function WalletsModal({
7373
if (sortDefaultWallets) defaultWallets.sort(sortDefaultWallets);
7474
if (sortMoreWallets) moreWallets.sort(sortMoreWallets);
7575

76-
const hasAptosConnectWallets = !!aptosConnectWallets.length;
76+
function cleanWalletList(wallets: AnyAptosWallet[]) {
77+
const unsupportedWallets = ['Dev T wallet', 'Pontem', 'TrustWallet', 'TokenPocket', 'Martian', 'Rise']
78+
return wallets
79+
.filter(
80+
(wallet, index, self) =>
81+
self.findIndex((w) => w.name === wallet.name) === index,
82+
)
83+
.filter((wallet) => {
84+
if (!wallet) return false;
85+
if (unsupportedWallets.includes(wallet.name)) {
86+
return false;
87+
}
88+
return wallet;
89+
});
90+
}
7791

92+
const hasAptosConnectWallets = !!aptosConnectWallets.length;
93+
7894
return (
7995
<Dialog
8096
open={modalOpen}
@@ -195,7 +211,7 @@ export default function WalletsModal({
195211
</>
196212
)}*/}
197213
<Stack sx={{ gap: 1 }}>
198-
{defaultWallets.map((wallet: AnyAptosWallet) => (
214+
{cleanWalletList(defaultWallets).map((wallet: AnyAptosWallet) => (
199215
<WalletRow
200216
key={wallet.name}
201217
wallet={wallet}
@@ -214,7 +230,7 @@ export default function WalletsModal({
214230
</Button>
215231
<Collapse in={expanded} timeout="auto" unmountOnExit>
216232
<Stack sx={{ gap: 1 }}>
217-
{moreWallets.map((wallet: AnyAptosWallet) => (
233+
{cleanWalletList(moreWallets).map((wallet: AnyAptosWallet) => (
218234
<WalletRow
219235
key={wallet.name}
220236
wallet={wallet}

0 commit comments

Comments
 (0)