/** * WindStack SDK * Copyright (c) 2026 PT WIND KRIPTOGRAFI TEKNOLOGI * SPDX-License-Identifier: MIT */ import { VEXANIUM_MAINNET_CHAIN_ID, type VexaniumAccount, type VexaniumActionInput, type VexaniumClient, type VexSigningRequestResult, type VexSigningRequestUri } from "@windstack/vexanium"; declare const TELEGRAM_CAPABILITIES: readonly ["vex.accounts", "vex.sessions", "vex.signingRequest"]; type MaybePromise = T | Promise; export type WispTelegramEventSource = { onmessage: ((event: { data: string; }) => void) | null; onerror: ((event: unknown) => void) | null; close(): void; }; export type WispTelegramEventSourceFactory = (url: string) => WispTelegramEventSource; export type WispTelegramSessionStorage = { getItem(key: string): MaybePromise; setItem(key: string, value: string): MaybePromise; removeItem(key: string): MaybePromise; }; export type WispTelegramDappMetadata = { name: string; description?: string; icon?: string; origin?: string; url?: string; }; export type WispTelegramTransportOptions = { /** Public Wisp API base URL, for example https://api.windcrypto.com/wisp/v1. */ apiUrl: string; dapp: WispTelegramDappMetadata; /** * Optional Telegram Mini App return target used only for navigation after a * terminal wallet action. It is never part of DApp identity or session auth. */ telegramReturnUrl?: string; storage?: WispTelegramSessionStorage; storageKey?: string; fetch?: typeof globalThis.fetch; /** Optional EventSource factory for non-browser runtimes and deterministic tests. */ eventSource?: WispTelegramEventSourceFactory; /** Optional custom launcher. Telegram Mini Apps are detected automatically when omitted. */ openUrl?: (url: string) => MaybePromise; }; export type WispTelegramSession = Readonly<{ sessionId: string; account: VexaniumAccount; accounts: readonly VexaniumAccount[]; chainId: typeof VEXANIUM_MAINNET_CHAIN_ID; capabilities: typeof TELEGRAM_CAPABILITIES; origin: string; expiresAt?: number; /** * Opaque proof for the interactive connection that created this session. * Forward it once to an application backend that independently validates the * completed handoff. It is never persisted and is absent after restore. */ connectionHandoffId?: string; /** Zero means this is only a persisted pointer and has not been revalidated this runtime. */ validatedAt: number; }>; export type WispTelegramSessionListener = (session: WispTelegramSession | null) => void; export type WispTelegramTransactArgs = { actions: readonly VexaniumActionInput[]; signal?: AbortSignal; }; export declare class WispTelegramAlreadyConnectedError extends Error { constructor(); } export declare class WispTelegramNotConnectedError extends Error { constructor(); } export declare class WispTelegramRestoreRequiredError extends Error { constructor(); } export declare function createWispTelegramTransport(options: WispTelegramTransportOptions): Readonly<{ connect: (signal?: AbortSignal) => Promise>; restore: (signal?: AbortSignal) => Promise; disconnect: (signal?: AbortSignal) => Promise; subscribeSession(listener: WispTelegramSessionListener): () => boolean; connected: () => boolean; getSession: () => Readonly<{ sessionId: string; account: VexaniumAccount; accounts: readonly VexaniumAccount[]; chainId: typeof VEXANIUM_MAINNET_CHAIN_ID; capabilities: typeof TELEGRAM_CAPABILITIES; origin: string; expiresAt?: number; /** * Opaque proof for the interactive connection that created this session. * Forward it once to an application backend that independently validates the * completed handoff. It is never persisted and is absent after restore. */ connectionHandoffId?: string; /** Zero means this is only a persisted pointer and has not been revalidated this runtime. */ validatedAt: number; }> | null; getSessionId: () => Promise; getStoredSession: () => Promise; getAccounts: () => Promise; getChain: () => "f9f432b1851b5c179d2091a96f593aaed50ec7466b74f89301f957a83e56ce1f"; getCapabilities: () => readonly ["vex.accounts", "vex.sessions", "vex.signingRequest"]; /** Local cache reset only. Use disconnect() to revoke wallet authorization. */ clearSession: () => Promise; signSigningRequest: (request: VexSigningRequestUri, signal?: AbortSignal) => Promise; transact: (client: VexaniumClient, args: WispTelegramTransactArgs) => Promise; }>; export type WispTelegramTransport = ReturnType; export {}; //# sourceMappingURL=WispTelegramTransport.d.ts.map