import type { ApiPromise } from "@polkadot/api";
import { ApiOptions } from "@polkadot/api/types";
import { ProviderInterface } from "@polkadot/rpc-provider/types";
import { SupportedChains } from "./specs/index.js";
/**
 * Detector is an API for providing an instance of the PolkadotJS API configured
 * to use a WASM-based light client.  It takes care of detecting whether the
 * user has the substrate connect browser extension installed or not and
 * configures the PolkadotJS API appropriately; falling back to a provider
 * which instantiates the WASM light client in the page when the extension is
 * not available.
 *
 * @example
 *
 * ```
 * import { Detector } from '@substrate/connect';
 *
 * // Create a new UApp with a unique name
 * const app = new Detector('burnr-wallet');
 * const westend = await app.connect('westend');
 * const kusama = await app.connect('kusama');
 *
 * await westend.rpc.chain.subscribeNewHeads((lastHeader) => {
 *   console.log(lastHeader.hash);
 * );
 * await kusama.rpc.chain.subscribeNewHeads((lastHeader) => {
 *   console.log(lastHeader.hash);
 * });
 *
 * // Interact with westend and kusama APIs ...
 *
 * await westend.disconnect();
 * await kusama.disconnect();
 * ```
 */
export declare class Detector {
    #private;
    /**
     * name is the name of the app. This is used by the extension to identify
     * your app in the user interface
     */
    get name(): string;
    /**
     * Returns `true` if the user has the extension installed otherwise false
     * @remarks
     * You should check this if you wish to show UI to encourage users to download and install the extension or if you wish your app only to work with the extension installed.
     */
    hasExtension(): boolean;
    /**
     * @param name - the name of your app.
     *
     * @remarks
     *
     * You should make a best effort to make your app name unique to avoid
     * confusion for users in the extension user interface
     */
    constructor(name: string);
    /**
     * connect attempts to detect the extension and configures the PolkadotJS
     * API instance to return appropriately.
     *
     * There are 4 bundled networks: "polkadot", "kusama", "rococo" and
     * "westend" which require no further configuration.
     *
     * Alternatively you may supply a chain spec and options to connect to a
     * custom chain with a light client .
     *
     * @param chainSpec - string of the chainSpec to connect to a network
     * @param parachainSpec - an optional param. This param is the parachain spec to connect to a different network)
     * @param options - an optional param for any extra API options to passed to
     * PolkadotJS when constructing it.
     * @returns a promise that resolves to an instance of the PolkadotJS API
     *
     * @remarks
     *
     * Typically options is used to pass custom types to PolkadotJS API.
     *
     * See the PolkadotJS docs for documentation on using PolkadotJS.
     *
     * {@link https://polkadot.js.org/docs/}
     */
    connect(chainSpec: string, parachainSpec?: string, options?: ApiOptions): Promise<ApiPromise>;
    /**
     * connect attempts to detect the extension and configures the PolkadotJS
     * API instance to return appropriately.
     *
     * There are 4 bundled networks: "polkadot", "kusama", "rococo" and
     * "westend" which require no further configuration.
     *
     * Alternatively you may supply a chain spec and options to connect to a
     * custom chain with a light client.
     *
     * @param knownChain - {@link SupportedChains} one of the predefined chainSpecs
     * @param parachainSpec - an optional param. This param is the parachain spec to connect to a different network)
     * @param options - an optional param for any extra API options to passed to
     * PolkadotJS when constructing it.
     * @returns a promise that resolves to an instance of the PolkadotJS API
     *
     * @remarks
     *
     * Typically options is used to pass custom types to PolkadotJS API.
     *
     * See the PolkadotJS docs for documentation on using PolkadotJS.
     *
     * {@link https://polkadot.js.org/docs/}
     */
    connect(knownChain: SupportedChains, parachainSpec?: string, options?: ApiOptions): Promise<ApiPromise>;
    /**
     * Detects and returns an appropriate PolkadotJS provider depending on whether the user has the substrate connect extension installed
     *
     * @param providerId - anId that uniquely identifies the provider in the context of this instance of the Detector
     * @param chain - either a string with the spec of the chain or the name of a supported chain ({@link SupportedChains})
     * @param parachainSpec - optional param of the parachain chainSpecs to connect to
     * @returns a provider will be used in a ApiPromise create for PolkadotJS API
     *
     * @internal
     *
     * @remarks
     * This is used internally for advanced PolkadotJS use cases and is not supported.  Use {@link connect} instead.
     */
    private internalProvider;
    /**
     * Detects and returns an appropriate PolkadotJS provider depending on whether the user has the substrate connect extension installed
     *
     * @param chainSpec - string of the chainSpec to connect to a network
     * @param parachainSpec - optional param of the parachain chainSpecs to connect to
     * @returns a provider will be used in a ApiPromise create for PolkadotJS API
     *
     * @internal
     *
     * @remarks
     * This is used internally for advanced PolkadotJS use cases and is not supported.  Use {@link connect} instead.
     */
    provider(chainSpec: string, parachainSpec?: string): Promise<ProviderInterface>;
    /**
     * Detects and returns an appropriate PolkadotJS provider depending on whether the user has the substrate connect extension installed
     *
     * @param knownChain - {@link SupportedChains} one of the predefined chainSpecs
     * @param parachainSpec - optional param of the parachain chainSpecs to connect to
     * @returns a provider will be used in a ApiPromise create for PolkadotJS API
     *
     * @internal
     *
     * @remarks
     * This is used internally for advanced PolkadotJS use cases and is not supported.  Use {@link connect} instead.
     */
    provider(knownChain: SupportedChains, parachainSpec?: string): Promise<ProviderInterface>;
}
//# sourceMappingURL=Detector.d.ts.map