snort/src/Feed/FollowersFeed.ts

18 lines
526 B
TypeScript
Raw Normal View History

2023-01-10 10:30:33 +00:00
import { useMemo } from "react";
2023-01-20 11:11:50 +00:00
import { HexKey } from "Nostr";
import EventKind from "Nostr/EventKind";
import { Subscriptions } from "Nostr/Subscriptions";
import useSubscription from "Feed/Subscription";
2023-01-10 10:30:33 +00:00
2023-01-15 19:40:47 +00:00
export default function useFollowersFeed(pubkey: HexKey) {
2023-01-10 10:30:33 +00:00
const sub = useMemo(() => {
let x = new Subscriptions();
x.Id = "followers";
2023-01-15 19:40:47 +00:00
x.Kinds = new Set([EventKind.ContactList]);
x.PTags = new Set([pubkey]);
2023-01-10 10:30:33 +00:00
return x;
}, [pubkey]);
return useSubscription(sub);
}