From 34a1d8db47352227642c19d4c5ce703c950b22ea Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 24 Nov 2025 20:07:44 -0300 Subject: [PATCH] kinds: more reliable regular/replaceable kind figuring. --- jsr.json | 2 +- kinds.ts | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsr.json b/jsr.json index ab017f9..55efa49 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@nostr/tools", - "version": "2.18.0", + "version": "2.18.1", "exports": { ".": "./index.ts", "./core": "./core.ts", diff --git a/kinds.ts b/kinds.ts index b61797c..e717d55 100644 --- a/kinds.ts +++ b/kinds.ts @@ -2,12 +2,12 @@ import { NostrEvent, validateEvent } from './pure.ts' /** Events are **regular**, which means they're all expected to be stored by relays. */ export function isRegularKind(kind: number): boolean { - return (1000 <= kind && kind < 10000) || [1, 2, 4, 5, 6, 7, 8, 16, 40, 41, 42, 43, 44].includes(kind) + return kind < 10000 && kind !== 0 && kind !== 3 } /** Events are **replaceable**, which means that, for each combination of `pubkey` and `kind`, only the latest event is expected to (SHOULD) be stored by relays, older versions are expected to be discarded. */ export function isReplaceableKind(kind: number): boolean { - return [0, 3].includes(kind) || (10000 <= kind && kind < 20000) + return kind === 0 || kind === 3 || (10000 <= kind && kind < 20000) } /** Events are **ephemeral**, which means they are not expected to be stored by relays. */ diff --git a/package.json b/package.json index ecd5f52..ed91856 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "nostr-tools", - "version": "2.18.0", + "version": "2.18.1", "description": "Tools for making a Nostr client.", "repository": { "type": "git",