feat: implement Nostr Wallet Connect (NWC)

- Add applesauce-wallet-connect dependency
- Create WalletService for managing NWC connection
- Create WalletViewer component for UI
- Register 'wallet' command
- Fix build errors in spell/spellbook components due to applesauce-actions upgrade
This commit is contained in:
Alejandro Gómez
2025-12-20 18:46:14 +01:00
parent 5d432300b2
commit 5d9ff3cf56
34 changed files with 1821 additions and 111 deletions

View File

@@ -68,6 +68,7 @@ export const addWindow = (
props: any;
commandString?: string;
customTitle?: string;
spellId?: string;
},
): GrimoireState => {
const activeId = state.activeWorkspaceId;
@@ -79,6 +80,7 @@ export const addWindow = (
customTitle: payload.customTitle,
props: payload.props,
commandString: payload.commandString,
spellId: payload.spellId,
};
// Insert window using global layout configuration

View File

@@ -10,8 +10,10 @@ import {
} from "@/types/app";
import { useLocale } from "@/hooks/useLocale";
import * as Logic from "./logic";
import * as SpellbookManager from "@/lib/spellbook-manager";
import { CURRENT_VERSION, validateState, migrateState } from "@/lib/migrations";
import { toast } from "sonner";
import { ParsedSpellbook } from "@/types/spell";
// Initial State Definition - Empty canvas on first load
const initialState: GrimoireState = {
@@ -171,13 +173,20 @@ export const useGrimoire = () => {
);
const addWindow = useCallback(
(appId: AppId, props: any, commandString?: string, customTitle?: string) =>
(
appId: AppId,
props: any,
commandString?: string,
customTitle?: string,
spellId?: string,
) =>
setState((prev) =>
Logic.addWindow(prev, {
appId,
props,
commandString,
customTitle,
spellId,
}),
),
[setState],
@@ -291,6 +300,12 @@ export const useGrimoire = () => {
[setState],
);
const loadSpellbook = useCallback(
(spellbook: ParsedSpellbook) =>
setState((prev) => SpellbookManager.loadSpellbook(prev, spellbook)),
[setState],
);
return {
state,
locale: state.locale || browserLocale,
@@ -310,5 +325,6 @@ export const useGrimoire = () => {
updateWorkspaceLabel,
reorderWorkspaces,
setCompactModeKinds,
loadSpellbook,
};
};