nostr-hooks
Version:
React hooks for developing Nostr clients
26 lines (25 loc) • 825 B
TypeScript
import { NDKUserProfile } from '@nostr-dev-kit/ndk';
type ProfileParams = {
nip05?: string;
pubkey?: string;
npub?: string;
nip46Urls?: string[];
relayUrls?: string[];
};
export type ProfileStatus = 'idle' | 'loading' | 'success' | 'not-found' | 'error';
/**
* Custom hook to fetch a user profile.
*
* @param [profileParams] - Optional parameters to fetch the profile.
* @returns An object containing the user profile, null if the profile is not found,
* or undefined if the profile is being fetched.
* The status of the profile fetch is also returned.
*
* @example
* const { profile } = useProfile({ nip05: 'example@domain.com' });
*/
export declare const useProfile: (profileParams?: ProfileParams) => {
profile: NDKUserProfile | null | undefined;
status: ProfileStatus;
};
export {};