@web3-vue-org2/openblock
Version:
Web3 Vue Connector for OpenBlock
54 lines (53 loc) • 2.31 kB
TypeScript
import type { Actions, Provider } from '@web3-vue-org2/types';
import { Connector } from '@web3-vue-org2/types';
import 'regenerator-runtime';
type OpenBlockProvider = Provider & {
isOpenBlock: boolean;
onSDKLoaded: () => void;
isLogin: boolean;
};
declare global {
interface Window {
openblock?: OpenBlockProvider;
}
}
export declare class NoOpenBlockError extends Error {
constructor();
}
/**
* @param onError - Handler to report errors thrown from eventListeners.
*/
export interface OpenBlockConstructorArgs {
actions: Actions;
onError?: (error: Error) => void;
}
export declare class OpenBlock extends Connector {
/** {@inheritdoc Connector.provider} */
provider?: OpenBlockProvider;
private eagerConnection?;
constructor({ actions, onError }: OpenBlockConstructorArgs);
private isomorphicInitialize;
/** {@inheritdoc Connector.connectEagerly} */
connectEagerly(): Promise<void>;
/**
* Initiates a connection.
*
* @param desiredChainIdOrChainParameters - If defined, indicates the desired chain to connect to. If the user is
* already connected to this chain, no additional steps will be taken. Otherwise, the user will be prompted to switch
* to the chain, if one of two conditions is met: either they already have it added in their extension, or the
* argument is of type AddEthereumChainParameter, in which case the user will be prompted to add the chain with the
* specified parameters first, before being prompted to switch.
*/
protected _activate(desiredChainIdOrChainParameters?: number): Promise<void>;
/**
* Initiates a connection.
*
* @param desiredChainIdOrChainParameters - If defined, indicates the desired chain to connect to. If the user is
* already connected to this chain, no additional steps will be taken. Otherwise, the user will be prompted to switch
* to the chain, if one of two conditions is met: either they already have it added in their extension, or the
* argument is of type AddEthereumChainParameter, in which case the user will be prompted to add the chain with the
* specified parameters first, before being prompted to switch.
*/
activate(desiredChainIdOrChainParameters?: number): Promise<void>;
}
export {};