/** * Proton Web SDK v5.0.0 * https://github.com/XPRNetwork/proton-web-sdk * * @license * MIT License * * Copyright (c) 2020-2023 Metallicus * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import { LinkStorage, LinkTransport, LinkOptions, TransactArgs, TransactOptions, LinkSession, Link, LoginResult } from '@proton/link'; export { Link, LinkSession, TransactResult } from '@proton/link'; import { BrowserTransportOptions } from '@proton/browser-transport'; import { JsonRpc } from '@proton/js'; import { UIRendererOptions } from '@proton/web-renderer'; interface Authorization { actor: string; permission: string; } declare class Deferred { promise: Promise; reject: any; resolve: any; constructor(); } declare class ProtonWebLink { deferredTransact: { deferral: Deferred; transaction: any; params: any; waitingForOpen: boolean; } | undefined; deferredLogin: Deferred | undefined; scheme: string; storage: LinkStorage | null | undefined; client: JsonRpc | undefined; testUrl: string | undefined; transport: LinkTransport; chainId: string; get childWindow(): Window | null; set childWindow(window: Window | null); constructor(options: LinkOptions & { testUrl?: string; }); childUrl(path: string): string; closeChild(force?: boolean): void; createSession(auth: Authorization): { auth: Authorization; chainId: string; transact: (args: TransactArgs, options?: TransactOptions) => Promise; link: { walletType: string; client: JsonRpc | undefined; }; }; login(): Promise<{ session: { auth: Authorization; chainId: string; transact: (args: TransactArgs, options?: TransactOptions | undefined) => Promise; link: { walletType: string; client: JsonRpc | undefined; }; }; }>; restoreSession(/* requestAccount */ _: string, auth: any): Promise<{ auth: Authorization; chainId: string; transact: (args: TransactArgs, options?: TransactOptions | undefined) => Promise; link: { walletType: string; client: JsonRpc | undefined; }; }>; removeSession(appIdentifier: string, auth: any, chainId: any): Promise<{ appIdentifier: string; auth: any; chainId: any; }>; onEvent(e: MessageEvent): Promise; } type PartialBy = Omit & Partial>; type UIOptions = UIRendererOptions; interface SelectorOptions { walletType?: string; enabledWalletTypes?: string[]; } type LocalLinkOptions = PartialBy & { endpoints: string[]; storage?: LinkStorage; storagePrefix?: string; restoreSession?: boolean; testUrl?: string; }; interface ConnectWalletArgs { linkOptions: LocalLinkOptions; transportOptions?: BrowserTransportOptions; selectorOptions?: SelectorOptions; uiOptions?: UIOptions; } interface ConnectWalletRet { session?: LinkSession; link?: ProtonWebLink | Link; loginResult?: LoginResult; error?: any; } interface WalletItem { key: string; value: string; } interface LoginOptions { selectorOptions: SelectorOptions; linkOptions: LocalLinkOptions; transportOptions: BrowserTransportOptions; } declare const setUITheme: (value: UIOptions['theme']) => void; declare const runUIDemo: ({ uiOptions }?: Pick) => Promise; declare const ConnectWallet: ({ linkOptions, transportOptions, selectorOptions, uiOptions, }: ConnectWalletArgs) => Promise; export { ProtonWebLink, ConnectWallet as default, runUIDemo, setUITheme }; export type { ConnectWalletArgs, ConnectWalletRet, LocalLinkOptions, LoginOptions, SelectorOptions, UIOptions, WalletItem };