@web3-vue-org2/crypto-com
Version:
46 lines (45 loc) • 2.13 kB
TypeScript
import type { DeFiConnectProvider } from '@deficonnect/provider';
import type { NetworkConfig } from '@deficonnect/types';
import type { Actions, AddEthereumChainParameter, Provider, WatchAssetParameters } from '@web3-vue-org2/types';
import { Connector } from '@web3-vue-org2/types';
type CryptoComProvider = Provider & DeFiConnectProvider;
export declare class NoCryptoComError extends Error {
constructor();
}
/**
* @param options - Options to pass to `@metamask/detect-provider`
* @param onError - Handler to report errors thrown from eventListeners.
*/
export interface CryptoComConstructorArgs {
actions: Actions;
options: NetworkConfig;
onError?: (error: Error) => void;
}
export declare class CryptoCom extends Connector {
/** {@inheritdoc Connector.provider} */
provider?: CryptoComProvider;
private readonly options;
private eagerConnection?;
constructor({ actions, options, onError }: CryptoComConstructorArgs);
private onConnect;
private onDisconnect;
private onChainChanged;
private onAccountsChanged;
private isomorphicInitialize;
/** {@inheritdoc Connector.connectEagerly} */
connectEagerly(): Promise<void>;
protected _activate(desiredChainIdOrChainParameters?: number | AddEthereumChainParameter): 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 | AddEthereumChainParameter): Promise<void>;
watchAsset({ address, symbol, decimals, image }: WatchAssetParameters): Promise<true>;
deactivate(): Promise<void>;
}
export {};