import { EventEmitter } from 'eventemitter3'; import { JSONRPCParams } from 'json-rpc-2.0'; type UPWindowConfig = Window | null | undefined | { url: string; mode: 'popup' | 'iframe'; name?: string; get: () => Promise>; set: (value: Record) => Promise; preventRegistration?: boolean; rdns?: string; icon?: string; }; interface UPClientProviderEvents { connect: (args: { chainId: `0x${string}`; }) => void; disconnect: () => void; accountsChanged: (accounts: `0x${string}`[]) => void; contextAccountsChanged: (contextAccounts: `0x${string}`[]) => void; requestAccounts: (accounts: `0x${string}`[]) => void; chainChanged: (chainId: number) => void; injected: (page: `0x${string}`) => void; rpcUrls: (rpcUrls: string[]) => void; windowClosed: () => void; initialized: () => void; } /** * Public interface for UPClientProvider. */ interface UPClientProvider { get isUPClientProvider(): boolean; /** * Return an array listing the events for which the emitter has registered * listeners. */ eventNames(): Array>; /** * Return the listeners registered for a given event. */ listeners>(event: T): Array>; /** * Return the number of listeners listening to a given event. */ listenerCount(event: EventEmitter.EventNames): number; /** * Calls each of the listeners registered for a given event. */ emit>(event: T, ...args: EventEmitter.EventArgs): boolean; /** * Add a listener for a given event. */ on>(event: T, fn: EventEmitter.EventListener, context?: any): this; addListener>(event: T, fn: EventEmitter.EventListener, context?: any): this; /** * Add a one-time listener for a given event. */ once>(event: T, fn: EventEmitter.EventListener, context?: any): this; /** * Remove the listeners of a given event. */ removeListener>(event: T, fn?: EventEmitter.EventListener, context?: any, once?: boolean): this; off>(event: T, fn?: EventEmitter.EventListener, context?: any, once?: boolean): this; /** * Remove all listeners, or those of the specified event. */ removeAllListeners(event?: EventEmitter.EventNames): this; request(method: string, params?: JSONRPCParams, clientParams?: any): Promise; request(method: { method: string; params?: JSONRPCParams; }, clientParams?: any): Promise; /** * Get the current chainId this is configured for and connected to. */ get chainId(): number; /** * Mirrors allowedAccounts, the accounts the provider is connected to */ get accounts(): `0x${string}`[]; /** * Additional context accounts provided by the parent connector. * Inside of the universaleverything grid this will contain the account * of the owner of the displayed grid (i.e. the owner of the profile being displayed.) */ get contextAccounts(): `0x${string}`[]; get isConnected(): boolean; get isMiniApp(): Promise; resume(delay?: number): void; } /** * Create clientUPProvider. This can be used like a normal window.ethereum or window.lukso provider. * It will on initialization look for a connection to a global provider. * * @param authURL Optionally put a URL to a authentication provider to provide the global provider. * @param search If false then don't search but take the passed in value as is. * @returns the client UPProvider */ declare function createClientUPProvider(authURL?: UPWindowConfig, search?: boolean): UPClientProvider; export { type UPClientProvider, type UPClientProviderEvents, createClientUPProvider };