import { useMemo } from "react"; import { useRequestBuilder, useUserProfile } from "../src"; import { FlatNoteStore, NostrSystem, RequestBuilder, TaggedNostrEvent } from "@snort/system"; const System = new NostrSystem({}); // some bootstrap relays ["wss://relay.snort.social", "wss://nos.lol"].forEach(r => System.ConnectToRelay(r, { read: true, write: false })); export function Note({ ev }: { ev: TaggedNostrEvent }) { const profile = useUserProfile(System, ev.pubkey); return (
Post by: {profile.name ?? profile.display_name}

{ev.content}

); } export function UserPosts(props: { pubkey: string }) { const sub = useMemo(() => { const rb = new RequestBuilder("get-posts"); rb.withFilter().authors([props.pubkey]).kinds([1]).limit(10); return rb; }, [props.pubkey]); const data = useRequestBuilder(System, FlatNoteStore, sub); return ( <> {data.data.map(a => ( ))} ); } export function MyApp() { return ; }