Re work event types

This commit is contained in:
Jon Staab
2024-05-10 15:24:10 -07:00
parent 5a0fc174c1
commit c91d02f3ea
10 changed files with 242 additions and 131 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import type {UnsignedEvent} from 'nostr-tools'
import {nip19} from 'nostr-tools'
import {Kind} from './Kinds'
import {GROUP, COMMUNITY} from './Kinds'
export type Address = {
kind: number,
@@ -51,8 +51,8 @@ export const addressFromEvent = (e: UnsignedEvent, relays: string[] = []) =>
// Utils
export const isGroupAddress = (a: Address) => a.kind === Kind.GroupDefinition
export const isGroupAddress = (a: Address) => a.kind === GROUP
export const isCommunityAddress = (a: Address) => a.kind === Kind.CommunityDefinition
export const isCommunityAddress = (a: Address) => a.kind === COMMUNITY
export const isContextAddress = (a: Address) => [Kind.GroupDefinition, Kind.CommunityDefinition].includes(a.kind)
export const isContextAddress = (a: Address) => [GROUP, COMMUNITY].includes(a.kind)