You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
505 B

import { normalizeUrl } from '@/lib/url'
export type TRelayPublishStatus = { url: string; success: boolean }
/** Normalized relay URLs that accepted the event (for follow-up REQ). */
export function successfulPublishRelayUrls(relayStatuses: TRelayPublishStatus[] | undefined): string[] {
if (!relayStatuses?.length) return []
return Array.from(
new Set(
relayStatuses
.filter((s) => s.success)
.map((s) => normalizeUrl(s.url) || s.url)
.filter(Boolean)
)
)
}