From 2f81da29cd13ad56b6464e0c61198538d12d7e20 Mon Sep 17 00:00:00 2001 From: David Murdoch Date: Mon, 22 Jun 2020 18:36:30 -0400 Subject: [PATCH] fix: fix ganache provider type (#592) --- typings/index.d.ts | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 4840ccbdce..4a05e0b665 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,5 +1,17 @@ declare module "ganache-core" { - import { Provider as Web3Provider } from "web3/providers"; + export interface JsonRpcPayload { + jsonrpc: string; + method: string; + params: any[]; + id?: string | number; + } + + export interface JsonRpcResponse { + jsonrpc: string; + id: number; + result?: any; + error?: string; + } namespace Ganache { export interface IProviderOptions { @@ -41,7 +53,20 @@ declare module "ganache-core" { export function provider(opts?: IProviderOptions): Provider; export function server(opts?: IServerOptions): any; - export interface Provider extends Web3Provider { + export interface Provider { + send( + payload: JsonRpcPayload, + callback: (error: Error | null, result?: JsonRpcResponse) => void + ): void; + + on(type: string, callback: () => void): void; + + once(type: string, callback: () => void): void; + + removeListener(type: string, callback: () => void): void; + + removeAllListeners(type: string): void; + close: (callback: Function) => void; } }