From ea0dd8fe8a3c65229a8f5e478f46ef1ce400def2 Mon Sep 17 00:00:00 2001 From: AnhMTV Date: Wed, 17 Jan 2024 21:25:15 +0700 Subject: [PATCH] Fix in-app browser wallet detection --- sdk/packages/selector-polkadot/src/detection.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sdk/packages/selector-polkadot/src/detection.ts b/sdk/packages/selector-polkadot/src/detection.ts index bf576a43..45394ba5 100644 --- a/sdk/packages/selector-polkadot/src/detection.ts +++ b/sdk/packages/selector-polkadot/src/detection.ts @@ -21,14 +21,12 @@ declare global { } export const getPolkadotWallets = (): PolkadotWalletInjected[] => { if (window && window.injectedWeb3) { - return Object.entries(window.injectedWeb3).map(([key, value]) => { - // value.name might be undefined - value.name = value.name ?? key - value.slug = key - value.icon = - value.icon ?? appToIcon[key] ?? 'https://registry.nightly.app/networks/polkadot.png' // TODO add default icon - return value - }) + return Object.entries(window.injectedWeb3).map(([key, value]) => ({ + ...value, + name: value.name ?? key, // value.name might be undefined + slug: key, + icon: value.icon ?? appToIcon[key] ?? 'https://registry.nightly.app/networks/polkadot.png' // TODO add default icon + })) } else { return [] }