Skip to main content

latest

TypeScript types for Nostr. Standardized types from the NIPs, as well as useful interfaces that promote consistency across your applications.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 days ago (0.30.1)
interface NStore

Nostr event store.

Methods

event(
event: NostrEvent,
opts?: { signal?: AbortSignal; },
): Promise<void>

Add an event to the store (equivalent of EVENT verb).

query(
filters: NostrFilter[],
opts?: { signal?: AbortSignal; },
): Promise<NostrEvent[]>

Get an array of events matching filters.

optional
count(
filters: NostrFilter[],
opts?: { signal?: AbortSignal; },
): Promise<NostrRelayCOUNT[2]>

Get the number of events matching filters (equivalent of COUNT verb).

optional
remove(
filters: NostrFilter[],
opts?: { signal?: AbortSignal; },
): Promise<void>

Remove events from the store. This action is temporary, unless a kind 5 deletion is issued.

Add Package

deno add @nostrify/types

Import symbol

import { type NStore } from "@nostrify/types";

---- OR ----

Import directly with a jsr specifier

import { type NStore } from "jsr:@nostrify/types";

Add Package

npx jsr add @nostrify/types

Import symbol

import { type NStore } from "@nostrify/types";

Add Package

yarn dlx jsr add @nostrify/types

Import symbol

import { type NStore } from "@nostrify/types";

Add Package

pnpm dlx jsr add @nostrify/types

Import symbol

import { type NStore } from "@nostrify/types";

Add Package

bunx jsr add @nostrify/types

Import symbol

import { type NStore } from "@nostrify/types";