2025-03-21 22:21:45 -04:00
|
|
|
// lib/hooks/useFeedHooks.ts
|
|
|
|
import { nip19 } from 'nostr-tools';
|
2025-03-24 15:55:58 -04:00
|
|
|
import { useMemo } from 'react';
|
|
|
|
import { useSocialFeed } from './useSocialFeed';
|
|
|
|
import { useNDKCurrentUser } from './useNDK';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file contains constants related to the POWR account.
|
|
|
|
* The feed implementation has been moved to useSocialFeed.ts.
|
|
|
|
*/
|
2025-03-21 22:21:45 -04:00
|
|
|
|
|
|
|
// POWR official account pubkey
|
|
|
|
export const POWR_ACCOUNT_PUBKEY = 'npub1p0wer69rpkraqs02l5v8rutagfh6g9wxn2dgytkv44ysz7avt8nsusvpjk';
|
|
|
|
|
|
|
|
// Convert POWR account pubkey to hex at the module level
|
|
|
|
export let POWR_PUBKEY_HEX: string = '';
|
|
|
|
try {
|
|
|
|
if (POWR_ACCOUNT_PUBKEY.startsWith('npub')) {
|
|
|
|
const decoded = nip19.decode(POWR_ACCOUNT_PUBKEY);
|
|
|
|
POWR_PUBKEY_HEX = decoded.data as string;
|
|
|
|
} else {
|
|
|
|
POWR_PUBKEY_HEX = POWR_ACCOUNT_PUBKEY;
|
|
|
|
}
|
2025-03-24 15:55:58 -04:00
|
|
|
console.log("[useFeedHooks] Initialized POWR pubkey hex:", POWR_PUBKEY_HEX);
|
2025-03-21 22:21:45 -04:00
|
|
|
} catch (error) {
|
2025-03-24 15:55:58 -04:00
|
|
|
console.error('[useFeedHooks] Error decoding POWR account npub:', error);
|
2025-03-21 22:21:45 -04:00
|
|
|
POWR_PUBKEY_HEX = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2025-03-24 15:55:58 -04:00
|
|
|
* @deprecated Use useSocialFeed from lib/hooks/useSocialFeed.ts instead.
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* // For POWR feed:
|
|
|
|
* const { feedItems, loading, refresh } = useSocialFeed({
|
|
|
|
* feedType: 'powr',
|
|
|
|
* authors: [POWR_PUBKEY_HEX]
|
|
|
|
* });
|
|
|
|
*
|
|
|
|
* // For Following feed:
|
|
|
|
* const { feedItems, loading, refresh } = useSocialFeed({
|
|
|
|
* feedType: 'following'
|
|
|
|
* });
|
|
|
|
*
|
|
|
|
* // For Global feed:
|
|
|
|
* const { feedItems, loading, refresh } = useSocialFeed({
|
|
|
|
* feedType: 'global'
|
|
|
|
* });
|
2025-03-22 23:21:26 -04:00
|
|
|
*/
|