refactor: client service
This commit is contained in:
parent
5afbdd0aa4
commit
21f09426cf
8 changed files with 459 additions and 491 deletions
|
|
@ -8,7 +8,7 @@ import { generateBech32IdFromETag, tagNameEquals } from './tag'
|
|||
import { isWebsocketUrl, normalizeHttpUrl, normalizeUrl } from './url'
|
||||
import { isTorBrowser } from './utils'
|
||||
|
||||
export function getRelayListFromEvent(event?: Event) {
|
||||
export function getRelayListFromEvent(event?: Event | null) {
|
||||
if (!event) {
|
||||
return { write: BIG_RELAY_URLS, read: BIG_RELAY_URLS, originalRelays: [] }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ export function getEmbeddedPubkeys(event: Event) {
|
|||
return embeddedPubkeys
|
||||
}
|
||||
|
||||
export function getLatestEvent(events: Event[]) {
|
||||
export function getLatestEvent(events: Event[]): Event | undefined {
|
||||
return events.sort((a, b) => b.created_at - a.created_at)[0]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue