UNPKG

@dioxide-js/detect-provider

Version:

A tiny utility for detecting the Dioxide-wallet provider which injected at window.dioxide.

20 lines (19 loc) 860 B
import * as DioxideJS from './interface'; export declare type DioWalletProvider = DioxideJS.Provider; export declare type DioWalletError = DioxideJS.ProviderRpcError; export declare type DioWalleTxRequest = DioxideJS.TxRequest; /** * Returns a Promise that resolves to the value of window.dioxide if it is * The Promise will not reject, but an error will be thrown if invalid options * are provided. * * @param options - Options bag. * @param options.timeout - Milliseconds to wait for 'dioxide#initialized' to * be dispatched. Default: 3000 * @returns A Promise that resolves with the Provider if it is detected within * given timeout, otherwise null. */ declare function detectDioxideProvider<T = DioxideJS.Provider>({ timeout, }?: { timeout?: number | undefined; }): Promise<T | null>; export default detectDioxideProvider;