/** * https://github.com/WalletConnect/web3modal/ */ import Web3 from "web3"; import { Network } from "./network"; export declare enum WalletType { METAMASK = 0, WALLETCONNECT = 1 } export declare var WalletTypeNames: string[]; export interface WalletConnect { type: WalletType; title: string; icon: string; url: string; } export declare var WalletConnects: WalletConnect[]; export declare enum WalletEvent { CHANGED = "change", DISCONNECTED = "disconnected", CONNECTED = "connected", CHAIN_CHANGED = "chainChanged", CURRENT_CHANGED = "currentChanged", READY = "ready" } export declare function on(name: WalletEvent, fn: (name: string, type: WalletType) => void): void; export declare function off(name?: WalletEvent, fn?: (name: string, type: WalletType) => void): void; export interface Wallet { /** * 钱包类型 */ type: WalletType; /** * 钱包地址 */ addr: string; /** * 网络 */ chainId: string; } /** * 检查钱包是否可用 * @param type * @returns */ export declare function isAvailable(type: WalletType): boolean; export declare function setCurrentWallet(wallet: Wallet | undefined): void; export declare function getCurrentWallet(): Wallet | undefined; export declare function getWeb3(type: WalletType): Promise; /** * 链接钱包 * @returns */ export declare function connect(type: WalletType): Promise; /** * 断开钱包 * @param w */ export declare function disconnect(w: Wallet): Promise; export declare function ready(fn?: () => void): Promise; export declare function isReady(): boolean; export declare function getWallet(type: WalletType): Wallet | undefined; export declare function switchNetwork(wallet: Wallet, network: Network): Promise; export declare function sign(wallet: Wallet, data: string): Promise; /** * 添加HTG代币到钱包 * @param wallet */ export declare function addHTGToWallet(wallet: Wallet): Promise; //# sourceMappingURL=wallet.d.ts.map