Change how Kinds work

This commit is contained in:
Jon Staab
2024-05-03 14:11:51 -07:00
parent d4cf63e906
commit 0dc2690e86
3 changed files with 86 additions and 82 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import type {UnsignedEvent} from 'nostr-tools'
import {nip19} from 'nostr-tools'
import {GROUP_DEFINITION, COMMUNITY_DEFINITION} from './Kinds'
import {Kind} 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 === GROUP_DEFINITION
export const isGroupAddress = (a: Address) => a.kind === Kind.GroupDefinition
export const isCommunityAddress = (a: Address) => a.kind === COMMUNITY_DEFINITION
export const isCommunityAddress = (a: Address) => a.kind === Kind.CommunityDefinition
export const isContextAddress = (a: Address) => [GROUP_DEFINITION, COMMUNITY_DEFINITION].includes(a.kind)
export const isContextAddress = (a: Address) => [Kind.GroupDefinition, Kind.CommunityDefinition].includes(a.kind)