applesauce-wallet-connect
Version:
NIP-47 Nostr Wallet Connect implementation for both clients and services.
29 lines (28 loc) • 1.7 kB
TypeScript
import { HiddenContentSigner } from "applesauce-core/helpers";
import { NostrEvent } from "nostr-tools";
import { Transaction } from "./response.js";
export declare const WALLET_NOTIFICATION_KIND = 23197;
export declare const WALLET_LEGACY_NOTIFICATION_KIND = 23196;
/** A symbol used to cache the wallet notification on the event */
export declare const WalletNotificationSymbol: unique symbol;
/** Supported notification types */
export type NotificationType = "payment_received" | "payment_sent";
/** Base notification structure */
export interface BaseNotification<TNotificationType extends NotificationType, TNotification> {
/** Indicates the structure of the notification field */
notification_type: TNotificationType;
/** Notification data */
notification: TNotification;
}
/** Payment received notification */
export type PaymentReceivedNotification = BaseNotification<"payment_received", Transaction>;
/** Payment sent notification */
export type PaymentSentNotification = BaseNotification<"payment_sent", Transaction>;
/** Union type for all NIP-47 notification types */
export type WalletNotification = PaymentReceivedNotification | PaymentSentNotification;
/** Checks if a kind 23196 or 23197 event is locked */
export declare function isWalletNotificationLocked(notification: NostrEvent): boolean;
/** Unlocks a kind 23196 or 23197 event */
export declare function unlockWalletNotification(notification: NostrEvent, signer: HiddenContentSigner): Promise<WalletNotification | undefined | null>;
/** Gets the wallet notification from a kind 23196 or 23197 event */
export declare function getWalletNotification(notification: NostrEvent): WalletNotification | undefined | null;