ethers.js/packages/providers/lib.esm/web3-provider.d.ts

27 lines
995 B
TypeScript
Raw Normal View History

2019-05-15 01:48:48 +03:00
import { Networkish } from "@ethersproject/networks";
import { JsonRpcProvider } from "./json-rpc-provider";
2020-04-27 13:31:43 +03:00
export declare type ExternalProvider = {
2019-05-15 01:48:48 +03:00
isMetaMask?: boolean;
host?: string;
path?: string;
2020-04-27 13:31:43 +03:00
sendAsync?: (request: {
method: string;
params?: Array<any>;
}, callback: (error: any, response: any) => void) => void;
send?: (request: {
method: string;
params?: Array<any>;
}, callback: (error: any, response: any) => void) => void;
request?: (request: {
method: string;
params?: Array<any>;
}) => Promise<any>;
2019-05-15 01:48:48 +03:00
};
2020-04-27 13:31:43 +03:00
export declare type JsonRpcFetchFunc = (method: string, params?: Array<any>) => Promise<any>;
2019-05-15 01:48:48 +03:00
export declare class Web3Provider extends JsonRpcProvider {
2020-04-27 13:31:43 +03:00
readonly provider: ExternalProvider;
readonly jsonRpcFetchFunc: JsonRpcFetchFunc;
constructor(provider: ExternalProvider | JsonRpcFetchFunc, network?: Networkish);
2020-02-10 23:51:58 +03:00
send(method: string, params: Array<any>): Promise<any>;
2019-05-15 01:48:48 +03:00
}