revert: back to manual NIP-78 event creation

- AppDataBlueprint is not available in npm package (only in local workspace)
- Revert to manual event construction using factory.create()
- This approach works on Vercel's build environment
- Added comment explaining why we can't use the blueprint
This commit is contained in:
Gigi
2025-10-07 05:48:50 +01:00
parent 803df2d22b
commit 85aa77dba8

View File

@@ -3,7 +3,6 @@ import { EventFactory } from 'applesauce-factory'
import { RelayPool, onlyEvents } from 'applesauce-relay'
import { NostrEvent } from 'nostr-tools'
import { firstValueFrom } from 'rxjs'
import * as Blueprints from 'applesauce-factory/blueprints'
const SETTINGS_IDENTIFIER = 'com.dergigi.boris.user-settings'
const APP_DATA_KIND = 30078 // NIP-78 Application Data
@@ -137,13 +136,14 @@ export async function saveSettings(
): Promise<void> {
console.log('💾 Saving settings to nostr:', settings)
// Create NIP-78 application data event using the AppDataBlueprint
const draft = await factory.create(
Blueprints.AppDataBlueprint,
SETTINGS_IDENTIFIER,
settings,
false // no encryption
)
// Create NIP-78 application data event manually
// Note: AppDataBlueprint is not available in the npm package
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)