cyphertap
Version:
Nostr, Lightning and Ecash on a single Button component
59 lines (58 loc) • 1.73 kB
TypeScript
import { type NDKFilter, type NDKRawEvent } from '@nostr-dev-kit/ndk';
export declare class CyphertapAPI {
#private;
private static instance;
private _isLoggedIn;
private _isReady;
private _npub;
constructor();
get isLoggedIn(): boolean;
get isReady(): boolean;
get balance(): number;
get npub(): string | null;
static getInstance(): CyphertapAPI;
getUserNpub(): string | null;
getUserHex(): string | null;
createLightningInvoice(amount: number, description?: string): Promise<{
bolt11: string;
}>;
sendLightningPayment(bolt11: string): Promise<{
success: boolean;
preimage?: string;
}>;
generateEcashToken(amount: number, memo?: string): Promise<{
token: string;
mint?: string;
}>;
receiveEcashToken(token: string): Promise<{
success: boolean;
amount: number;
}>;
publishTextNote(content: string): Promise<{
id: string;
pubkey: string;
}>;
publishEvent(event: Partial<NDKRawEvent>): Promise<{
id: string;
pubkey: string;
}>;
subscribe(filter: NDKFilter, callback: (event: {
id: string;
pubkey: string;
content: string;
kind: number;
created_at: number;
}) => void): () => void;
signEvent(event: Partial<NDKRawEvent>): Promise<{
id: string;
pubkey: string;
signature: string;
}>;
encrypt(content: string, recipientPubkey: string): Promise<string>;
decrypt(encryptedContent: string, senderPubkey: string): Promise<string>;
getConnectionStatus(): {
connected: number;
total: number;
};
}
export declare const cyphertap: CyphertapAPI;