wallets-wrapper
Version:
How to install
58 lines (57 loc) • 1.84 kB
TypeScript
import { ExternalProvider } from '@ethersproject/providers';
import { ChainIds } from '../../../networks';
import { SignTypes } from '../../../networks/ethereum/constants';
export interface MetaMaskEthereumProvider {
isMetaMask?: boolean;
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
removeAllListeners(event?: string | symbol): this;
}
export interface AddEthereumChainParameter {
chainId: string;
chainName: string;
nativeCurrency: {
name: string;
symbol: string;
decimals: 18;
};
rpcUrls: string[];
blockExplorerUrls?: string[];
iconUrls?: string[];
}
export interface WatchAssetParams {
type: 'ERC20';
options: {
address: string;
symbol: string;
decimals: number;
image: string;
};
}
export interface CustomExternalProvider extends ExternalProvider {
request?: (request: {
method: string;
params?: Array<any> | WatchAssetParams;
}) => Promise<any>;
isConnected(): boolean;
}
export interface ConnectInfo {
chainId: string;
}
export interface SignProps {
type?: SignTypes;
message: string;
}
export declare type MetamaskProvider = MetaMaskEthereumProvider & CustomExternalProvider;
export interface NewEthereumWallet {
address: string;
mnemonic: string;
privateKey: string;
}
export interface GetBalanceProps {
network?: ChainIds;
address?: string;
}