fix: set NostrConnectSigner pool before loading accounts

Fixes crash on reload when a NIP-46 account is saved. The pool must
be configured globally before accounts are restored from localStorage,
otherwise NostrConnectSigner throws "Missing subscriptionMethod".
This commit is contained in:
Claude
2026-01-12 10:23:32 +00:00
parent 0b5634a75e
commit 9f341a48b6

View File

@@ -1,5 +1,7 @@
import { AccountManager } from "applesauce-accounts";
import { registerCommonAccountTypes } from "applesauce-accounts/accounts";
import { NostrConnectSigner } from "applesauce-signers";
import pool from "./relay-pool";
const ACCOUNTS = "nostr-accounts";
const ACTIVE_ACCOUNT = "active-account";
@@ -15,6 +17,10 @@ function safeParse(s: string) {
const accountManager = new AccountManager();
registerCommonAccountTypes(accountManager);
// Set up NostrConnectSigner pool BEFORE loading accounts
// This is required for NIP-46 accounts to restore properly
NostrConnectSigner.pool = pool;
// load all accounts
if (localStorage.getItem(ACCOUNTS)) {
const accounts = localStorage.getItem(ACCOUNTS);