Skip to content

Commit

Permalink
feat: allow filtering by ids or names
Browse files Browse the repository at this point in the history
  • Loading branch information
khanti42 committed Dec 6, 2024
1 parent 7144af2 commit 2cccbbb
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/core/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,22 @@ export function getStarknet(

return firstAuthorizedWallet
},
discoverVirtualWallets: async (): Promise<void> => {
discoverVirtualWallets: async (
walletNamesOrIds: string[] = [],
): Promise<void> => {
const walletNamesOrIdsSet = new Set(walletNamesOrIds)

const virtualWalletToDiscover =
walletNamesOrIdsSet.size > 0
? virtualWallets.filter(
(virtualWallet) =>
walletNamesOrIdsSet.has(virtualWallet.name) ||
walletNamesOrIdsSet.has(virtualWallet.id),
)
: virtualWallets

await Promise.all(
virtualWallets.map(async (virtualWallet) => {
virtualWalletToDiscover.map(async (virtualWallet) => {
const hasSupport = await virtualWallet.hasSupport(windowObject)
if (hasSupport) {
windowObject[virtualWallet.windowKey] = virtualWallet
Expand Down

0 comments on commit 2cccbbb

Please sign in to comment.