import { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from "@polkadot/rpc-provider/types";
import { SupportedChains } from "./specs/index.js";
/**
 * ScProvider is an API for providing an instance of a PolkadotJS Provider
 * 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 { ScProvider, SupportedChains } from '@substrate/connect';
 * import { ApiPromise } from '@polkadot/api';
 *
 * // Create a new UApp with a unique name
 * const westendProvider = ScProvider(SupportedChains.westend)
 * const westend = await ApiPromise.create({ provider: westendProvider })
 *
 * const kusamaProvider = ScProvider(SupportedChains.kusama)
 * const kusama = await ApiPromise.create({ provider: kusamaProvider })
 *
 * await westendProvider.rpc.chain.subscribeNewHeads((lastHeader) => {
 *   console.log(lastHeader.hash);
 * );
 * await kusamaProvider.rpc.chain.subscribeNewHeads((lastHeader) => {
 *   console.log(lastHeader.hash);
 * });
 *
 * // Interact with westend and kusama APIs ...
 *
 * await westendProvider.disconnect();
 * await kusamaProvider.disconnect();
 * ```
 */
export declare class ScProvider implements ProviderInterface {
    #private;
    get hasSubscriptions(): boolean;
    get isConnected(): boolean;
    /**
     * @param knownChain - the name of a supported chain ({@link SupportedChains})
     * @param parachainSpec - optional param of the parachain chainSpecs to connect to
     * @param autoConnect - whether the ScProvider should eagerly connect while its being instantiated. Defaults to `true`
     *
     */
    constructor(knownChain: SupportedChains, parachainSpec?: string, autoConnect?: boolean);
    /**
     * @param chainSpec - a string with the spec of the chain
     * @param parachainSpec - optional param of the parachain chainSpecs to connect to
     * @param autoConnect - whether the ScProvider should eagerly connect while its being instantiated. Defaults to `true`
     *
     */
    constructor(chainSpec: string, parachainSpec?: string, autoConnect?: boolean);
    /**
     * Detects and returns an appropriate PolkadotJS provider depending on whether the user has the substrate connect extension installed
     *
     * @param isExtension - whether the extension is installed
     * @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;
    /**
     * clone
     *
     * @remarks This method is not supported
     * @throws {@link Error}
     */
    clone(): ProviderInterface;
    /**
     * "Connect" to a Smoldot instance
     *
     * @returns a resolved Promise
     * @remarks this is async to fulfill the interface with PolkadotJS
     */
    connect(): Promise<void>;
    /**
     * Manually "disconnect"
     */
    disconnect(): Promise<void>;
    /**
     * Listen to provider events - in practice the smoldot provider only
     * emits a `connected` event after successfully starting the smoldot client
     * and `disconnected` after `disconnect` is called.
     * @param type - Event
     * @param sub - Callback
     */
    on(type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void;
    /**
     * Send an RPC request  the wasm client
     *
     * @param method - The RPC methods to execute
     * @param params - Encoded paramaters as applicable for the method
     */
    send<T>(method: string, params: unknown[]): Promise<T>;
    /**
     * Allows subscribing to a specific event.
     *
     * @param type     - Subscription type
     * @param method   - Subscription method
     * @param params   - Parameters
     * @param callback - Callback
     * @returns Promise  - resolves to the id of the subscription you can use with [[unsubscribe]].
     *
     * @example
     * <BR>
     *
     * ```javascript
     * const provider = new ExtensionProvider(client);
     * const rpc = new Rpc(provider);
     *
     * rpc.state.subscribeStorage([[storage.balances.freeBalance, <Address>]], (_, values) => {
     *   console.log(values)
     * }).then((subscriptionId) => {
     *   console.log('balance changes subscription id: ', subscriptionId)
     * })
     * ```
     */
    subscribe(type: string, method: string, params: any[], callback: ProviderInterfaceCallback): Promise<number | string>;
    /**
     * Allows unsubscribing to subscriptions made with [[subscribe]].
     *
     * @param type   - Subscription type
     * @param method - Subscription method
     * @param id     - Id passed for send parameter
     * @returns Promise resolving to whether the unsunscribe request was successful.
     */
    unsubscribe(type: string, method: string, id: number | string): Promise<boolean>;
}
//# sourceMappingURL=ScProvider.d.ts.map