@web3-vue-org2/coin98
Version:
54 lines (53 loc) • 2.11 kB
TypeScript
import type { Actions, AddEthereumChainParameter, Provider, WatchAssetParameters } from '@web3-vue-org2/types';
import { Connector } from '@web3-vue-org2/types';
type Coin98Provider = Provider & {
isCoin98?: boolean;
isConnected?: () => boolean;
disconnect: () => Promise<void>;
get chainId(): string;
get accounts(): string[];
};
declare global {
interface Window {
coin98?: {
provider: Coin98Provider;
};
}
}
export declare class NoCoin98Error extends Error {
constructor();
}
/**
* @param onError - Handler to report errors thrown from eventListeners.
*/
export interface Coin98ConstructorArgs {
actions: Actions;
onError?: (error: Error) => void;
}
export declare class Coin98 extends Connector {
/** {@inheritdoc Connector.provider} */
provider?: Coin98Provider;
private eagerConnection?;
constructor({ actions, onError }: Coin98ConstructorArgs);
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 {};