Update docs

This commit is contained in:
Jon Staab
2026-06-10 14:12:47 -07:00
parent a33af11b1b
commit dbd043f105
35 changed files with 164 additions and 179 deletions
+2 -10
View File
@@ -38,15 +38,9 @@ export type SignedEvent = HashedEvent & {
sig: string;
};
// Wrapped event (NIP-59)
export type UnwrappedEvent = HashedEvent & {
wrap: SignedEvent;
};
// Event that can be either signed or wrapped
// Event that may or may not be signed
export type TrustedEvent = HashedEvent & {
sig?: string;
wrap?: SignedEvent;
};
```
@@ -72,8 +66,6 @@ export declare const isStampedEvent: (e: StampedEvent) => e is StampedEvent;
export declare const isOwnedEvent: (e: OwnedEvent) => e is OwnedEvent;
export declare const isHashedEvent: (e: HashedEvent) => e is HashedEvent;
export declare const isSignedEvent: (e: TrustedEvent) => e is SignedEvent;
export declare const isUnwrappedEvent: (e: TrustedEvent) => e is UnwrappedEvent;
export declare const isTrustedEvent: (e: TrustedEvent) => e is TrustedEvent;
```
### Event Utilities
@@ -88,7 +80,7 @@ export declare const getIdOrAddress: (e: HashedEvent) => string;
export declare const getIdAndAddress: (e: HashedEvent) => string[];
// Event deduplication by id or address
export declare const deduplicateEvents: (e: TrustedEvent) => TrustedEvent[];
export declare const deduplicateEvents: (events: TrustedEvent[]) => TrustedEvent[];
// Event type checking
export declare const isEphemeral: (e: EventTemplate) => boolean;
+2 -1
View File
@@ -79,7 +79,8 @@ const handlers = readHandlers(event)
```typescript
// Get unique handler identifier
const key = getHandlerKey(handler)
// => "1:30023:note-viewer" (kind:pubkey:identifier)
// => "1:31990:pubkey:identifier" (handler-kind:address)
// where address is the "kind:pubkey:identifier" of the handler event
// Display handler name
const name = displayHandler(handler, "Unknown Handler")
+6 -1
View File
@@ -32,13 +32,18 @@ export type ManagementRequest = {
method: ManagementMethod
params: string[]
}
export type ManagementResponse = {
result?: any
error?: string
}
```
## Functions
```typescript
// Sends a management request to a relay
export declare const sendManagementRequest: (url: string, request: ManagementRequest, authEvent: SignedEvent) => Promise<any>
export declare const sendManagementRequest: (url: string, request: ManagementRequest, authEvent: SignedEvent) => Promise<ManagementResponse>
```
## Example
+1 -1
View File
@@ -6,7 +6,7 @@ Implementation of NIP-98 HTTP Authentication for authenticating HTTP requests wi
```typescript
// Creates an HTTP auth event for authenticating requests
export declare const makeHttpAuth: (url: string, method?: string, body?: string) => Promise<Event>
export declare const makeHttpAuth: (url: string, method?: string, body?: string) => Promise<StampedEvent>
// Creates Authorization header from signed HTTP auth event
export declare const makeHttpAuthHeader: (event: SignedEvent) => string
+3 -1
View File
@@ -11,6 +11,8 @@ The `Relay` module provides utilities for working with Nostr relays, including U
export enum RelayMode {
Read = "read",
Write = "write",
Search = "search",
Blocked = "blocked",
Messaging = "messaging"
}
@@ -26,7 +28,7 @@ export type RelayProfile = {
version?: string;
negentropy?: number;
description?: string;
supported_nips?: number[];
supported_nips?: string[];
limitation?: {
min_pow_difficulty?: number;
payment_required?: boolean;
+1 -1
View File
@@ -44,7 +44,7 @@ export declare const hrpToMillisat: (hrpString: string) => bigint;
export declare const getInvoiceAmount: (bolt11: string) => number;
// Convert lightning address or URL to LNURL
export declare const getLnUrl: (address: string) => string | null;
export declare const getLnUrl: (address: string) => string | undefined;
```
### Zap Validation