fix: create NIP-78 events manually without blueprint import

- Remove AppDataBlueprint import that's not available in npm package
- Create application data events directly using factory.create()
- Manually construct event with kind 30078, d-tag identifier, and JSON content
- Fixes Vercel build by avoiding unavailable blueprint exports
This commit is contained in:
Gigi
2025-10-07 05:44:59 +01:00
parent 21545fc76a
commit a84fbe97b0

View File

@@ -1,6 +1,5 @@
import { IEventStore, mapEventsToStore } from 'applesauce-core'
import { EventFactory } from 'applesauce-factory'
import { AppDataBlueprint } from 'applesauce-factory/blueprints'
import { RelayPool, onlyEvents } from 'applesauce-relay'
import { NostrEvent } from 'nostr-tools'
import { firstValueFrom } from 'rxjs'
@@ -137,7 +136,14 @@ export async function saveSettings(
): Promise<void> {
console.log('💾 Saving settings to nostr:', settings)
const draft = await factory.create(AppDataBlueprint, SETTINGS_IDENTIFIER, settings, false)
// Create NIP-78 application data event manually
const draft = await factory.create(async () => ({
kind: APP_DATA_KIND,
content: JSON.stringify(settings),
tags: [['d', SETTINGS_IDENTIFIER]],
created_at: Math.floor(Date.now() / 1000)
}))
const signed = await factory.sign(draft)
console.log('📤 Publishing settings event:', signed.id, 'to', relays.length, 'relays')