From 1728f9354040ddd6ff71204002c80635b42af492 Mon Sep 17 00:00:00 2001 From: KillariDev Date: Mon, 25 Nov 2024 09:51:16 +0200 Subject: [PATCH] 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' }) }