Files
grimoire/src/types/nostr.ts
Alejandro Gómez cd41034b2f 👶
2025-12-09 16:26:31 +01:00

37 lines
757 B
TypeScript

// Nostr Event interface following NIP-01 specification
export interface NostrEvent {
id: string;
pubkey: string;
created_at: number;
kind: number;
tags: string[][];
content: string;
sig: string;
}
// Filter interface for querying events
export interface NostrFilter {
ids?: string[];
authors?: string[];
kinds?: number[];
since?: number;
until?: number;
limit?: number;
search?: string;
[key: `#${string}`]: string[] | undefined;
}
// Relay connection state
export type RelayConnectionState =
| "connecting"
| "connected"
| "disconnected"
| "error";
// Relay message types
export type RelayMessage =
| ["EVENT", string, NostrEvent]
| ["EOSE", string]
| ["NOTICE", string]
| ["OK", string, boolean, string];