diff --git a/UI/app_update.tsx b/UI/app_update.tsx index 62282aa..0f8c1f5 100644 --- a/UI/app_update.tsx +++ b/UI/app_update.tsx @@ -365,9 +365,10 @@ export async function* UI_Interaction_Update(args: { } const profileEvent = await prepareNormalNostrEvent( groupCreation.groupKey, - NostrKind.META_DATA, - [], - JSON.stringify(profileData), + { + kind: NostrKind.META_DATA, + content: JSON.stringify(profileData), + }, ); const err2 = pool.sendEvent(profileEvent); if (err2 instanceof Error) { diff --git a/UI/relay-config.test.ts b/UI/relay-config.test.ts index 2f6d414..683d410 100644 --- a/UI/relay-config.test.ts +++ b/UI/relay-config.test.ts @@ -68,7 +68,7 @@ Deno.test("Relay Config", async () => { { const err = await relayConfig.syncWithPool(pool); if (err != undefined) { - assertEquals(err.message, "wss://somewhere has been closed, can't wait for it to open"); + assertEquals(err.message, "wss://somewhere/ has been closed, can't wait for it to open"); } // add one relay to the pool directly @@ -83,7 +83,7 @@ Deno.test("Relay Config", async () => { // will remove urls that's in the pool but not in the config const err2 = await relayConfig.syncWithPool(pool); if (err2 != undefined) { - assertEquals(err2.message, "wss://somewhere has been closed, can't wait for it to open"); + assertEquals(err2.message, "wss://somewhere/ has been closed, can't wait for it to open"); } assertEquals(pool.getRelays().map((r) => r.url), ["wss://relay.damus.io"]); // wirednet is removed } diff --git a/database.test.ts b/database.test.ts index 1bd5652..d98be85 100644 --- a/database.test.ts +++ b/database.test.ts @@ -12,7 +12,7 @@ Deno.test("Database", async () => { if (db instanceof Error) fail(db.message); const stream = db.subscribe(); - const event_to_add = await prepareNormalNostrEvent(ctx, NostrKind.TEXT_NOTE, [], "1"); + const event_to_add = await prepareNormalNostrEvent(ctx, { kind: NostrKind.TEXT_NOTE, content: "1" }); await db.addEvent(event_to_add); assertEquals( db.events.map((e): NostrEvent => { @@ -48,7 +48,7 @@ Deno.test("Database", async () => { await db.addEvent(event_to_add); // add a duplicated event assertEquals(db.events.length, 1); // no changes - const event_to_add2 = await prepareNormalNostrEvent(ctx, NostrKind.TEXT_NOTE, [], "2"); + const event_to_add2 = await prepareNormalNostrEvent(ctx, { kind: NostrKind.TEXT_NOTE, content: "2" }); // console.log(event_to_add2.id, event_to_add.id) await db.addEvent(event_to_add2); const e2 = await stream.pop() as NostrEvent; diff --git a/features/profile.ts b/features/profile.ts index 1bbcd52..d045f25 100644 --- a/features/profile.ts +++ b/features/profile.ts @@ -51,9 +51,7 @@ export async function saveProfile( ) { const event = await prepareNormalNostrEvent( sender, - NostrKind.META_DATA, - [], - JSON.stringify(profile), + { kind: NostrKind.META_DATA, content: JSON.stringify(profile) }, ); pool.sendEvent(event); } diff --git a/lib/nostr-ts b/lib/nostr-ts index a232717..53303f1 160000 --- a/lib/nostr-ts +++ b/lib/nostr-ts @@ -1 +1 @@ -Subproject commit a2327172fdf711c2e3bf02d8fefe4b6dae9a2910 +Subproject commit 53303f151e4787ec46e1e77584508634129e6cfd diff --git a/nostr.test.ts b/nostr.test.ts index 024e5e0..dc51cca 100644 --- a/nostr.test.ts +++ b/nostr.test.ts @@ -50,9 +50,11 @@ Deno.test("Generate reply event", async () => { const message1 = await prepareNormalNostrEvent( userAContext, - NostrKind.DIRECT_MESSAGE, - [], - "text message 1", + { + kind: NostrKind.DIRECT_MESSAGE, + + content: "text message 1", + }, ); const replyMessage1WithText = await prepareReplyEvent( diff --git a/nostr.ts b/nostr.ts index 11c172e..1088a38 100644 --- a/nostr.ts +++ b/nostr.ts @@ -168,23 +168,25 @@ export async function prepareReplyEvent( return prepareNormalNostrEvent( sender, - targetEvent.kind, - [ - [ - "e", - targetEvent.id, - "", - "reply", - ], - ...ps.map((p) => + { + kind: targetEvent.kind, + tags: [ [ - "p", - p, - ] as TagPubKey - ), - ...tags, - ], - content, + "e", + targetEvent.id, + "", + "reply", + ], + ...ps.map((p) => + [ + "p", + p, + ] as TagPubKey + ), + ...tags, + ], + content, + }, ); }