story-research-zapwall/lib/publishResult.ts
2026-01-07 01:51:26 +01:00

30 lines
608 B
TypeScript

import type { Event } from 'nostr-tools'
/**
* Relay publish status
*/
export interface RelayPublishStatus {
relayUrl: string
success: boolean
error?: string | undefined
}
/**
* Result of publishing an event to relays
*/
export interface PublishResult {
event: Event | null
relayStatuses: RelayPublishStatus[]
}
/**
* Extract relay display name from URL
*/
export function getRelayDisplayName(relayUrl: string): string {
const cleaned = relayUrl.replace(/^wss?:\/\//, '').replace(/\/$/, '')
if (cleaned.length > 30) {
return `${cleaned.substring(0, 27)}...`
}
return cleaned
}