From 1728f9354040ddd6ff71204002c80635b42af492 Mon Sep 17 00:00:00 2001 From: KillariDev Date: Mon, 25 Nov 2024 09:51:16 +0200 Subject: [PATCH 1/2] when removing address, remove it only for that chain id --- app/ts/background/popupMessageHandlers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/ts/background/popupMessageHandlers.ts b/app/ts/background/popupMessageHandlers.ts index 522bd007..8cfc67e8 100644 --- a/app/ts/background/popupMessageHandlers.ts +++ b/app/ts/background/popupMessageHandlers.ts @@ -83,7 +83,10 @@ export async function changeMakeMeRich(ethereumClientService: EthereumClientServ } export async function removeAddressBookEntry(simulator: Simulator, websiteTabConnections: WebsiteTabConnections, removeAddressBookEntry: RemoveAddressBookEntry) { - await updateUserAddressBookEntries((previousContacts) => previousContacts.filter((contact) => contact.address !== removeAddressBookEntry.data.address)) + await updateUserAddressBookEntries((previousContacts) => previousContacts.filter((contact) => + contact.address !== removeAddressBookEntry.data.address + && (contact.chainId === removeAddressBookEntry.data.chainId || (contact.chainId === undefined && removeAddressBookEntry.data.chainId === 1n))) + ) if (removeAddressBookEntry.data.addressBookCategory === 'My Active Addresses') updateWebsiteApprovalAccesses(simulator, websiteTabConnections, await getSettings()) return await sendPopupMessageToOpenWindows({ method: 'popup_addressBookEntriesChanged' }) } From b931197b3a0f34f2a8f22e4c6a78d4e4bb3a8fce Mon Sep 17 00:00:00 2001 From: KillariDev Date: Mon, 25 Nov 2024 09:57:01 +0200 Subject: [PATCH 2/2] cleanup --- app/ts/background/popupMessageHandlers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ts/background/popupMessageHandlers.ts b/app/ts/background/popupMessageHandlers.ts index 8cfc67e8..fb350d49 100644 --- a/app/ts/background/popupMessageHandlers.ts +++ b/app/ts/background/popupMessageHandlers.ts @@ -84,8 +84,8 @@ export async function changeMakeMeRich(ethereumClientService: EthereumClientServ export async function removeAddressBookEntry(simulator: Simulator, websiteTabConnections: WebsiteTabConnections, removeAddressBookEntry: RemoveAddressBookEntry) { await updateUserAddressBookEntries((previousContacts) => previousContacts.filter((contact) => - contact.address !== removeAddressBookEntry.data.address - && (contact.chainId === removeAddressBookEntry.data.chainId || (contact.chainId === undefined && removeAddressBookEntry.data.chainId === 1n))) + !(contact.address === removeAddressBookEntry.data.address + && (contact.chainId === removeAddressBookEntry.data.chainId || (contact.chainId === undefined && removeAddressBookEntry.data.chainId === 1n)))) ) if (removeAddressBookEntry.data.addressBookCategory === 'My Active Addresses') updateWebsiteApprovalAccesses(simulator, websiteTabConnections, await getSettings()) return await sendPopupMessageToOpenWindows({ method: 'popup_addressBookEntriesChanged' })