UNPKG

applesauce-wallet-connect

Version:

NIP-47 Nostr Wallet Connect implementation for both clients and services.

35 lines (34 loc) 2.43 kB
import { NostrEvent } from "nostr-tools"; import { WalletConnectEncryptionMethod } from "./encryption.js"; import { NotificationType as NotificationType } from "./notification.js"; export declare const WALLET_INFO_KIND = 13194; /** A symbol used to cache the wallet info on the event */ export declare const WalletInfoSymbol: unique symbol; export type WalletMethod = "pay_invoice" | "multi_pay_invoice" | "pay_keysend" | "multi_pay_keysend" | "make_invoice" | "lookup_invoice" | "list_transactions" | "get_balance" | "get_info"; /** Wallet service capabilities and information */ export interface WalletSupport { /** List of supported methods for this wallet service */ methods: WalletMethod[]; /** List of supported encryption methods */ encryption: WalletConnectEncryptionMethod[]; /** List of supported notifications, optional */ notifications?: NotificationType[]; } /** Gets the wallet info from a kind 13194 event */ export declare function getWalletSupport(info: NostrEvent): WalletSupport | null; /** Gets the encryption methods from a wallet info event */ export declare function getEncryptionMethods(info: NostrEvent | WalletSupport): WalletConnectEncryptionMethod[]; /** Checks if the wallet service supports a specific encryption method */ export declare function supportsEncryption(info: NostrEvent | WalletSupport, encryption: WalletConnectEncryptionMethod): boolean; /** Gets the preferred encryption method (nip44_v2 preferred over nip04) */ export declare function getPreferredEncryption(info: NostrEvent | WalletSupport): WalletConnectEncryptionMethod; /** Checks if the wallet service supports a specific method */ export declare function supportsMethod(info: NostrEvent | WalletSupport, method: WalletMethod): boolean; /** Checks if the wallet service supports notifications */ export declare function supportsNotifications(info: NostrEvent | WalletSupport): boolean; /** Checks if the wallet service supports a specific notification type */ export declare function supportsNotificationType(info: NostrEvent | WalletSupport, notificationType: NotificationType): boolean; /** Gets all supported methods from the wallet info */ export declare function getSupportedMethods(info: NostrEvent | WalletSupport): WalletMethod[]; /** Gets all supported notifications from the wallet info */ export declare function getSupportedNotifications(info: NostrEvent | WalletSupport): NotificationType[];