applesauce-wallet-connect
Version:
NIP-47 Nostr Wallet Connect implementation for both clients and services.
45 lines (44 loc) • 2.16 kB
TypeScript
import { NotificationType } from "./notification.js";
import { WalletMethod } from "./support.js";
export interface WalletAuthURI {
/** The public key of the client requesting authorization */
client: string;
/** Required. URL of the relay where the client intends to communicate with the wallet service */
relays: string[];
/** The name of the client app (optional) */
name?: string;
/** The URL of an icon of the client app to display on the confirmation page (optional) */
icon?: string;
/** URI to open after the connection is created (optional) */
returnTo?: string;
/** The connection cannot be used after this date. Unix timestamp in seconds (optional) */
expiresAt?: number;
/** The maximum amount in millisats that can be sent per renewal period (optional) */
maxAmount?: number;
/** The reset the budget at the end of the given budget renewal. Can be never (default), daily, weekly, monthly, yearly (optional) */
budgetRenewal?: "never" | "daily" | "weekly" | "monthly" | "yearly";
/** List of request types that you need permission for (optional) */
methods?: WalletMethod[];
/** List of notification types that you need permission for (optional) */
notifications?: NotificationType[];
/** The makes an isolated app connection / sub-wallet with its own balance and only access to its own transaction list (optional) */
isolated?: boolean;
/** Url encoded, JSON-serialized metadata that describes the app connection (optional) */
metadata?: Record<string, any>;
/** The wallet name for nostr+walletauth+walletname scheme (optional) */
walletName?: string;
}
/**
* Parses a nostr+walletauth URI
* @throws {Error} if the authorization URI is invalid
*/
export declare function parseWalletAuthURI(authURI: string): WalletAuthURI;
/**
* Creates a nostr+walletauth URI from a WalletAuthURI object
*/
export declare function createWalletAuthURI(parts: WalletAuthURI): string;
/**
* Validates a WalletAuthURI object
* @returns true if valid, throws Error if invalid
*/
export declare function validateWalletAuthURI(parts: WalletAuthURI): boolean;