feat: highlight (#346)
This commit is contained in:
parent
ef0dc9e923
commit
6c91ba9eff
8 changed files with 197 additions and 29 deletions
|
|
@ -29,6 +29,21 @@ export function generateEventIdFromETag(tag: string[]) {
|
|||
}
|
||||
}
|
||||
|
||||
export function generateEventIdFromATag(tag: string[]) {
|
||||
try {
|
||||
const [, coordinate, relay] = tag
|
||||
const [kind, pubkey, identifier] = coordinate.split(':')
|
||||
return nip19.naddrEncode({
|
||||
kind: Number(kind),
|
||||
pubkey,
|
||||
identifier,
|
||||
relays: relay ? [relay] : undefined
|
||||
})
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export function generateEventId(event: Pick<Event, 'id' | 'pubkey'>) {
|
||||
const relay = client.getEventHint(event.id)
|
||||
return nip19.neventEncode({ id: event.id, author: event.pubkey, relays: [relay] })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue