UNPKG

@web3-vue-org2/bitkeep

Version:

54 lines (53 loc) 2.12 kB
import type { Actions, AddEthereumChainParameter, Provider, WatchAssetParameters } from '@web3-vue-org2/types'; import { Connector } from '@web3-vue-org2/types'; type BitKeepProvider = Provider & { isBitKeep?: boolean; isConnected?: () => boolean; disconnect: () => Promise<void>; get chainId(): string; get accounts(): string[]; }; declare global { interface Window { bitkeep?: { ethereum: BitKeepProvider; }; } } export declare class NoBitKeepError extends Error { constructor(); } /** * @param onError - Handler to report errors thrown from eventListeners. */ export interface BitKeepConstructorArgs { actions: Actions; onError?: (error: Error) => void; } export declare class BitKeep extends Connector { /** {@inheritdoc Connector.provider} */ provider?: BitKeepProvider; private eagerConnection?; constructor({ actions, onError }: BitKeepConstructorArgs); private onConnect; private onDisconnect; private onChainChanged; private onAccountsChanged; 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 | AddEthereumChainParameter): Promise<void>; activate(desiredChainIdOrChainParameters?: number | AddEthereumChainParameter): Promise<void>; deactivate(): Promise<void>; watchAsset({ address, symbol, decimals, image }: WatchAssetParameters): Promise<true>; } export {};