Fix duplicate signing; make account switching an explicit action

Root cause of "requires a lot of signs, not just a single one":
inject.ts wired Phantom's own accountChanged provider event to
auto-trigger re-auth, but calling connect() ourselves also fires that
same event -- so a normal silent reconnect raced its own
event-triggered handler, producing two competing "wallet connected"
reports that each independently asked Phantom to sign a fresh nonce.

Removed that event wiring entirely (onWalletEvent, EVENT_CHANNEL) --
inject.ts now only responds to our own explicit calls, never reacts
to unsolicited provider events. Per feedback, account switching isn't
something that should be inferred from a Phantom event anyway; it's
now its own explicit feature: a "Switch account" button in the popup
(nexa:switch-account) that tells the content script to disconnect and
immediately reconnect, so Phantom's connect UI reflects whichever
account is currently active there.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YXiHuScXrjxBh7yFGAPq3B
This commit is contained in:
2026-09-07 14:02:11 +02:00
co-authored by claude
parent b93a9c6f10
commit 8d104ef3cf
9 changed files with 87 additions and 76 deletions
+6 -3
View File
@@ -79,10 +79,13 @@ header .subtitle {
opacity: 0.65;
}
.account-actions {
display: flex;
gap: 8px;
}
.sign-out-button {
display: block;
width: 100%;
margin-top: 4px;
flex: 1;
padding: 6px 10px;
border: 1px solid rgba(128, 128, 128, 0.4);
border-radius: 6px;