From 689bcbf1717c2884f521f74653bf3b452380c4ad Mon Sep 17 00:00:00 2001 From: user Date: Fri, 27 Feb 2026 12:11:46 -0800 Subject: [PATCH 1/7] feat: add wallet deletion from settings (closes #13) --- src/popup/index.html | 53 ++++++++++++++++++++++++++++ src/popup/views/settings.js | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/src/popup/index.html b/src/popup/index.html index 889aa51..68edf66 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -843,6 +843,59 @@

+ +
+

Danger Zone

+

+ Permanently delete the currently selected wallet. This + cannot be undone. Make sure you have backed up your + recovery phrase before proceeding. +

+ +
+ + diff --git a/src/popup/views/settings.js b/src/popup/views/settings.js index 8562b96..eb01cf3 100644 --- a/src/popup/views/settings.js +++ b/src/popup/views/settings.js @@ -2,6 +2,7 @@ const { $, showView, showFlash, escapeHtml } = require("./helpers"); const { state, saveState } = require("../../shared/state"); const { ETHEREUM_MAINNET_CHAIN_ID } = require("../../shared/constants"); const { log, debugFetch } = require("../../shared/log"); +const { decryptWithPassword } = require("../../shared/vault"); const runtime = typeof browser !== "undefined" ? browser.runtime : chrome.runtime; @@ -192,6 +193,74 @@ function init(ctx) { ctx.renderWalletList(); showView("main"); }); + + $("btn-delete-wallet").addEventListener("click", () => { + if (state.selectedWallet === null || state.wallets.length === 0) { + showFlash("No wallet selected."); + return; + } + const wallet = state.wallets[state.selectedWallet]; + $("delete-wallet-name").textContent = wallet.name || "this wallet"; + $("delete-wallet-password").value = ""; + $("delete-wallet-confirm").classList.remove("hidden"); + }); + + $("btn-delete-wallet-cancel").addEventListener("click", () => { + $("delete-wallet-confirm").classList.add("hidden"); + $("delete-wallet-password").value = ""; + }); + + $("btn-delete-wallet-confirm").addEventListener("click", async () => { + const pw = $("delete-wallet-password").value; + if (!pw) { + showFlash("Password required."); + return; + } + + const walletIdx = state.selectedWallet; + const wallet = state.wallets[walletIdx]; + + // Verify password against the wallet's encrypted data + try { + await decryptWithPassword(wallet.encrypted, pw); + } catch (_e) { + showFlash("Wrong password."); + return; + } + + // Collect addresses to clean up from allowedSites/deniedSites + const addresses = (wallet.addresses || []).map((a) => a.address); + + // Remove wallet + state.wallets.splice(walletIdx, 1); + + // Clean up site permissions for deleted addresses + for (const addr of addresses) { + delete state.allowedSites[addr]; + delete state.deniedSites[addr]; + } + + if (state.wallets.length === 0) { + // No wallets left — reset selection and show welcome + state.selectedWallet = null; + state.selectedAddress = null; + state.activeAddress = null; + await saveState(); + $("delete-wallet-confirm").classList.add("hidden"); + showView("welcome"); + } else { + // Switch to first wallet if deleted wallet was active + state.selectedWallet = 0; + state.selectedAddress = 0; + state.activeAddress = + state.wallets[0].addresses[0]?.address || null; + await saveState(); + $("delete-wallet-confirm").classList.add("hidden"); + showFlash("Wallet deleted."); + ctx.renderWalletList(); + showView("main"); + } + }); } module.exports = { init, show, renderSiteLists }; From 34cd72be88a5cf5471f390fe61e5cc077a1f8392 Mon Sep 17 00:00:00 2001 From: clawbot Date: Fri, 27 Feb 2026 12:44:40 -0800 Subject: [PATCH 2/7] fix: rework wallet deletion per review feedback - Remove all red/danger styling, use standard monochrome colors - Add wallet picker dropdown instead of relying on selectedWallet - Fix encryptedSecret field name (was wallet.encrypted) - Populate dropdown when settings view opens - Confirmation modal uses standard border styling --- src/popup/views/settings.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/popup/views/settings.js b/src/popup/views/settings.js index eb01cf3..a6f9083 100644 --- a/src/popup/views/settings.js +++ b/src/popup/views/settings.js @@ -71,6 +71,17 @@ function show() { $("settings-blockscout").value = state.blockscoutUrl; renderTrackedTokens(); renderSiteLists(); + // Populate wallet deletion dropdown + const sel = $("delete-wallet-select"); + sel.innerHTML = ""; + for (let i = 0; i < state.wallets.length; i++) { + const opt = document.createElement("option"); + opt.value = i; + opt.textContent = state.wallets[i].name || "Wallet " + (i + 1); + sel.appendChild(opt); + } + $("delete-wallet-confirm").classList.add("hidden"); + showView("settings"); } From 655b90c7dfa3341e1fa19727162776a3f8098fca Mon Sep 17 00:00:00 2001 From: clawbot Date: Fri, 27 Feb 2026 12:46:03 -0800 Subject: [PATCH 3/7] feat: add wallet deletion from settings (closes #13) - Per-wallet [delete] links in settings wallet list - Monochrome styling throughout, no red/danger colors - Password confirmation modal with warning text - Cleans up site permissions for deleted addresses - Switches to first remaining wallet or shows welcome if none left --- src/popup/index.html | 38 +++++----------------- src/popup/views/settings.js | 63 ++++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/src/popup/index.html b/src/popup/index.html index 68edf66..4a2b899 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -708,9 +708,7 @@

Wallets

-

- Add a new wallet from a recovery phrase or private key. -

+
-
-

Danger Zone

-

- Permanently delete the currently selected wallet. This - cannot be undone. Make sure you have backed up your - recovery phrase before proceeding. -

- -
- `; }); container.innerHTML = html; @@ -94,6 +94,38 @@ function renderWalletListSettings() { $("delete-wallet-confirm").classList.remove("hidden"); }); }); + + // Inline rename on click + container.querySelectorAll(".settings-wallet-name").forEach((span) => { + span.addEventListener("click", () => { + const idx = parseInt(span.dataset.idx, 10); + const wallet = state.wallets[idx]; + const input = document.createElement("input"); + input.type = "text"; + input.className = + "border border-border p-0 text-xs bg-bg text-fg w-full"; + input.value = wallet.name || "Wallet " + (idx + 1); + span.replaceWith(input); + input.focus(); + input.select(); + const finish = async () => { + const val = input.value.trim(); + if (val && val !== wallet.name) { + wallet.name = val; + await saveState(); + } + renderWalletListSettings(); + }; + input.addEventListener("blur", finish); + input.addEventListener("keydown", (e) => { + if (e.key === "Enter") input.blur(); + if (e.key === "Escape") { + input.value = wallet.name || "Wallet " + (idx + 1); + input.blur(); + } + }); + }); + }); } function show() { From 2b0b889b0118d82f765946f610f3adb28a5a68b5 Mon Sep 17 00:00:00 2001 From: clawbot Date: Fri, 27 Feb 2026 13:52:08 -0800 Subject: [PATCH 5/7] fix: use wallet.encryptedSecret not wallet.encrypted for password verify --- src/popup/views/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/popup/views/settings.js b/src/popup/views/settings.js index 535d38a..34a0de2 100644 --- a/src/popup/views/settings.js +++ b/src/popup/views/settings.js @@ -283,7 +283,7 @@ function init(ctx) { // Verify password against the wallet's encrypted data try { - await decryptWithPassword(wallet.encrypted, pw); + await decryptWithPassword(wallet.encryptedSecret, pw); } catch (_e) { showFlash("Wrong password."); return; From 8893f5dce78608d6c7f2f019e52b91c0ace44ace Mon Sep 17 00:00:00 2001 From: clawbot Date: Fri, 27 Feb 2026 13:58:58 -0800 Subject: [PATCH 6/7] refactor: delete-wallet-confirm as standalone full view Replace the inline confirmation div at the bottom of Settings with a proper full-screen view (view-delete-wallet-confirm). This fixes the issue where the confirmation was offscreen on the 360x600 popup. - New view with back button, title, warning text, password input, and red-text Confirm Delete button - Dedicated flash area for password errors - New deleteWallet.js module with init/show pattern - Added delete-wallet-confirm to VIEWS array in helpers.js - Removed old inline confirmation HTML and logic from settings --- src/popup/index.html | 54 ++++++++++---------- src/popup/views/deleteWallet.js | 90 +++++++++++++++++++++++++++++++++ src/popup/views/helpers.js | 1 + src/popup/views/settings.js | 81 ++--------------------------- 4 files changed, 123 insertions(+), 103 deletions(-) create mode 100644 src/popup/views/deleteWallet.js diff --git a/src/popup/index.html b/src/popup/index.html index 4a2b899..0818067 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -841,39 +841,41 @@

+ -