diff --git a/apps/extension/src/core/page.ts b/apps/extension/src/core/page.ts index 5861bc12d3..13aa096fc9 100644 --- a/apps/extension/src/core/page.ts +++ b/apps/extension/src/core/page.ts @@ -39,10 +39,10 @@ const enable = async (origin: string): Promise => { return new TalismanInjected(messageService.sendMessage) as Injected } -export const isTalismanHostname = (hostname: string) => +export const isTalismanHostname = (hostname: string | undefined) => hostname === TALISMAN_WEB_APP_DOMAIN || - (DEBUG && hostname.endsWith(".talisman.pages.dev")) || - (DEBUG && ["localhost", "127.0.0.1"].includes(hostname)) + (DEBUG && hostname?.endsWith(".talisman.pages.dev")) || + (DEBUG && ["localhost", "127.0.0.1"].includes(hostname ?? "")) function inject() { // inject substrate wallet provider diff --git a/apps/extension/src/ui/apps/popup/pages/Connect.tsx b/apps/extension/src/ui/apps/popup/pages/Connect.tsx index 74048ca8ce..f005bd635b 100644 --- a/apps/extension/src/ui/apps/popup/pages/Connect.tsx +++ b/apps/extension/src/ui/apps/popup/pages/Connect.tsx @@ -55,7 +55,7 @@ export const Connect: FC<{ className?: string }> = ({ className }) => { const { id } = useParams<"id">() as KnownRequestIdOnly<"auth"> const authRequest = useRequest(id) const { popupOpenEvent } = useAnalytics() - const allAccounts = useAccounts(isTalismanHostname(authRequest?.url) ? "portal" : "dapp") + const allAccounts = useAccounts(isTalismanHostname(authRequest?.url) ? "all" : "owned") const { items: connected, toggle, set } = useSet() const ethereum = !!authRequest?.request?.ethereum const [showEthAccounts, setShowEthAccounts] = useState(false) diff --git a/apps/extension/src/ui/hooks/useAccounts.tsx b/apps/extension/src/ui/hooks/useAccounts.tsx index da5ca14251..cbb8f8ec1f 100644 --- a/apps/extension/src/ui/hooks/useAccounts.tsx +++ b/apps/extension/src/ui/hooks/useAccounts.tsx @@ -10,7 +10,7 @@ const INITIAL_VALUE: AccountJsonAny[] = [] const subscribe = (subject: BehaviorSubject) => api.accountsSubscribe((v) => subject.next(v)) -export type UseAccountsFilter = "all" | "watched" | "owned" | "portfolio" | "dapp" | "portal" +export type UseAccountsFilter = "all" | "watched" | "owned" | "portfolio" // TODO migrate to recoil export const useAccounts = (filter: UseAccountsFilter = "all") => { @@ -24,10 +24,8 @@ export const useAccounts = (filter: UseAccountsFilter = "all") => { ) case "watched": return allAccounts.filter(({ origin }) => origin === AccountType.Watched) - case "dapp": case "owned": return allAccounts.filter(({ origin }) => origin !== AccountType.Watched) - case "portal": case "all": return allAccounts } diff --git a/apps/extension/src/ui/hooks/useAuthorisedSiteById.tsx b/apps/extension/src/ui/hooks/useAuthorisedSiteById.tsx index 780e4fb0e4..b2f6176894 100644 --- a/apps/extension/src/ui/hooks/useAuthorisedSiteById.tsx +++ b/apps/extension/src/ui/hooks/useAuthorisedSiteById.tsx @@ -16,7 +16,7 @@ const useAuthorisedSiteById = (id: AuthorizedSiteId, type: ProviderType) => { const sites = useAuthorisedSites() const availableAddresses = useAccountAddresses( type === "ethereum", - isTalismanHostname(sites[id]?.url) ? "portal" : "dapp" + isTalismanHostname(sites[id]?.url) ? "all" : "owned" ) const connected = useMemo(() => { diff --git a/apps/extension/src/ui/hooks/useConnectedAccounts.ts b/apps/extension/src/ui/hooks/useConnectedAccounts.ts index 34ccaad22a..5bd3dd21f1 100644 --- a/apps/extension/src/ui/hooks/useConnectedAccounts.ts +++ b/apps/extension/src/ui/hooks/useConnectedAccounts.ts @@ -8,7 +8,7 @@ import useAuthorisedSiteById from "./useAuthorisedSiteById" export const useConnectedAccounts = (siteId: string, providerType: ProviderType) => { const { connected, toggleOne, url } = useAuthorisedSiteById(siteId, providerType) - const allAccounts = useAccounts(isTalismanHostname(url) ? "portal" : "dapp") + const allAccounts = useAccounts(isTalismanHostname(url) ? "all" : "owned") const [showEthAccounts, setShowEthAccounts] = useState( allAccounts?.some((a) => connected.includes(a.address) && a.type === "ethereum") )