Appearance
getCommentRootPointer and getCommentReplyPointer methods can be used to get a NIP-22 comments root pointer and reply pointer
getCommentRootPointer
getCommentReplyPointer
The RepliesQuery can be used to subscribe to all comments on an event or all replies to a comment
queryStore.createQuery(RepliesQuery, event).subscribe((replies) => { console.log(replies); });
Generally the best way to load comments is to use a TimelineLoader
const rootPointer: EventPointer = { id: "<event-id>", relays: ["wss://relay.eample.com"] }; // Create a timeline loader to load all k:1111 events with #E const thread = new TimelineLoader( rxNostr, TimelineLoader.simpleFilterMap(threadRelays, [{ kinds: [1111], "#E": [rootPointer.id] }]), ); thread.subscribe((packet) => { console.log(packet.event); });
The CommentBlueprint blueprint can be used to create a comment on any event or as a reply to another comment
import { CommentBlueprint } from "applesauce-factory/blueprints"; const note = { kind: 1063, content: "cool file", // ... rest of event }; // create comment for kind 1063 note const comment = await factory.create(CommentBlueprint, note, "looks cool"); // create a reply to first comment const reply = await factory.create(CommentBlueprint, comment, "yeah i made it today");
Comments
Helpers
getCommentRootPointer
andgetCommentReplyPointer
methods can be used to get a NIP-22 comments root pointer and reply pointerQueries
The RepliesQuery can be used to subscribe to all comments on an event or all replies to a comment
Loading
Generally the best way to load comments is to use a TimelineLoader
Factory
The CommentBlueprint blueprint can be used to create a comment on any event or as a reply to another comment