From 455a27893b54c39fa6c6f9c365ea64b62dd44d4e Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 17 Apr 2025 11:53:56 -0500 Subject: [PATCH] Remove the confusing extra `useNostr` hook --- src/hooks/useNostr.ts | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 src/hooks/useNostr.ts diff --git a/src/hooks/useNostr.ts b/src/hooks/useNostr.ts deleted file mode 100644 index 0a0ef57..0000000 --- a/src/hooks/useNostr.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useNostr } from '@nostrify/react'; -import { useQuery } from '@tanstack/react-query'; -import { NostrEvent, NostrFilter } from '@nostrify/nostrify'; - -// Hook for fetching Nostr events based on filters -export function useNostrQuery(filters: NostrFilter[], options = {}) { - const { nostr } = useNostr(); - - return useQuery({ - queryKey: ['nostr', JSON.stringify(filters)], - queryFn: async () => { - if (!nostr) return []; - return await nostr.query(filters); - }, - ...options, - }); -} - -// Hook for publishing Nostr events -export function useNostrPublish() { - const { nostr } = useNostr(); - - const publish = async (event: NostrEvent) => { - if (!nostr) throw new Error('Nostr context not available'); - return await nostr.event(event); - }; - - return { publish }; -} - -// Export the useNostr hook as well for direct access to the pool -export { useNostr }; \ No newline at end of file