From 8066cee536ae5678bf27e8745a7e08db9218f928 Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Wed, 26 Jun 2024 11:34:21 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20update=20session=20on=20login?= =?UTF-8?q?=20rather=20than=20disconnecting=20wallet=20connec=E2=80=A6"=20?= =?UTF-8?q?(#2659)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1b917f357d14ef6f92416b5307fa783c6792ad57. --- .../dapp-config/components/DappCard.svelte | 2 +- .../components/EditSelectionDrawer.svelte | 4 +- .../views/ConfirmConnectionDrawer.svelte | 10 +-- .../views/ConnectedDappsDrawer.svelte | 13 +++- .../views/DappDetailsDrawer.svelte | 9 ++- .../wallet-connect/actions/connectToDapp.ts | 4 +- .../actions/removeAllDisconnectedDapps.ts | 11 +-- .../stores/persisted-dapp-namespaces.store.ts | 9 +-- .../stores/persisted-dapps.store.ts | 68 ++++++++----------- .../utils/buildDefaultNamespaces.ts | 36 ---------- .../auxiliary/wallet-connect/utils/index.ts | 3 - .../utils/normalizeSupportedNamespace.ts | 16 ----- .../updateActiveSessionsToActiveProfile.ts | 34 ---------- .../profile/actions/active-profile/login.ts | 4 +- .../alpha/alpha-profile-migration-15-to-16.ts | 3 +- .../prod/prod-profile-migration-8-to-9.ts | 7 +- packages/shared/src/locales/en.json | 1 - 17 files changed, 66 insertions(+), 168 deletions(-) delete mode 100644 packages/shared/src/lib/auxiliary/wallet-connect/utils/buildDefaultNamespaces.ts delete mode 100644 packages/shared/src/lib/auxiliary/wallet-connect/utils/normalizeSupportedNamespace.ts delete mode 100644 packages/shared/src/lib/auxiliary/wallet-connect/utils/updateActiveSessionsToActiveProfile.ts diff --git a/packages/desktop/views/dashboard/drawers/dapp-config/components/DappCard.svelte b/packages/desktop/views/dashboard/drawers/dapp-config/components/DappCard.svelte index f025c3f431..0ecea8e1ae 100644 --- a/packages/desktop/views/dashboard/drawers/dapp-config/components/DappCard.svelte +++ b/packages/desktop/views/dashboard/drawers/dapp-config/components/DappCard.svelte @@ -12,7 +12,7 @@ export let onClick: (() => unknown) | undefined = undefined $: networkIds = Object.values( - dapp.session?.namespaces ?? getPersistedDappNamespacesForDapp(dapp.metadata?.url ?? '') ?? {} + dapp.session?.namespaces ?? getPersistedDappNamespacesForDapp(dapp.metadata?.url ?? '')?.supported ?? {} ).flatMap((namespace) => namespace.chains as NetworkId[]) $: verifiedState = $activeProfileId diff --git a/packages/desktop/views/dashboard/drawers/dapp-config/components/EditSelectionDrawer.svelte b/packages/desktop/views/dashboard/drawers/dapp-config/components/EditSelectionDrawer.svelte index 9a167dc4d8..7809483912 100644 --- a/packages/desktop/views/dashboard/drawers/dapp-config/components/EditSelectionDrawer.svelte +++ b/packages/desktop/views/dashboard/drawers/dapp-config/components/EditSelectionDrawer.svelte @@ -32,7 +32,7 @@ selections, requiredNamespaces, optionalNamespaces, - persistedDapp?.supported + persistedDapp?.namespaces.supported ) updateSupportedDappNamespacesForDapp(dappMetadata.url, updatedNamespace) if ($selectedDapp?.session) { @@ -59,7 +59,7 @@
diff --git a/packages/desktop/views/dashboard/drawers/dapp-config/views/ConfirmConnectionDrawer.svelte b/packages/desktop/views/dashboard/drawers/dapp-config/views/ConfirmConnectionDrawer.svelte index 0ef46d540d..888df6871c 100644 --- a/packages/desktop/views/dashboard/drawers/dapp-config/views/ConfirmConnectionDrawer.svelte +++ b/packages/desktop/views/dashboard/drawers/dapp-config/views/ConfirmConnectionDrawer.svelte @@ -4,7 +4,7 @@ import { DappVerification } from '@auxiliary/wallet-connect/enums' import { clearSessionInitiationRequest, - getPersistedDapp, + getPersistedDappNamespacesForDapp, sessionInitiationRequest, } from '@auxiliary/wallet-connect/stores' import { ISupportedNamespace, SupportedNamespaces } from '@auxiliary/wallet-connect/types' @@ -63,12 +63,12 @@ return {} } - const persistedDapp = $sessionInitiationRequest - ? getPersistedDapp($sessionInitiationRequest.params.proposer.metadata.url) + const persistedNamespaces = $sessionInitiationRequest + ? getPersistedDappNamespacesForDapp($sessionInitiationRequest.params.proposer.metadata.url) : undefined - if (persistedDapp?.supported) { - return persistedDapp.supported + if (persistedNamespaces) { + return persistedNamespaces.supported } const { requiredNamespaces, optionalNamespaces } = $sessionInitiationRequest.params diff --git a/packages/desktop/views/dashboard/drawers/dapp-config/views/ConnectedDappsDrawer.svelte b/packages/desktop/views/dashboard/drawers/dapp-config/views/ConnectedDappsDrawer.svelte index 4aae4c2fb2..decf541efb 100644 --- a/packages/desktop/views/dashboard/drawers/dapp-config/views/ConnectedDappsDrawer.svelte +++ b/packages/desktop/views/dashboard/drawers/dapp-config/views/ConnectedDappsDrawer.svelte @@ -1,5 +1,10 @@